fix(diarization): учтён системный power profile

Зачем:
- часть Intel-стендов не публикует ACPI platform_profile
- balanced-режим на таком стенде доступен через power-profiles-daemon

Что:
- добавлен fallback на powerprofilesctl get
- поведение закреплено тестом

Проверка:
- uv run pytest -q tests/test_benchmark_experiment.py
- uv run ruff check для изменённых файлов
This commit is contained in:
Dmitry Dementiev committed 2026-08-31 15:16:10 +03:00
1 parent bd0d7e6736
commit 0ea4d56c9d
2 files changed
+32 -1

No files matched your search

+19 -1
View File
@@ -931,6 +931,24 @@ def _runtime_supply() -> str | None:
return None
def _runtime_profile() -> str | None:
profile = _read_optional_text(Path("/sys/firmware/acpi/platform_profile"))
if profile is not None:
return profile
try:
completed = subprocess.run(
["powerprofilesctl", "get"],
capture_output=True,
text=True,
check=False,
timeout=5,
)
except (OSError, subprocess.TimeoutExpired):
return None
value = completed.stdout.strip()
return value or None if completed.returncode == 0 else None
def _runtime_governor() -> str | None:
values = {
value
@@ -1006,7 +1024,7 @@ def runtime_guard_snapshot() -> dict[str, Any]:
swap = psutil.swap_memory()
return {
"supply": _runtime_supply(),
"profile": _read_optional_text(Path("/sys/firmware/acpi/platform_profile")),
"profile": _runtime_profile(),
"governor": _runtime_governor(),
"turbo": _runtime_turbo(),
"power_limits": _runtime_power_limits(),