feat: support Linux system monitoring
Add procfs memory and mount-aware disk collectors, Intel and AMD GPU backends, bounded Intel sampling, portable validation tools, and Linux setup documentation. Bump to 0.2.0 and verify on Windows and Ubuntu 24.04 under WSL2.
This commit is contained in:
@@ -34,7 +34,7 @@ test("Only a DXGI LUID can be inserted in the fixed PowerShell query", () => {
|
||||
assert.throws(() => intelCountersScript("'; exit; '"), /Invalid GPU adapter identity/)
|
||||
})
|
||||
|
||||
test("Intel-only collection excludes another GPU, coalesces concurrent calls, and caches", { skip: process.platform !== "win32" }, async () => {
|
||||
test("Windows Intel-only collection excludes another GPU, coalesces concurrent calls, and caches", async () => {
|
||||
let calls = 0
|
||||
const collector = new Monitor(async (file, args) => {
|
||||
calls++
|
||||
@@ -46,20 +46,21 @@ test("Intel-only collection excludes another GPU, coalesces concurrent calls, an
|
||||
engines: [engine(1, intel, 0, 12), engine(2, intel, 0, 8), engine(3, nvidia, 0, 99)],
|
||||
memory: [{ SharedUsage: 256 * 1024 ** 2 }],
|
||||
})
|
||||
})
|
||||
}, { platform: "win32" })
|
||||
const first = collector.snapshot()
|
||||
assert.equal(first, collector.snapshot())
|
||||
const snapshot = await first
|
||||
assert.equal(snapshot.gpu.adapter.percent, 20)
|
||||
assert.equal(snapshot.gpu.adapter.sharedUsed, 256 * 1024 ** 2)
|
||||
assert.equal(snapshot.gpu.adapter.memoryUsed, 256 * 1024 ** 2)
|
||||
assert.equal(snapshot.gpu.adapter.memoryKind, "shared")
|
||||
assert.equal(snapshot.disks.items[0].percent, 25)
|
||||
assert.equal(snapshot.gpu.error, null)
|
||||
assert.equal(await collector.snapshot(), snapshot)
|
||||
assert.equal(calls, 3)
|
||||
})
|
||||
|
||||
test("A missing GPU or failed disk query shows unavailable, never false idle/full values", { skip: process.platform !== "win32" }, async () => {
|
||||
const collector = new Monitor(async () => { throw new Error("Permission denied") })
|
||||
test("A missing GPU or failed Windows disk query shows unavailable, never false idle/full values", async () => {
|
||||
const collector = new Monitor(async () => { throw new Error("Permission denied") }, { platform: "win32" })
|
||||
const snapshot = await collector.snapshot()
|
||||
assert.equal(snapshot.gpu.adapter, null)
|
||||
assert.match(snapshot.gpu.error, /Permission denied/)
|
||||
|
||||
Reference in New Issue
Block a user