From 28f80c1e480b7c0491ab0d82be5737aeb018a73c Mon Sep 17 00:00:00 2001 From: fluzko Date: Fri, 10 Apr 2026 12:12:18 -0300 Subject: [PATCH 1/3] improve num helper function --- dial9-viewer/ui/trace_parser.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dial9-viewer/ui/trace_parser.js b/dial9-viewer/ui/trace_parser.js index 29718d88..226a1bb7 100644 --- a/dial9-viewer/ui/trace_parser.js +++ b/dial9-viewer/ui/trace_parser.js @@ -21,9 +21,11 @@ /** Parse a string/bigint/number to a JS number */ function num(v) { if (typeof v === "number") return v; - if (typeof v === "string") return Number(v); if (typeof v === "bigint") return Number(v); - return 0; + if (typeof v === "string" && v !== "") + if (!isNaN(Number(v))) return Number(v); + + throw new Error(`Invalid number: ${v}`); } /** From 3dc814f04da5283d281ad14b7827ad7ce6e8bbd2 Mon Sep 17 00:00:00 2001 From: fluzko Date: Fri, 10 Apr 2026 12:28:53 -0300 Subject: [PATCH 2/3] avoid blocking worker --- dial9-viewer/ui/test_trace_integrity.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dial9-viewer/ui/test_trace_integrity.js b/dial9-viewer/ui/test_trace_integrity.js index d9d31db0..f98d6f97 100644 --- a/dial9-viewer/ui/test_trace_integrity.js +++ b/dial9-viewer/ui/test_trace_integrity.js @@ -287,7 +287,10 @@ function testWakeEventTargetWorkerInRange() { (e) => e.eventType === EVENT_TYPES.WakeEvent ); const outOfRangeWorker = wakeEvents.find( - (e) => e.targetWorker !== 255 && e.targetWorker > maxWorkerId + (e) => + e.targetWorker !== 255 && // UNKNOWN + e.targetWorker !== 254 && // BLOCKING + e.targetWorker > maxWorkerId ); if (outOfRangeWorker) fail( From 1918a88cb340da5c18c5b7a62ff109b6248de0f8 Mon Sep 17 00:00:00 2001 From: fluzko Date: Fri, 10 Apr 2026 12:55:24 -0300 Subject: [PATCH 3/3] fail when no POIs & no CPU samples --- dial9-viewer/ui/test_trace_analysis.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/dial9-viewer/ui/test_trace_analysis.js b/dial9-viewer/ui/test_trace_analysis.js index c91fbf8d..24562d32 100644 --- a/dial9-viewer/ui/test_trace_analysis.js +++ b/dial9-viewer/ui/test_trace_analysis.js @@ -274,6 +274,7 @@ async function main() { trace.hasSchedWait, {} ); + if (pois.length === 0) fail("No long-poll points of interest found"); for (const p of pois) { if (p.type !== "long-poll") fail(`Wrong type: ${p.type}`); if (p.value <= 1) fail(`long-poll value ${p.value} <= 1ms`); @@ -290,6 +291,7 @@ async function main() { trace.hasSchedWait, {} ); + if (pois.length === 0) fail("No cpu-sampled points of interest found"); for (const p of pois) { if (p.type !== "cpu-sampled") fail(`Wrong type: ${p.type}`); if (p.value <= 0) fail(`cpu-sampled value ${p.value} <= 0`); @@ -306,6 +308,7 @@ async function main() { trace.hasSchedWait, {} ); + if (pois.length === 0) fail("No wake-delay points of interest found"); for (const p of pois) { if (p.type !== "wake-delay") fail(`Wrong type: ${p.type}`); if (p.value <= 100) fail(`wake-delay value ${p.value} <= 100µs`); @@ -332,8 +335,7 @@ async function main() { function testFlamegraphTree() { const cpuSamples = trace.cpuSamples.filter((s) => s.source !== 1); - if (cpuSamples.length === 0) - return pass("No CPU samples to test flamegraph"); + if (cpuSamples.length === 0) fail("No CPU samples found"); const root = buildFlamegraphTree(cpuSamples, trace.callframeSymbols); if (root.count !== cpuSamples.length) @@ -343,7 +345,7 @@ async function main() { function testFlattenFlamegraph() { const cpuSamples = trace.cpuSamples.filter((s) => s.source !== 1); - if (cpuSamples.length === 0) return pass("No CPU samples to test flatten"); + if (cpuSamples.length === 0) fail("No CPU samples found"); const root = buildFlamegraphTree(cpuSamples, trace.callframeSymbols); const { nodes, maxDepth } = flattenFlamegraph(root, cpuSamples.length); @@ -357,8 +359,7 @@ async function main() { function testBuildFgData() { const cpuSamples = trace.cpuSamples.filter((s) => s.source !== 1); - if (cpuSamples.length === 0) - return pass("No CPU samples to test buildFgData"); + if (cpuSamples.length === 0) fail("No CPU samples found"); const data = buildFgData(cpuSamples, trace.callframeSymbols); if (!data) fail("buildFgData returned null for non-empty samples");