( label: string, cycle: number, pid: number, port: number, )
| 462 | } |
| 463 | |
| 464 | async 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 | |
| 482 | function linearSlope(samples: MemorySample[]) { |
| 483 | if (samples.length < 2) { |
no test coverage detected