`inactive_file` from a cgroup memory.stat file — reclaimable page cache.
(statPath: string)
| 38 | |
| 39 | /** `inactive_file` from a cgroup memory.stat file — reclaimable page cache. */ |
| 40 | function readInactiveFile(statPath: string): number { |
| 41 | try { |
| 42 | const m = /^inactive_file (\d+)$/m.exec(fs.readFileSync(statPath, 'utf8')); |
| 43 | return m ? Number.parseInt(m[1]!, 10) : 0; |
| 44 | } catch { |
| 45 | return 0; |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Available headroom under the cgroup memory limit (v2 then v1), or null |
no test coverage detected