Further CPU Experimental Changes
CI / test (push) Failing after 4s
Release rolling / release (push) Successful in 7m14s

This commit is contained in:
Raven Scott
2026-07-21 12:17:06 -04:00
parent 1d902a89b0
commit ac4718cb66
11 changed files with 87 additions and 85 deletions
+13 -16
View File
@@ -16,6 +16,7 @@ import {
SAMPLE_INTERVAL_MS,
registerChart,
} from '../../../shared/metrics.js'
import { readFileCached, readFileBuf } from '../../utils/fd-cache.js'
import { extractHelper, hasEmbeddedHelper } from '../../native/extract-helper.js'
import logger from '../../utils/logger.js'
@@ -202,13 +203,12 @@ export class EbpfCollector extends EventEmitter {
_readVm() {
/** @type {Record<string, number>} */
const out = {}
try {
for (const line of fs.readFileSync('/proc/vmstat', 'utf8').split('\n')) {
const raw = readFileCached('/proc/vmstat')
if (raw) {
for (const line of raw.split('\n')) {
const [k, v] = line.trim().split(/\s+/)
if (k) out[k] = Number(v) || 0
}
} catch {
// ignore
}
return out
}
@@ -228,30 +228,27 @@ export class EbpfCollector extends EventEmitter {
const den = dHit + dMiss
let fileNr = [0, 0]
try {
const parts = fs.readFileSync('/proc/sys/fs/file-nr', 'utf8').trim().split(/\s+/)
const fileNrRaw = readFileCached('/proc/sys/fs/file-nr')
if (fileNrRaw) {
const parts = fileNrRaw.trim().split(/\s+/)
fileNr = [Number(parts[0]) || 0, Number(parts[2]) || 0]
} catch {
// ignore
}
let forks = 0
let ctxt = 0
try {
for (const line of fs.readFileSync('/proc/stat', 'utf8').split('\n')) {
const statRaw = readFileCached('/proc/stat')
if (statRaw) {
for (const line of statRaw.split('\n')) {
if (line.startsWith('processes ')) forks = Number(line.slice(10)) || 0
if (line.startsWith('ctxt ')) ctxt = Number(line.slice(5)) || 0
}
} catch {
// ignore
}
let tcp = 0
try {
const m = fs.readFileSync('/proc/net/sockstat', 'utf8').match(/TCP:\s+inuse\s+(\d+)/)
const sockRaw = readFileCached('/proc/net/sockstat')
if (sockRaw) {
const m = sockRaw.match(/TCP:\s+inuse\s+(\d+)/)
if (m) tcp = Number(m[1]) || 0
} catch {
// ignore
}
const batch = [