MCPcopy Create free account
hub / github.com/modem-dev/hunk / sample

Function sample

scripts/daemon-memory-check.ts:464–480  ·  view source on GitHub ↗
(
  label: string,
  cycle: number,
  pid: number,
  port: number,
)

Source from the content-addressed store, hash-verified

462}
463
464async function sample(
465 label: string,
466 cycle: number,
467 pid: number,
468 port: number,
469): Promise<MemorySample> {
470 const [memory, health] = await Promise.all([readProcessMemory(pid), readHealth(port)]);
471 return {
472 label,
473 cycle,
474 rssBytes: memory.rssBytes,
475 heapBytes: memory.heapBytes,
476 highWaterRssBytes: memory.highWaterRssBytes,
477 sessions: health?.sessions ?? null,
478 pendingCommands: health?.pendingCommands ?? null,
479 };
480}
481
482function linearSlope(samples: MemorySample[]) {
483 if (samples.length < 2) {

Callers 1

mainFunction · 0.85

Calls 2

readProcessMemoryFunction · 0.85
readHealthFunction · 0.70

Tested by

no test coverage detected