codebase: cleaning cruft part 1

This commit is contained in:
ed
2026-07-05 13:46:35 -04:00
parent deae250019
commit 27f2c25f1c
22 changed files with 64 additions and 371 deletions
+5 -31
View File
@@ -79,9 +79,6 @@ class PerformanceScope:
def get_monitor() -> PerformanceMonitor:
"""
[C: tests/test_perf_aggregate.py:test_build_tier3_context_scaling, tests/test_perf_dag.py:test_dag_performance]
"""
global _instance
if _instance is None:
_instance = PerformanceMonitor()
@@ -160,9 +157,6 @@ class PerformanceMonitor:
return self._history_sums[key] / len(h)
def start_frame(self) -> None:
"""
[C: tests/test_performance_monitor.py:test_perf_monitor_basic_timing]
"""
now = time.perf_counter()
with self._lock:
if self._last_frame_start_time > 0:
@@ -174,9 +168,6 @@ class PerformanceMonitor:
self._frame_count += 1
def end_frame(self) -> None:
"""
[C: tests/test_performance_monitor.py:test_perf_monitor_basic_timing]
"""
if self._start_time is None:
return
now = time.perf_counter()
@@ -205,18 +196,12 @@ class PerformanceMonitor:
self._fps_timer = 0.0
def start_component(self, name: str) -> None:
"""
[C: tests/test_performance_monitor.py:test_perf_monitor_component_timing, tests/test_performance_monitor.py:test_perf_monitor_extended_metrics]
"""
if not self.enabled: return
now = time.perf_counter()
with self._lock:
self._component_starts[name] = now
def end_component(self, name: str) -> None:
"""
[C: tests/test_performance_monitor.py:test_perf_monitor_component_timing, tests/test_performance_monitor.py:test_perf_monitor_extended_metrics]
"""
if not self.enabled: return
now = time.perf_counter()
with self._lock:
@@ -231,10 +216,7 @@ class PerformanceMonitor:
self._add_to_history(f'comp_{name}', elapsed)
def get_metrics(self) -> dict[str, float]:
"""
Returns current metrics and their moving averages. Thread-safe.
[C: tests/test_perf_aggregate.py:test_build_tier3_context_scaling, tests/test_perf_dag.py:test_dag_performance, tests/test_performance_monitor.py:test_perf_monitor_basic_timing, tests/test_performance_monitor.py:test_perf_monitor_component_timing, tests/test_performance_monitor.py:test_perf_monitor_extended_metrics, tests/test_performance_monitor.py:test_perf_monitor_scope_context_manager]
"""
"""Returns current metrics and their moving averages. Thread-safe."""
with self._lock:
fps = self._fps
last_ft = self._last_frame_time
@@ -267,10 +249,7 @@ class PerformanceMonitor:
return metrics
def get_history(self, key: str) -> List[float]:
"""
Returns a snapshot of the full history buffer for a specific metric key.
[C: tests/test_history.py:test_initial_state, tests/test_history.py:test_push_state, tests/test_history_manager.py:TestHistoryManager.test_get_history_returns_descriptions]
"""
"""Returns a snapshot of the full history buffer for a specific metric key."""
with self._lock:
if key in self._history:
return list(self._history[key])
@@ -279,16 +258,11 @@ class PerformanceMonitor:
return []
def scope(self, name: str) -> PerformanceScope:
"""
Returns a context manager for timing a component.
[C: tests/test_perf_aggregate.py:test_build_tier3_context_scaling, tests/test_performance_monitor.py:test_perf_monitor_scope_context_manager]
"""
"""Returns a context manager for timing a component."""
return PerformanceScope(self, name)
def stop(self) -> None:
"""
[C: tests/test_performance_monitor.py:test_perf_monitor_basic_timing, tests/test_performance_monitor.py:test_perf_monitor_component_timing, tests/test_performance_monitor.py:test_perf_monitor_extended_metrics, tests/test_performance_monitor.py:test_perf_monitor_scope_context_manager, tests/test_websocket_server.py:test_websocket_subscription_and_broadcast]
"""
self._stop_event.set()
if self._cpu_thread.is_alive():
self._cpu_thread.join(timeout=2.0)
self._cpu_thread.join(timeout=2.0)