@kylincloud/flamegraph 0.35.29 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/FlameGraph/FlameGraphComponent/index.d.ts.map +1 -1
- package/dist/ProfilerTable.d.ts.map +1 -1
- package/dist/flamegraphRenderWorker.js +1 -1
- package/dist/flamegraphRenderWorker.js.map +1 -1
- package/dist/index.cjs.js +3 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +3 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.node.cjs.js +2 -2
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.esm.js +4 -4
- package/dist/index.node.esm.js.map +1 -1
- package/dist/workers/createFlamegraphRenderWorker.d.ts.map +1 -1
- package/dist/workers/profilerTableWorker.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/FlameGraph/FlameGraphComponent/index.tsx +0 -31
- package/src/ProfilerTable.tsx +0 -42
- package/src/workers/createFlamegraphRenderWorker.ts +20 -4
- package/src/workers/flamegraphRenderWorker.ts +0 -6
- package/src/workers/profilerTableWorker.ts +0 -26
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createFlamegraphRenderWorker.d.ts","sourceRoot":"","sources":["../../src/workers/createFlamegraphRenderWorker.ts"],"names":[],"mappings":"AAAA,wBAAgB,4BAA4B,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"createFlamegraphRenderWorker.d.ts","sourceRoot":"","sources":["../../src/workers/createFlamegraphRenderWorker.ts"],"names":[],"mappings":"AAAA,wBAAgB,4BAA4B,IAAI,MAAM,CAsBrD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profilerTableWorker.d.ts","sourceRoot":"","sources":["../../src/workers/profilerTableWorker.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,sBAAsB,GAC9B;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,GACD;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEN,MAAM,MAAM,0BAA0B,GAClC;IACE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE;QACP,WAAW,EAAE;YACX,KAAK,EAAE,MAAM,EAAE,CAAC;YAChB,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;YACnB,MAAM,EAAE,QAAQ,GAAG,QAAQ,CAAC;YAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;YACnB,UAAU,CAAC,EAAE,MAAM,CAAC;SACrB,CAAC;QACF,MAAM,EAAE,MAAM,CAAC;QACf,eAAe,EAAE,KAAK,GAAG,MAAM,CAAC;QAChC,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC;CACH,GACD;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE;QACP,MAAM,EAAE,MAAM,CAAC;QACf,eAAe,EAAE,KAAK,GAAG,MAAM,CAAC;QAChC,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC;CACH,GACD;IACE,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;QACZ,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH,GACD;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH,CAAC;AAEN,MAAM,MAAM,2BAA2B,GACnC;IACE,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE;QACP,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CACH,GACD;IACE,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE;QACP,IAAI,EAAE,sBAAsB,EAAE,CAAC;QAC/B,KAAK,EAAE,MAAM,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;QACZ,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH,GACD;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE;QACP,IAAI,EAAE;YAAE,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAA;SAAE,GAAG,IAAI,CAAC;QACtC,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH,CAAC;AAEN,wBAAgB,yBAAyB,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"profilerTableWorker.d.ts","sourceRoot":"","sources":["../../src/workers/profilerTableWorker.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,sBAAsB,GAC9B;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,GACD;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEN,MAAM,MAAM,0BAA0B,GAClC;IACE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE;QACP,WAAW,EAAE;YACX,KAAK,EAAE,MAAM,EAAE,CAAC;YAChB,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;YACnB,MAAM,EAAE,QAAQ,GAAG,QAAQ,CAAC;YAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;YACnB,UAAU,CAAC,EAAE,MAAM,CAAC;SACrB,CAAC;QACF,MAAM,EAAE,MAAM,CAAC;QACf,eAAe,EAAE,KAAK,GAAG,MAAM,CAAC;QAChC,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC;CACH,GACD;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE;QACP,MAAM,EAAE,MAAM,CAAC;QACf,eAAe,EAAE,KAAK,GAAG,MAAM,CAAC;QAChC,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC;CACH,GACD;IACE,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;QACZ,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH,GACD;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH,CAAC;AAEN,MAAM,MAAM,2BAA2B,GACnC;IACE,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE;QACP,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CACH,GACD;IACE,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE;QACP,IAAI,EAAE,sBAAsB,EAAE,CAAC;QAC/B,KAAK,EAAE,MAAM,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;QACZ,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH,GACD;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE;QACP,IAAI,EAAE;YAAE,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAA;SAAE,GAAG,IAAI,CAAC;QACtC,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH,CAAC;AAEN,wBAAgB,yBAAyB,IAAI,MAAM,CAqQlD"}
|
package/package.json
CHANGED
|
@@ -80,7 +80,6 @@ export default function FlameGraphComponent(props: FlamegraphProps) {
|
|
|
80
80
|
const textCanvasRef = React.useRef<HTMLCanvasElement>(null);
|
|
81
81
|
const flamegraph = useRef<Flamegraph>();
|
|
82
82
|
const flamegraphText = useRef<Flamegraph>();
|
|
83
|
-
const renderSeq = useRef(0);
|
|
84
83
|
const renderWorkerRef = useRef<Worker | null>(null);
|
|
85
84
|
const rectOffscreenRef = useRef<OffscreenCanvas | null>(null);
|
|
86
85
|
const textOffscreenRef = useRef<OffscreenCanvas | null>(null);
|
|
@@ -159,8 +158,6 @@ export default function FlameGraphComponent(props: FlamegraphProps) {
|
|
|
159
158
|
}
|
|
160
159
|
const worker = createFlamegraphRenderWorker();
|
|
161
160
|
renderWorkerRef.current = worker;
|
|
162
|
-
// eslint-disable-next-line no-console
|
|
163
|
-
console.debug('[flamegraph] render worker created');
|
|
164
161
|
setTimeout(() => {
|
|
165
162
|
renderRectCanvas();
|
|
166
163
|
renderTextCanvas();
|
|
@@ -171,8 +168,6 @@ export default function FlameGraphComponent(props: FlamegraphProps) {
|
|
|
171
168
|
rectOffscreenRef.current = null;
|
|
172
169
|
textOffscreenRef.current = null;
|
|
173
170
|
workerReadyRef.current = { rect: false, text: false };
|
|
174
|
-
// eslint-disable-next-line no-console
|
|
175
|
-
console.debug('[flamegraph] render worker terminated');
|
|
176
171
|
};
|
|
177
172
|
}, [useRenderWorker]);
|
|
178
173
|
|
|
@@ -375,10 +370,6 @@ export default function FlameGraphComponent(props: FlamegraphProps) {
|
|
|
375
370
|
);
|
|
376
371
|
|
|
377
372
|
const constructCanvas = () => {
|
|
378
|
-
const seq = renderSeq.current + 1;
|
|
379
|
-
renderSeq.current = seq;
|
|
380
|
-
// eslint-disable-next-line no-console
|
|
381
|
-
console.time(`[flamegraph] constructCanvas #${seq}`);
|
|
382
373
|
if (canvasRef.current) {
|
|
383
374
|
const f = new Flamegraph(
|
|
384
375
|
flamebearer,
|
|
@@ -406,8 +397,6 @@ export default function FlameGraphComponent(props: FlamegraphProps) {
|
|
|
406
397
|
);
|
|
407
398
|
flamegraphText.current = f;
|
|
408
399
|
}
|
|
409
|
-
// eslint-disable-next-line no-console
|
|
410
|
-
console.timeEnd(`[flamegraph] constructCanvas #${seq}`);
|
|
411
400
|
};
|
|
412
401
|
|
|
413
402
|
const ensureRenderWorkerCanvases = useCallback(() => {
|
|
@@ -426,8 +415,6 @@ export default function FlameGraphComponent(props: FlamegraphProps) {
|
|
|
426
415
|
);
|
|
427
416
|
workerReadyRef.current.rect = true;
|
|
428
417
|
} catch (err) {
|
|
429
|
-
// eslint-disable-next-line no-console
|
|
430
|
-
console.debug('[flamegraph] rect transfer failed', err);
|
|
431
418
|
}
|
|
432
419
|
}
|
|
433
420
|
|
|
@@ -441,8 +428,6 @@ export default function FlameGraphComponent(props: FlamegraphProps) {
|
|
|
441
428
|
);
|
|
442
429
|
workerReadyRef.current.text = true;
|
|
443
430
|
} catch (err) {
|
|
444
|
-
// eslint-disable-next-line no-console
|
|
445
|
-
console.debug('[flamegraph] text transfer failed', err);
|
|
446
431
|
}
|
|
447
432
|
}
|
|
448
433
|
|
|
@@ -482,8 +467,6 @@ export default function FlameGraphComponent(props: FlamegraphProps) {
|
|
|
482
467
|
return false;
|
|
483
468
|
}
|
|
484
469
|
if (!renderWorkerRef.current) {
|
|
485
|
-
// eslint-disable-next-line no-console
|
|
486
|
-
console.debug('[flamegraph] worker not ready yet');
|
|
487
470
|
return true;
|
|
488
471
|
}
|
|
489
472
|
if (!ensureRenderWorkerCanvases()) {
|
|
@@ -512,35 +495,21 @@ export default function FlameGraphComponent(props: FlamegraphProps) {
|
|
|
512
495
|
};
|
|
513
496
|
|
|
514
497
|
const renderRectCanvas = () => {
|
|
515
|
-
const seq = renderSeq.current;
|
|
516
498
|
if (postWorkerRender('rect', { renderText: false })) {
|
|
517
|
-
// eslint-disable-next-line no-console
|
|
518
|
-
console.debug(`[flamegraph] renderRects via worker #${seq}`);
|
|
519
499
|
return;
|
|
520
500
|
}
|
|
521
|
-
// eslint-disable-next-line no-console
|
|
522
|
-
console.time(`[flamegraph] renderRects #${seq}`);
|
|
523
501
|
canvasRef?.current?.setAttribute('data-state', 'rendering');
|
|
524
502
|
flamegraph?.current?.render({ renderText: false });
|
|
525
503
|
canvasRef?.current?.setAttribute('data-state', 'rendered');
|
|
526
|
-
// eslint-disable-next-line no-console
|
|
527
|
-
console.timeEnd(`[flamegraph] renderRects #${seq}`);
|
|
528
504
|
};
|
|
529
505
|
|
|
530
506
|
const renderTextCanvas = () => {
|
|
531
|
-
const seq = renderSeq.current;
|
|
532
507
|
if (postWorkerRender('text', { renderRects: false })) {
|
|
533
|
-
// eslint-disable-next-line no-console
|
|
534
|
-
console.debug(`[flamegraph] renderText via worker #${seq}`);
|
|
535
508
|
return;
|
|
536
509
|
}
|
|
537
|
-
// eslint-disable-next-line no-console
|
|
538
|
-
console.time(`[flamegraph] renderText #${seq}`);
|
|
539
510
|
textCanvasRef?.current?.setAttribute('data-state', 'rendering');
|
|
540
511
|
flamegraphText?.current?.render({ renderRects: false });
|
|
541
512
|
textCanvasRef?.current?.setAttribute('data-state', 'rendered');
|
|
542
|
-
// eslint-disable-next-line no-console
|
|
543
|
-
console.timeEnd(`[flamegraph] renderText #${seq}`);
|
|
544
513
|
};
|
|
545
514
|
|
|
546
515
|
const dataUnavailable =
|
package/src/ProfilerTable.tsx
CHANGED
|
@@ -540,8 +540,6 @@ function Table({
|
|
|
540
540
|
const worker = createProfilerTableWorker();
|
|
541
541
|
workerRef.current = worker;
|
|
542
542
|
setWorkerInstance((prev) => prev + 1);
|
|
543
|
-
// eslint-disable-next-line no-console
|
|
544
|
-
console.debug('[profiler-table] worker created');
|
|
545
543
|
|
|
546
544
|
const handleMessage = (event: MessageEvent<ProfilerTableWorkerResponse>) => {
|
|
547
545
|
const msg = event.data;
|
|
@@ -553,10 +551,6 @@ function Table({
|
|
|
553
551
|
setRowCount(msg.payload.rowCount);
|
|
554
552
|
setWorkerReady(true);
|
|
555
553
|
setDataVersion((prev) => prev + 1);
|
|
556
|
-
// eslint-disable-next-line no-console
|
|
557
|
-
console.debug('[profiler-table] worker ready', {
|
|
558
|
-
rowCount: msg.payload.rowCount,
|
|
559
|
-
});
|
|
560
554
|
break;
|
|
561
555
|
}
|
|
562
556
|
case 'range': {
|
|
@@ -565,12 +559,6 @@ function Table({
|
|
|
565
559
|
}
|
|
566
560
|
setVisibleRowData(msg.payload.rows);
|
|
567
561
|
setVirtualRange({ start: msg.payload.start, end: msg.payload.end });
|
|
568
|
-
// eslint-disable-next-line no-console
|
|
569
|
-
console.debug('[profiler-table] range received', {
|
|
570
|
-
start: msg.payload.start,
|
|
571
|
-
end: msg.payload.end,
|
|
572
|
-
rows: msg.payload.rows.length,
|
|
573
|
-
});
|
|
574
562
|
break;
|
|
575
563
|
}
|
|
576
564
|
case 'findNode': {
|
|
@@ -579,10 +567,6 @@ function Table({
|
|
|
579
567
|
pendingFocusRef.current.delete(msg.payload.requestId);
|
|
580
568
|
resolver(msg.payload.node);
|
|
581
569
|
}
|
|
582
|
-
// eslint-disable-next-line no-console
|
|
583
|
-
console.debug('[profiler-table] findNode response', {
|
|
584
|
-
found: !!msg.payload.node,
|
|
585
|
-
});
|
|
586
570
|
break;
|
|
587
571
|
}
|
|
588
572
|
default:
|
|
@@ -596,8 +580,6 @@ function Table({
|
|
|
596
580
|
worker.terminate();
|
|
597
581
|
workerRef.current = null;
|
|
598
582
|
pendingFocusRef.current.clear();
|
|
599
|
-
// eslint-disable-next-line no-console
|
|
600
|
-
console.debug('[profiler-table] worker terminated');
|
|
601
583
|
};
|
|
602
584
|
}, [useWorker]);
|
|
603
585
|
|
|
@@ -607,8 +589,6 @@ function Table({
|
|
|
607
589
|
return Promise.resolve(findNodeByName(flamebearer, name));
|
|
608
590
|
}
|
|
609
591
|
const requestId = ++focusRequestIdRef.current;
|
|
610
|
-
// eslint-disable-next-line no-console
|
|
611
|
-
console.debug('[profiler-table] findNode request', { name, requestId });
|
|
612
592
|
return new Promise<{ i: number; j: number } | null>((resolve) => {
|
|
613
593
|
pendingFocusRef.current.set(requestId, resolve);
|
|
614
594
|
workerRef.current?.postMessage({
|
|
@@ -637,19 +617,11 @@ function Table({
|
|
|
637
617
|
(name: string) => {
|
|
638
618
|
// 先确保该项被高亮(如果未高亮则高亮,如果已高亮则保持)
|
|
639
619
|
if (!selectedItem.isJust || selectedItem.value !== name) {
|
|
640
|
-
// eslint-disable-next-line no-console
|
|
641
|
-
console.time(`[profiler-table] dblclick highlight ${name}`);
|
|
642
620
|
handleTableItemClick({ name });
|
|
643
|
-
// eslint-disable-next-line no-console
|
|
644
|
-
console.timeEnd(`[profiler-table] dblclick highlight ${name}`);
|
|
645
621
|
}
|
|
646
622
|
|
|
647
623
|
// 然后聚焦到火焰图
|
|
648
|
-
// eslint-disable-next-line no-console
|
|
649
|
-
console.time(`[profiler-table] dblclick focus ${name}`);
|
|
650
624
|
focusByName(name);
|
|
651
|
-
// eslint-disable-next-line no-console
|
|
652
|
-
console.timeEnd(`[profiler-table] dblclick focus ${name}`);
|
|
653
625
|
},
|
|
654
626
|
[focusByName, selectedItem, handleTableItemClick]
|
|
655
627
|
);
|
|
@@ -673,11 +645,7 @@ function Table({
|
|
|
673
645
|
// 菜单项:聚焦到此函数
|
|
674
646
|
const handleFocusClick = useCallback(() => {
|
|
675
647
|
if (!contextMenuTarget) return;
|
|
676
|
-
// eslint-disable-next-line no-console
|
|
677
|
-
console.time(`[profiler-table] menu focus ${contextMenuTarget}`);
|
|
678
648
|
focusByName(contextMenuTarget);
|
|
679
|
-
// eslint-disable-next-line no-console
|
|
680
|
-
console.timeEnd(`[profiler-table] menu focus ${contextMenuTarget}`);
|
|
681
649
|
handleMenuClose();
|
|
682
650
|
}, [contextMenuTarget, focusByName, handleMenuClose]);
|
|
683
651
|
|
|
@@ -793,8 +761,6 @@ function Table({
|
|
|
793
761
|
]);
|
|
794
762
|
|
|
795
763
|
const handleRangeChange = useCallback((start: number, end: number) => {
|
|
796
|
-
// eslint-disable-next-line no-console
|
|
797
|
-
console.debug('[profiler-table] range requested', { start, end });
|
|
798
764
|
setRequestedRange((prev) => {
|
|
799
765
|
if (prev && prev.start === start && prev.end === end) {
|
|
800
766
|
return prev;
|
|
@@ -847,11 +813,7 @@ function Table({
|
|
|
847
813
|
'data-row': `single;${x.name};${x.self};${x.total}`,
|
|
848
814
|
isRowSelected: isRowSelected(x.name),
|
|
849
815
|
onClick: () => {
|
|
850
|
-
// eslint-disable-next-line no-console
|
|
851
|
-
console.time(`[profiler-table] click ${x.name}`);
|
|
852
816
|
handleTableItemClick({ name: x.name });
|
|
853
|
-
// eslint-disable-next-line no-console
|
|
854
|
-
console.timeEnd(`[profiler-table] click ${x.name}`);
|
|
855
817
|
},
|
|
856
818
|
onContextMenu: (e: React.MouseEvent) => handleContextMenu(e, x.name),
|
|
857
819
|
onDoubleClick: () => handleDoubleClick(x.name),
|
|
@@ -921,11 +883,7 @@ function Table({
|
|
|
921
883
|
'data-row': `double;${x.name};${x.totalLeft};${x.leftTicks};${x.totalRght};${x.rightTicks}`,
|
|
922
884
|
isRowSelected: isRowSelected(x.name),
|
|
923
885
|
onClick: () => {
|
|
924
|
-
// eslint-disable-next-line no-console
|
|
925
|
-
console.time(`[profiler-table] click ${x.name}`);
|
|
926
886
|
handleTableItemClick({ name: x.name });
|
|
927
|
-
// eslint-disable-next-line no-console
|
|
928
|
-
console.timeEnd(`[profiler-table] click ${x.name}`);
|
|
929
887
|
},
|
|
930
888
|
onContextMenu: (e: React.MouseEvent) => handleContextMenu(e, x.name),
|
|
931
889
|
onDoubleClick: () => handleDoubleClick(x.name),
|
|
@@ -1,7 +1,23 @@
|
|
|
1
1
|
export function createFlamegraphRenderWorker(): Worker {
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
const metaUrl = new URL(import.meta.url);
|
|
3
|
+
const pathname = metaUrl.pathname;
|
|
4
|
+
const isFromSrc = pathname.includes('/src/');
|
|
5
|
+
const isFromDist = pathname.includes('/dist/');
|
|
6
|
+
const isFromViteDeps = pathname.includes('/node_modules/.vite/deps/');
|
|
7
|
+
|
|
8
|
+
if (isFromViteDeps) {
|
|
9
|
+
// Vite prebundle path -> hop back to node_modules/@kylincloud/flamegraph/dist
|
|
10
|
+
const viteDepsWorkerUrl = new URL(
|
|
11
|
+
'../../@kylincloud/flamegraph/dist/flamegraphRenderWorker.js',
|
|
12
|
+
metaUrl
|
|
13
|
+
);
|
|
14
|
+
return new Worker(viteDepsWorkerUrl, { type: 'module' });
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const workerUrl = isFromSrc
|
|
18
|
+
? new URL('./flamegraphRenderWorker.ts', metaUrl)
|
|
19
|
+
: isFromDist
|
|
20
|
+
? new URL('./flamegraphRenderWorker.js', metaUrl)
|
|
21
|
+
: new URL('./flamegraphRenderWorker.js', metaUrl);
|
|
6
22
|
return new Worker(workerUrl, { type: 'module' });
|
|
7
23
|
}
|
|
@@ -107,8 +107,6 @@ const runChunk = (kind: 'rect' | 'text', token: number) => {
|
|
|
107
107
|
}
|
|
108
108
|
const canvas = kind === 'rect' ? state.rectCanvas : state.textCanvas;
|
|
109
109
|
if (!canvas) {
|
|
110
|
-
// eslint-disable-next-line no-console
|
|
111
|
-
console.debug('[flamegraph-worker] missing canvas for', kind);
|
|
112
110
|
renderState.running = false;
|
|
113
111
|
return;
|
|
114
112
|
}
|
|
@@ -155,8 +153,6 @@ const renderFlamegraph = (payload: FlamegraphRenderRequest['payload']) => {
|
|
|
155
153
|
const canvas =
|
|
156
154
|
payload.kind === 'rect' ? state.rectCanvas : state.textCanvas;
|
|
157
155
|
if (!canvas) {
|
|
158
|
-
// eslint-disable-next-line no-console
|
|
159
|
-
console.debug('[flamegraph-worker] missing canvas for', payload.kind);
|
|
160
156
|
return;
|
|
161
157
|
}
|
|
162
158
|
|
|
@@ -188,8 +184,6 @@ self.onmessage = (event: MessageEvent<FlamegraphWorkerMessage>) => {
|
|
|
188
184
|
} else {
|
|
189
185
|
state.textCanvas = msg.payload.canvas;
|
|
190
186
|
}
|
|
191
|
-
// eslint-disable-next-line no-console
|
|
192
|
-
console.debug('[flamegraph-worker] init', msg.payload.kind);
|
|
193
187
|
return;
|
|
194
188
|
}
|
|
195
189
|
if (msg.type === 'render') {
|
|
@@ -275,13 +275,6 @@ export function createProfilerTableWorker(): Worker {
|
|
|
275
275
|
state.sortByDirection = payload.sortByDirection;
|
|
276
276
|
state.highlightQuery = payload.highlightQuery || '';
|
|
277
277
|
applyFilterAndSort();
|
|
278
|
-
// eslint-disable-next-line no-console
|
|
279
|
-
console.debug('[profiler-table-worker] init ready', {
|
|
280
|
-
rowCount: state.rows.length,
|
|
281
|
-
sortBy: state.sortBy,
|
|
282
|
-
sortByDirection: state.sortByDirection,
|
|
283
|
-
highlightQuery: state.highlightQuery,
|
|
284
|
-
});
|
|
285
278
|
self.postMessage({
|
|
286
279
|
type: 'ready',
|
|
287
280
|
payload: { rowCount: state.rows.length },
|
|
@@ -293,13 +286,6 @@ export function createProfilerTableWorker(): Worker {
|
|
|
293
286
|
state.sortByDirection = payload.sortByDirection;
|
|
294
287
|
state.highlightQuery = payload.highlightQuery || '';
|
|
295
288
|
applyFilterAndSort();
|
|
296
|
-
// eslint-disable-next-line no-console
|
|
297
|
-
console.debug('[profiler-table-worker] update ready', {
|
|
298
|
-
rowCount: state.rows.length,
|
|
299
|
-
sortBy: state.sortBy,
|
|
300
|
-
sortByDirection: state.sortByDirection,
|
|
301
|
-
highlightQuery: state.highlightQuery,
|
|
302
|
-
});
|
|
303
289
|
self.postMessage({
|
|
304
290
|
type: 'ready',
|
|
305
291
|
payload: { rowCount: state.rows.length },
|
|
@@ -311,12 +297,6 @@ export function createProfilerTableWorker(): Worker {
|
|
|
311
297
|
const safeStart = Math.max(0, start);
|
|
312
298
|
const safeEnd = Math.min(state.rows.length, end);
|
|
313
299
|
const rows = state.rows.slice(safeStart, safeEnd);
|
|
314
|
-
// eslint-disable-next-line no-console
|
|
315
|
-
console.debug('[profiler-table-worker] range', {
|
|
316
|
-
start: safeStart,
|
|
317
|
-
end: safeEnd,
|
|
318
|
-
requestId,
|
|
319
|
-
});
|
|
320
300
|
self.postMessage({
|
|
321
301
|
type: 'range',
|
|
322
302
|
payload: { rows, start: safeStart, end: safeEnd, requestId },
|
|
@@ -326,12 +306,6 @@ export function createProfilerTableWorker(): Worker {
|
|
|
326
306
|
const handleFindNode = (payload) => {
|
|
327
307
|
const { name, requestId } = payload;
|
|
328
308
|
const best = state.bestNodeByName.get(name);
|
|
329
|
-
// eslint-disable-next-line no-console
|
|
330
|
-
console.debug('[profiler-table-worker] findNode', {
|
|
331
|
-
name,
|
|
332
|
-
found: !!best,
|
|
333
|
-
requestId,
|
|
334
|
-
});
|
|
335
309
|
self.postMessage({
|
|
336
310
|
type: 'findNode',
|
|
337
311
|
payload: { node: best ? { i: best.i, j: best.j } : null, requestId },
|