Skip to content

Commit f7321fc

Browse files
authored
Merge branch 'main' into fix/compile-perf-profiling-macos
2 parents 61f739c + 58ecb0d commit f7321fc

3 files changed

Lines changed: 14 additions & 8 deletions

File tree

dial9-viewer/ui/test_trace_analysis.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ async function main() {
274274
trace.hasSchedWait,
275275
{}
276276
);
277+
if (pois.length === 0) fail("No long-poll points of interest found");
277278
for (const p of pois) {
278279
if (p.type !== "long-poll") fail(`Wrong type: ${p.type}`);
279280
if (p.value <= 1) fail(`long-poll value ${p.value} <= 1ms`);
@@ -290,6 +291,7 @@ async function main() {
290291
trace.hasSchedWait,
291292
{}
292293
);
294+
if (pois.length === 0) fail("No cpu-sampled points of interest found");
293295
for (const p of pois) {
294296
if (p.type !== "cpu-sampled") fail(`Wrong type: ${p.type}`);
295297
if (p.value <= 0) fail(`cpu-sampled value ${p.value} <= 0`);
@@ -306,6 +308,7 @@ async function main() {
306308
trace.hasSchedWait,
307309
{}
308310
);
311+
if (pois.length === 0) fail("No wake-delay points of interest found");
309312
for (const p of pois) {
310313
if (p.type !== "wake-delay") fail(`Wrong type: ${p.type}`);
311314
if (p.value <= 100) fail(`wake-delay value ${p.value} <= 100µs`);
@@ -332,8 +335,7 @@ async function main() {
332335

333336
function testFlamegraphTree() {
334337
const cpuSamples = trace.cpuSamples.filter((s) => s.source !== 1);
335-
if (cpuSamples.length === 0)
336-
return pass("No CPU samples to test flamegraph");
338+
if (cpuSamples.length === 0) fail("No CPU samples found");
337339

338340
const root = buildFlamegraphTree(cpuSamples, trace.callframeSymbols);
339341
if (root.count !== cpuSamples.length)
@@ -343,7 +345,7 @@ async function main() {
343345

344346
function testFlattenFlamegraph() {
345347
const cpuSamples = trace.cpuSamples.filter((s) => s.source !== 1);
346-
if (cpuSamples.length === 0) return pass("No CPU samples to test flatten");
348+
if (cpuSamples.length === 0) fail("No CPU samples found");
347349

348350
const root = buildFlamegraphTree(cpuSamples, trace.callframeSymbols);
349351
const { nodes, maxDepth } = flattenFlamegraph(root, cpuSamples.length);
@@ -357,8 +359,7 @@ async function main() {
357359

358360
function testBuildFgData() {
359361
const cpuSamples = trace.cpuSamples.filter((s) => s.source !== 1);
360-
if (cpuSamples.length === 0)
361-
return pass("No CPU samples to test buildFgData");
362+
if (cpuSamples.length === 0) fail("No CPU samples found");
362363

363364
const data = buildFgData(cpuSamples, trace.callframeSymbols);
364365
if (!data) fail("buildFgData returned null for non-empty samples");

dial9-viewer/ui/test_trace_integrity.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,10 @@ async function main() {
284284
(e) => e.eventType === EVENT_TYPES.WakeEvent
285285
);
286286
const outOfRangeWorker = wakeEvents.find(
287-
(e) => e.targetWorker !== 255 && e.targetWorker > maxWorkerId
287+
(e) =>
288+
e.targetWorker !== 255 && // UNKNOWN
289+
e.targetWorker !== 254 && // BLOCKING
290+
e.targetWorker > maxWorkerId
288291
);
289292
if (outOfRangeWorker)
290293
fail(

dial9-viewer/ui/trace_parser.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@
2121
/** Parse a string/bigint/number to a JS number */
2222
function num(v) {
2323
if (typeof v === "number") return v;
24-
if (typeof v === "string") return Number(v);
2524
if (typeof v === "bigint") return Number(v);
26-
return 0;
25+
if (typeof v === "string" && v !== "")
26+
if (!isNaN(Number(v))) return Number(v);
27+
28+
throw new Error(`Invalid number: ${v}`);
2729
}
2830

2931
/** Decompress gzip data if detected, otherwise return as-is. */

0 commit comments

Comments
 (0)