Files
rea/experiments/atomic-codemode/family-counters.mjs
T
29e0472812 test(experiment): measure queued and repeated native reads
Compare sequential and overlapping requests through both real MCP adapters
with the same preserved engine, selected instruction windows and full graph.
Retain the unexplained model-run anomaly without claiming a speed fix.

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
2026-10-16 14:25:22 +00:00

22 lines
725 B
JavaScript

// Read-only kernel counters for the currently bounded diagnostic payload.
import assert from "node:assert/strict";
import { readFile } from "node:fs/promises";
export async function familyCounters() {
const group = (await readFile("/proc/self/cgroup", "utf8"))
.split("\n")
.find((row) => row.startsWith("0::"))
?.slice(3);
assert.ok(group?.includes("rea-efficiency-"), "Run under resource-run.py");
const cpu = (await readFile(`/sys/fs/cgroup${group}/cpu.stat`, "utf8")).match(
/^usage_usec (\d+)$/mu,
);
assert.ok(cpu, "Missing cgroup CPU counter");
return {
cpu: Number(cpu[1]),
peak: Number(
(await readFile(`/sys/fs/cgroup${group}/memory.peak`, "utf8")).trim(),
),
};
}