MCPcopy Create free account
hub / github.com/winfunc/opcode / startMonitoring

Method startMonitoring

src/lib/analytics/resourceMonitor.ts:32–50  ·  view source on GitHub ↗

* Start monitoring resource usage with periodic sampling * @param intervalMs - Sampling interval in milliseconds (default: 60000ms = 1 minute)

(intervalMs: number = 60000)

Source from the content-addressed store, hash-verified

30 * @param intervalMs - Sampling interval in milliseconds (default: 60000ms = 1 minute)
31 */
32 startMonitoring(intervalMs: number = 60000): void {
33 if (this.isMonitoring) {
34 console.warn('Resource monitoring is already active');
35 return;
36 }
37
38 this.isMonitoring = true;
39 this.sampleCount = 0;
40
41 // Initial sample
42 this.collectAndReportMetrics();
43
44 // Set up periodic sampling
45 this.monitoringInterval = setInterval(() => {
46 this.collectAndReportMetrics();
47 }, intervalMs);
48
49 console.log(`Resource monitoring started with ${intervalMs}ms interval`);
50 }
51
52 /**
53 * Stop resource monitoring

Callers 1

main.tsxFile · 0.80

Calls 1

Tested by

no test coverage detected