MCPcopy Create free account
hub / github.com/cosdata/cosdata / stop_monitoring

Method stop_monitoring

tests/test_hybrid.py:125–144  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

123 return True
124
125 def stop_monitoring(self):
126 self.monitoring = False
127 if self.monitor_thread:
128 self.monitor_thread.join(timeout=1.0)
129
130 print(f"CPU monitoring stopped. Collected {len(self.cpu_samples)} samples")
131 if not self.cpu_samples:
132 return {"max_cpu": 0.0, "avg_cpu": 0.0, "samples": 0}
133
134 max_cpu = max(self.cpu_samples)
135 avg_cpu = sum(self.cpu_samples) / len(self.cpu_samples)
136 print(
137 f"CPU stats: max={max_cpu:.1f}%, avg={avg_cpu:.1f}%, samples={len(self.cpu_samples)}"
138 )
139
140 return {
141 "max_cpu": max_cpu,
142 "avg_cpu": avg_cpu,
143 "samples": len(self.cpu_samples),
144 }
145
146
147class QPSTracker:

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected