diff --git a/frigate/config.py b/frigate/config.py index 5bfe74ea9..82598197d 100644 --- a/frigate/config.py +++ b/frigate/config.py @@ -89,13 +89,21 @@ class UIConfig(FrigateBaseModel): ) +class StatsConfig(FrigateBaseModel): + amd_gpu_stats: bool = Field(default=True, title="Enable AMD GPU stats.") + intel_gpu_stats: bool = Field(default=True, title="Enable Intel GPU stats.") + network_bandwidth: bool = Field( + default=False, title="Enable network bandwidth for ffmpeg processes." + ) + + class TelemetryConfig(FrigateBaseModel): network_interfaces: List[str] = Field( default=["eth", "enp", "eno", "ens", "wl", "lo"], title="Enabled network interfaces for bandwidth calculation.", ) - network_bandwidth: bool = Field( - default=False, title="Enable network bandwidth for ffmpeg processes." + stats: StatsConfig = Field( + default_factory=StatsConfig, title="System Stats Configuration" ) version_check: bool = Field(default=True, title="Enable latest version check.") diff --git a/frigate/stats.py b/frigate/stats.py index b8191ec90..f90e05c92 100644 --- a/frigate/stats.py +++ b/frigate/stats.py @@ -181,6 +181,9 @@ async def set_gpu_stats( stats["nvidia-gpu"] = {"gpu": -1, "mem": -1} hwaccel_errors.append(args) elif "qsv" in args: + if not config.telemetry.stats.intel_gpu_stats: + continue + # intel QSV GPU intel_usage = get_intel_gpu_stats() @@ -193,6 +196,9 @@ async def set_gpu_stats( driver = os.environ.get(DRIVER_ENV_VAR) if driver == DRIVER_AMD: + if not config.telemetry.stats.amd_gpu_stats: + continue + # AMD VAAPI GPU amd_usage = get_amd_gpu_stats() @@ -202,6 +208,9 @@ async def set_gpu_stats( stats["amd-vaapi"] = {"gpu": -1, "mem": -1} hwaccel_errors.append(args) else: + if not config.telemetry.stats.intel_gpu_stats: + continue + # intel VAAPI GPU intel_usage = get_intel_gpu_stats()