MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / readCgroupBytes

Function readCgroupBytes

src/resolution/memory-budget.ts:28–37  ·  view source on GitHub ↗

Parse a cgroup value file: numeric bytes, or null for absent/'max'.

(path: string)

Source from the content-addressed store, hash-verified

26
27/** Parse a cgroup value file: numeric bytes, or null for absent/'max'. */
28function readCgroupBytes(path: string): number | null {
29 try {
30 const raw = fs.readFileSync(path, 'utf8').trim();
31 if (raw === 'max') return null;
32 const n = Number.parseInt(raw, 10);
33 return Number.isFinite(n) && n >= 0 ? n : null;
34 } catch {
35 return null;
36 }
37}
38
39/** `inactive_file` from a cgroup memory.stat file — reclaimable page cache. */
40function readInactiveFile(statPath: string): number {

Callers 1

cgroupMemoryAvailableFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected