fix: record a zero swap-out delta in bench passports
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+16
-7
@@ -928,12 +928,22 @@ def host_warnings(state: dict[str, Any]) -> list[str]:
|
||||
return warnings
|
||||
|
||||
|
||||
def swapouts_delta(start: dict[str, Any], end: dict[str, Any]) -> int | None:
|
||||
"""Прирост выгрузок в swap за прогон: None, если одного из счётчиков
|
||||
нет; иначе разность, в том числе 0 (счётчик 0 после перезагрузки —
|
||||
тоже значение, design change `fix-known-issues`, решение 13)."""
|
||||
before, after = start.get("swapouts"), end.get("swapouts")
|
||||
if before is None or after is None:
|
||||
return None
|
||||
return after - before
|
||||
|
||||
|
||||
def swap_warning(start: dict[str, Any], end: dict[str, Any]) -> str | None:
|
||||
"""Выгрузка в swap за прогон: счётчик вырос — предупреждение."""
|
||||
before, after = start.get("swapouts"), end.get("swapouts")
|
||||
if before is None or after is None or after <= before:
|
||||
delta = swapouts_delta(start, end)
|
||||
if delta is None or delta <= 0:
|
||||
return None
|
||||
return f"host swapped out {after - before} pages during the run: rerun"
|
||||
return f"host swapped out {delta} pages during the run: rerun"
|
||||
|
||||
|
||||
def vm_warnings(profile: Profile) -> list[str]:
|
||||
@@ -5821,10 +5831,9 @@ def main(argv: list[str]) -> int:
|
||||
if swapped is not None:
|
||||
meta["host_warnings"].append(swapped)
|
||||
say(f"WARNING: {swapped}")
|
||||
if state.get("swapouts") is not None and end_state.get("swapouts"):
|
||||
meta["host_state"]["swapouts_delta"] = (
|
||||
end_state["swapouts"] - state["swapouts"]
|
||||
)
|
||||
delta = swapouts_delta(state, end_state)
|
||||
if delta is not None:
|
||||
meta["host_state"]["swapouts_delta"] = delta
|
||||
slept = (time.time() - started_wall) - (time.monotonic() - started)
|
||||
meta["host_state"]["slept_seconds"] = round(max(0.0, slept))
|
||||
if slept > SLEEP_WARN_S:
|
||||
|
||||
Reference in New Issue
Block a user