Add config options for AMD and Intel GPU stats

This commit is contained in:
Nick Mowen 2023-06-06 14:37:05 -06:00
parent 7f8f7ce0b3
commit 3f909245e7
2 changed files with 19 additions and 2 deletions

View File

@ -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.")

View File

@ -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()