diff --git a/src/gausse/web/page.py b/src/gausse/web/page.py index afcd68f..4891dec 100644 --- a/src/gausse/web/page.py +++ b/src/gausse/web/page.py @@ -60,7 +60,8 @@ PAGE_HTML = r"""
Реализуемо
Нереализуемо
Доля реализуемых
-
Лучший КПД / скорость
+
Лучший КПД за всё время / скорость
+
Лучший КПД текущего цикла
GPU (GTX 1070)
@@ -132,6 +133,8 @@ async function refresh(){ let best = (o.top && o.top.length) ? o.top[0].efficiency : null; let bestV = (o.top_by_velocity && o.top_by_velocity.length) ? o.top_by_velocity[0].exit_velocity_mps : null; document.getElementById('c-best').textContent = fmtPct(best) + (bestV!=null ? ' / '+fmt(bestV,0)+' м/с' : ''); + document.getElementById('c-cycle').textContent = + o.cycle_best_pct==null ? '—' : o.cycle_best_pct.toFixed(2)+'% (цикл идёт)'; const g = o.gpu; document.getElementById('c-gpu').textContent = g ? `${g.util_pct}% · ${fmt(g.power_w,0)}Вт · ${g.temp_c}°C` diff --git a/src/gausse/web/stats.py b/src/gausse/web/stats.py index 54fe2f9..5a015bd 100644 --- a/src/gausse/web/stats.py +++ b/src/gausse/web/stats.py @@ -95,11 +95,25 @@ def overview(db_path: Path, log_path: Path | None = None, top_n: int = 15) -> di "efficiency_histogram": buckets, "top": top, "top_by_velocity": top_by_velocity, - "log_tail": _tail_log(log_path, 40) if log_path else [], + "log_tail": (tail := _tail_log(log_path, 40) if log_path else []), + # лучший КПД ТЕКУЩЕГО цикла (из лога): каждый цикл стартует со свежей + # популяции и карабкается заново — это ДРУГОЕ число, чем best за всё + # время, и без подписи их путали («сервер и морда не связаны») + "cycle_best_pct": _last_cycle_best(tail), "gpu": _gpu_stat(db_path), } +def _last_cycle_best(log_lines: list[str]) -> float | None: + import re + + for line in reversed(log_lines): + m = re.search(r"лучший_КПД=(-?[0-9.]+)%", line) + if m: + return float(m.group(1)) + return None + + def run_detail(db_path: Path, run_id: str) -> dict | None: conn = open_connection(db_path) try: