profiler-md 0.4.0 → 0.6.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/dist/cli/index.mjs +5512 -2297
- package/dist/index.d.mts +974 -62
- package/dist/index.js +2 -2
- package/docs/formats/jfr.md +16 -0
- package/docs/formats/jsc-heap-snapshot.md +3 -3
- package/docs/formats/pprof.md +8 -6
- package/docs/formats/speedscope.md +5 -4
- package/docs/formats/systing.md +25 -0
- package/docs/formats/v8-heap-snapshot.md +2 -2
- package/docs/languages/c.md +66 -9
- package/docs/languages/csharp.md +4 -3
- package/docs/languages/elixir.md +10 -7
- package/docs/languages/go.md +17 -12
- package/docs/languages/java.md +110 -60
- package/docs/languages/javascript.md +41 -19
- package/docs/languages/julia.md +103 -12
- package/docs/languages/php.md +63 -20
- package/docs/languages/python.md +35 -81
- package/docs/languages/ruby.md +20 -32
- package/docs/languages/rust.md +37 -8
- package/examples/output/c.gperftools.cpu.base.pprof.md +324 -0
- package/examples/output/c.gperftools.cpu.current.pprof.md +271 -0
- package/examples/output/c.gperftools.cpu.diff.pprof.md +98 -0
- package/examples/output/c.gperftools.heap.base.pprof.md +362 -0
- package/examples/output/c.gperftools.heap.current.pprof.md +362 -0
- package/examples/output/c.gperftools.heap.diff.pprof.md +28 -0
- package/examples/output/c.systing.cpu.base.systing.md +824 -0
- package/examples/output/c.systing.cpu.current.systing.md +825 -0
- package/examples/output/c.systing.cpu.diff.systing.md +238 -0
- package/examples/output/cpp.gperftools.cpu.base.pprof.md +557 -0
- package/examples/output/cpp.gperftools.cpu.current.pprof.md +573 -0
- package/examples/output/cpp.gperftools.cpu.diff.pprof.md +122 -0
- package/examples/output/cpp.gperftools.heap.base.pprof.md +67 -0
- package/examples/output/cpp.gperftools.heap.current.pprof.md +67 -0
- package/examples/output/cpp.gperftools.heap.diff.pprof.md +19 -0
- package/examples/output/csharp.dotnet-trace.base.speedscope.json.md +411 -0
- package/examples/output/csharp.dotnet-trace.current.speedscope.json.md +412 -0
- package/examples/output/csharp.dotnet-trace.diff.speedscope.json.md +122 -0
- package/examples/output/elixir.eflambe.cpu.base.collapsed.md +399 -0
- package/examples/output/elixir.eflambe.cpu.current.collapsed.md +398 -0
- package/examples/output/elixir.eflambe.cpu.diff.collapsed.md +92 -0
- package/examples/output/erlang.eflambe.cpu.base.collapsed.md +147 -0
- package/examples/output/erlang.eflambe.cpu.current.collapsed.md +147 -0
- package/examples/output/erlang.eflambe.cpu.diff.collapsed.md +18 -0
- package/examples/output/fsharp.dotnet-trace.base.speedscope.json.md +324 -0
- package/examples/output/fsharp.dotnet-trace.current.speedscope.json.md +314 -0
- package/examples/output/fsharp.dotnet-trace.diff.speedscope.json.md +119 -0
- package/examples/output/go.pprof.block.base.pprof.md +86 -0
- package/examples/output/go.pprof.block.current.pprof.md +83 -0
- package/examples/output/go.pprof.block.diff.pprof.md +42 -0
- package/examples/output/go.pprof.cpu.base.pprof.md +81 -0
- package/examples/output/go.pprof.cpu.current.pprof.md +70 -0
- package/examples/output/go.pprof.cpu.diff.pprof.md +52 -0
- package/examples/output/go.pprof.goroutine.base.pprof.md +43 -0
- package/examples/output/go.pprof.goroutine.current.pprof.md +43 -0
- package/examples/output/go.pprof.goroutine.diff.pprof.md +13 -0
- package/examples/output/go.pprof.heap-alloc.base.pprof.md +154 -0
- package/examples/output/go.pprof.heap-alloc.current.pprof.md +146 -0
- package/examples/output/go.pprof.heap-alloc.diff.pprof.md +67 -0
- package/examples/output/go.pprof.heap.base.pprof.md +154 -0
- package/examples/output/go.pprof.heap.current.pprof.md +146 -0
- package/examples/output/go.pprof.heap.diff.pprof.md +67 -0
- package/examples/output/go.pprof.mutex.base.pprof.md +55 -0
- package/examples/output/go.pprof.mutex.current.pprof.md +41 -0
- package/examples/output/go.pprof.mutex.diff.pprof.md +31 -0
- package/examples/output/go.pprof.threadcreate.base.pprof.md +55 -0
- package/examples/output/go.pprof.threadcreate.current.pprof.md +55 -0
- package/examples/output/go.pprof.threadcreate.diff.pprof.md +19 -0
- package/examples/output/java.async-profiler.all.base.jfr.md +1071 -0
- package/examples/output/java.async-profiler.all.current.jfr.md +1007 -0
- package/examples/output/java.async-profiler.all.diff.jfr.md +268 -0
- package/examples/output/java.async-profiler.alloc.base.jfr.md +425 -0
- package/examples/output/java.async-profiler.alloc.current.jfr.md +413 -0
- package/examples/output/java.async-profiler.alloc.diff.jfr.md +99 -0
- package/examples/output/java.async-profiler.cpu.base.collapsed.md +367 -0
- package/examples/output/java.async-profiler.cpu.base.jfr.md +485 -0
- package/examples/output/java.async-profiler.cpu.current.collapsed.md +355 -0
- package/examples/output/java.async-profiler.cpu.current.jfr.md +488 -0
- package/examples/output/java.async-profiler.cpu.diff.collapsed.md +117 -0
- package/examples/output/java.async-profiler.cpu.diff.jfr.md +118 -0
- package/examples/output/java.async-profiler.live.base.jfr.md +697 -0
- package/examples/output/java.async-profiler.live.current.jfr.md +684 -0
- package/examples/output/java.async-profiler.live.diff.jfr.md +191 -0
- package/examples/output/java.async-profiler.lock.base.jfr.md +140 -0
- package/examples/output/java.async-profiler.lock.current.jfr.md +108 -0
- package/examples/output/java.async-profiler.lock.diff.jfr.md +44 -0
- package/examples/output/java.async-profiler.nativemem.base.jfr.md +222 -0
- package/examples/output/java.async-profiler.nativemem.current.jfr.md +222 -0
- package/examples/output/java.async-profiler.nativemem.diff.jfr.md +65 -0
- package/examples/output/java.async-profiler.wall.base.jfr.md +400 -0
- package/examples/output/java.async-profiler.wall.current.jfr.md +420 -0
- package/examples/output/java.async-profiler.wall.diff.jfr.md +94 -0
- package/examples/output/java.jdk.all.base.jfr.md +1024 -0
- package/examples/output/java.jdk.all.current.jfr.md +1010 -0
- package/examples/output/java.jdk.all.diff.jfr.md +311 -0
- package/examples/output/java.jdk.alloc.base.jfr.md +1024 -0
- package/examples/output/java.jdk.alloc.current.jfr.md +1046 -0
- package/examples/output/java.jdk.alloc.diff.jfr.md +312 -0
- package/examples/output/java.jdk.cpu.base.jfr.md +1023 -0
- package/examples/output/java.jdk.cpu.current.jfr.md +1039 -0
- package/examples/output/java.jdk.cpu.diff.jfr.md +285 -0
- package/examples/output/java.jdk.live.base.jfr.md +1029 -0
- package/examples/output/java.jdk.live.current.jfr.md +1035 -0
- package/examples/output/java.jdk.live.diff.jfr.md +289 -0
- package/examples/output/java.jdk.lock.base.jfr.md +1040 -0
- package/examples/output/java.jdk.lock.current.jfr.md +1051 -0
- package/examples/output/java.jdk.lock.diff.jfr.md +339 -0
- package/examples/output/javascript.bun.base.cpuprofile.md +73 -0
- package/examples/output/javascript.bun.base.heapsnapshot.md +608 -0
- package/examples/output/javascript.bun.base.jsc-heap-snapshot.json.md +480 -0
- package/examples/output/javascript.bun.current.cpuprofile.md +73 -0
- package/examples/output/javascript.bun.current.heapsnapshot.md +608 -0
- package/examples/output/javascript.bun.current.jsc-heap-snapshot.json.md +480 -0
- package/examples/output/javascript.bun.diff.cpuprofile.md +54 -0
- package/examples/output/javascript.bun.diff.heapsnapshot.md +48 -0
- package/examples/output/javascript.bun.diff.jsc-heap-snapshot.json.md +62 -0
- package/examples/output/javascript.chrome.base.cpuprofile.md +163 -0
- package/examples/output/javascript.chrome.base.heapprofile.md +32 -0
- package/examples/output/javascript.chrome.base.heapsnapshot.md +649 -0
- package/examples/output/javascript.chrome.current.cpuprofile.md +149 -0
- package/examples/output/javascript.chrome.current.heapprofile.md +32 -0
- package/examples/output/javascript.chrome.current.heapsnapshot.md +647 -0
- package/examples/output/javascript.chrome.diff.cpuprofile.md +65 -0
- package/examples/output/javascript.chrome.diff.heapprofile.md +50 -0
- package/examples/output/javascript.chrome.diff.heapsnapshot.md +73 -0
- package/examples/output/javascript.deno.base.cpuprofile.md +122 -0
- package/examples/output/javascript.deno.current.cpuprofile.md +114 -0
- package/examples/output/javascript.deno.diff.cpuprofile.md +66 -0
- package/examples/output/javascript.node.base.cpuprofile.md +136 -0
- package/examples/output/javascript.node.base.heapprofile.md +56 -0
- package/examples/output/javascript.node.base.heapsnapshot.md +660 -0
- package/examples/output/javascript.node.current.cpuprofile.md +119 -0
- package/examples/output/javascript.node.current.heapprofile.md +52 -0
- package/examples/output/javascript.node.current.heapsnapshot.md +660 -0
- package/examples/output/javascript.node.diff.cpuprofile.md +70 -0
- package/examples/output/javascript.node.diff.heapprofile.md +34 -0
- package/examples/output/javascript.node.diff.heapsnapshot.md +39 -0
- package/examples/output/javascript.pprof.cpu.base.pprof.md +104 -0
- package/examples/output/javascript.pprof.cpu.current.pprof.md +120 -0
- package/examples/output/javascript.pprof.cpu.diff.pprof.md +63 -0
- package/examples/output/javascript.pprof.heap.base.pprof.md +86 -0
- package/examples/output/javascript.pprof.heap.current.pprof.md +57 -0
- package/examples/output/javascript.pprof.heap.diff.pprof.md +42 -0
- package/examples/output/javascript.safari.base.webkit-timeline-recording.json.md +388 -0
- package/examples/output/javascript.safari.current.webkit-timeline-recording.json.md +378 -0
- package/examples/output/javascript.safari.diff.webkit-timeline-recording.json.md +122 -0
- package/examples/output/julia.pprof-jl.alloc.base.pprof.md +124 -0
- package/examples/output/julia.pprof-jl.alloc.current.pprof.md +126 -0
- package/examples/output/julia.pprof-jl.alloc.diff.pprof.md +30 -0
- package/examples/output/julia.pprof-jl.cpu.base.pprof.md +177 -0
- package/examples/output/julia.pprof-jl.cpu.current.pprof.md +179 -0
- package/examples/output/julia.pprof-jl.cpu.diff.pprof.md +64 -0
- package/examples/output/julia.pprof-jl.wall.base.pprof.md +181 -0
- package/examples/output/julia.pprof-jl.wall.current.pprof.md +193 -0
- package/examples/output/julia.pprof-jl.wall.diff.pprof.md +64 -0
- package/examples/output/julia.profile.base.heapsnapshot.md +590 -0
- package/examples/output/julia.profile.current.heapsnapshot.md +590 -0
- package/examples/output/julia.profile.diff.heapsnapshot.md +288 -0
- package/examples/output/kotlin.async-profiler.all.base.jfr.md +920 -0
- package/examples/output/kotlin.async-profiler.all.current.jfr.md +925 -0
- package/examples/output/kotlin.async-profiler.all.diff.jfr.md +247 -0
- package/examples/output/kotlin.async-profiler.alloc.base.jfr.md +467 -0
- package/examples/output/kotlin.async-profiler.alloc.current.jfr.md +473 -0
- package/examples/output/kotlin.async-profiler.alloc.diff.jfr.md +122 -0
- package/examples/output/kotlin.async-profiler.cpu.base.collapsed.md +371 -0
- package/examples/output/kotlin.async-profiler.cpu.base.jfr.md +472 -0
- package/examples/output/kotlin.async-profiler.cpu.current.collapsed.md +370 -0
- package/examples/output/kotlin.async-profiler.cpu.current.jfr.md +445 -0
- package/examples/output/kotlin.async-profiler.cpu.diff.collapsed.md +124 -0
- package/examples/output/kotlin.async-profiler.cpu.diff.jfr.md +125 -0
- package/examples/output/kotlin.async-profiler.live.base.jfr.md +934 -0
- package/examples/output/kotlin.async-profiler.live.current.jfr.md +917 -0
- package/examples/output/kotlin.async-profiler.live.diff.jfr.md +245 -0
- package/examples/output/kotlin.async-profiler.lock.base.jfr.md +1 -0
- package/examples/output/kotlin.async-profiler.lock.current.jfr.md +1 -0
- package/examples/output/kotlin.async-profiler.lock.diff.jfr.md +1 -0
- package/examples/output/kotlin.async-profiler.nativemem.base.jfr.md +234 -0
- package/examples/output/kotlin.async-profiler.nativemem.current.jfr.md +234 -0
- package/examples/output/kotlin.async-profiler.nativemem.diff.jfr.md +65 -0
- package/examples/output/kotlin.async-profiler.wall.base.jfr.md +452 -0
- package/examples/output/kotlin.async-profiler.wall.current.jfr.md +457 -0
- package/examples/output/kotlin.async-profiler.wall.diff.jfr.md +125 -0
- package/examples/output/kotlin.jdk.all.base.jfr.md +1442 -0
- package/examples/output/kotlin.jdk.all.current.jfr.md +1343 -0
- package/examples/output/kotlin.jdk.all.diff.jfr.md +392 -0
- package/examples/output/kotlin.jdk.alloc.base.jfr.md +1418 -0
- package/examples/output/kotlin.jdk.alloc.current.jfr.md +1389 -0
- package/examples/output/kotlin.jdk.alloc.diff.jfr.md +383 -0
- package/examples/output/kotlin.jdk.cpu.base.jfr.md +1406 -0
- package/examples/output/kotlin.jdk.cpu.current.jfr.md +1374 -0
- package/examples/output/kotlin.jdk.cpu.diff.jfr.md +380 -0
- package/examples/output/kotlin.jdk.live.base.jfr.md +1378 -0
- package/examples/output/kotlin.jdk.live.current.jfr.md +1311 -0
- package/examples/output/kotlin.jdk.live.diff.jfr.md +381 -0
- package/examples/output/kotlin.jdk.lock.base.jfr.md +1427 -0
- package/examples/output/kotlin.jdk.lock.current.jfr.md +1374 -0
- package/examples/output/kotlin.jdk.lock.diff.jfr.md +386 -0
- package/examples/output/php.excimer.wall.base.speedscope.json.md +25 -0
- package/examples/output/php.excimer.wall.current.speedscope.json.md +25 -0
- package/examples/output/php.excimer.wall.diff.speedscope.json.md +29 -0
- package/examples/output/python.py-spy.cpu.base.collapsed.md +526 -0
- package/examples/output/python.py-spy.cpu.base.speedscope.json.md +37 -0
- package/examples/output/python.py-spy.cpu.current.collapsed.md +514 -0
- package/examples/output/python.py-spy.cpu.current.speedscope.json.md +37 -0
- package/examples/output/python.py-spy.cpu.diff.collapsed.md +122 -0
- package/examples/output/python.py-spy.cpu.diff.speedscope.json.md +31 -0
- package/examples/output/python.py-spy.wall.base.collapsed.md +527 -0
- package/examples/output/python.py-spy.wall.current.collapsed.md +518 -0
- package/examples/output/python.py-spy.wall.diff.collapsed.md +122 -0
- package/examples/output/ruby.rbspy.cpu.base.collapsed.md +90 -0
- package/examples/output/ruby.rbspy.cpu.base.pprof.md +105 -0
- package/examples/output/ruby.rbspy.cpu.base.speedscope.json.md +105 -0
- package/examples/output/ruby.rbspy.cpu.current.collapsed.md +90 -0
- package/examples/output/ruby.rbspy.cpu.current.pprof.md +115 -0
- package/examples/output/ruby.rbspy.cpu.current.speedscope.json.md +115 -0
- package/examples/output/ruby.rbspy.cpu.diff.collapsed.md +32 -0
- package/examples/output/ruby.rbspy.cpu.diff.pprof.md +44 -0
- package/examples/output/ruby.rbspy.cpu.diff.speedscope.json.md +44 -0
- package/examples/output/rust.pprof-rs.cpu.base.pprof.md +60 -0
- package/examples/output/rust.pprof-rs.cpu.current.pprof.md +60 -0
- package/examples/output/rust.pprof-rs.cpu.diff.pprof.md +24 -0
- package/package.json +17 -12
- package/readme.md +158 -48
- package/skills/profile-optimize/SKILL.md +160 -0
- package/docs/languages/cpp.md +0 -136
- package/docs/languages/erlang.md +0 -42
- package/docs/languages/fsharp.md +0 -49
- package/docs/languages/kotlin.md +0 -120
- package/docs/languages/typescript.md +0 -254
- package/examples/bun.cpuprofile.md +0 -475
- package/examples/deno.cpuprofile.md +0 -481
- package/examples/jsc-heap-snapshot.base.json.md +0 -507
- package/examples/jsc-heap-snapshot.current.json.md +0 -504
- package/examples/jsc-heap-snapshot.diff.json.md +0 -119
- package/examples/node.base.cpuprofile.md +0 -451
- package/examples/node.current.cpuprofile.md +0 -449
- package/examples/node.diff.cpuprofile.md +0 -82
- package/examples/node.heapprofile.md +0 -281
- package/examples/node.heapsnapshot.md +0 -694
- package/examples/node.pprof.md +0 -441
- package/examples/python.base.collapsed.md +0 -116
- package/examples/python.current.collapsed.md +0 -125
- package/examples/python.diff.collapsed.md +0 -51
- package/examples/rust.base.pprof.md +0 -477
- package/examples/rust.current.pprof.md +0 -480
- package/examples/rust.diff.pprof.md +0 -117
- package/examples/webkit-timeline-recording.json.md +0 -434
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RawSourceMap as SourceMap } from "source-map-js";
|
|
1
|
+
import { RawSourceMap as SourceMap, SourceMapConsumer } from "source-map-js";
|
|
2
2
|
|
|
3
3
|
//#region src/helpers/types.d.ts
|
|
4
4
|
type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float16Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array;
|
|
@@ -14,7 +14,6 @@ type SourceLocation = FileReference & {
|
|
|
14
14
|
/** The 1-based line number in the file. */line?: number; /** The 1-based column number in the file. */
|
|
15
15
|
column?: number;
|
|
16
16
|
};
|
|
17
|
-
declare const fileReferenceId: (fileReference: DeepReadonly<FileReference>) => string;
|
|
18
17
|
type FileReference = {
|
|
19
18
|
type: `absolute`;
|
|
20
19
|
url: URL;
|
|
@@ -22,8 +21,642 @@ type FileReference = {
|
|
|
22
21
|
type: `relative`;
|
|
23
22
|
path: string;
|
|
24
23
|
};
|
|
24
|
+
type SourceLocationInput = {
|
|
25
|
+
/** A string parseable into a {@link URL} or file path. */urlOrPath: string; /** The 1-based line number in the file at {@link urlOrPath}. */
|
|
26
|
+
line?: number; /** The 1-based column number in the file at {@link urlOrPath}. */
|
|
27
|
+
column?: number;
|
|
28
|
+
};
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/metric.d.ts
|
|
31
|
+
/** Phrases that can be used in prose related to a metric. */
|
|
32
|
+
type MetricPhrases = {
|
|
33
|
+
/** A noun to use in headings, like "CPU", "heap", etc. */titleNoun: string; /** A noun to use in columns like "time", "size", etc. */
|
|
34
|
+
columnNoun: string; /** A verb to use in prose like "took", "allocated", etc. */
|
|
35
|
+
pastTenseVerb: string; /** A verb phrase to use in prose like "time spent", "bytes allocated", etc. */
|
|
36
|
+
pastParticipleVerbPhrase: string;
|
|
37
|
+
};
|
|
38
|
+
/** A metric measured in a profile. */
|
|
39
|
+
type Metric = ({
|
|
40
|
+
type: `time`; /** The number of milliseconds this time unit takes up. */
|
|
41
|
+
milliseconds: number;
|
|
42
|
+
} | {
|
|
43
|
+
type: `size`; /** The number of bytes this space unit takes up. */
|
|
44
|
+
bytes: number;
|
|
45
|
+
} | {
|
|
46
|
+
/**
|
|
47
|
+
* A metric in a unit with no known scale, formatted as a bare count.
|
|
48
|
+
* {@link MetricPhrases.columnNoun} (a plural noun, e.g. `instructions`)
|
|
49
|
+
* names the unit in table headers.
|
|
50
|
+
*/
|
|
51
|
+
type: `custom`;
|
|
52
|
+
/**
|
|
53
|
+
* The singular noun following a count in prose, pluralized by the count
|
|
54
|
+
* (e.g. `cycle` → "84 cycles"). For a metric counting occurrences of the
|
|
55
|
+
* event its verb already names, use `time` → "slept 84 times".
|
|
56
|
+
*/
|
|
57
|
+
proseUnit: string;
|
|
58
|
+
}) & {
|
|
59
|
+
phrases: MetricPhrases;
|
|
60
|
+
};
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/modalities/profile/type.d.ts
|
|
63
|
+
/**
|
|
64
|
+
* A profile parsed into the uniform structure containing the distinct frames
|
|
65
|
+
* and the samples that reference them.
|
|
66
|
+
*
|
|
67
|
+
* A format that yields several profiles returns one of these per profile,
|
|
68
|
+
* typically sharing the same {@link Profile.frames} array reference.
|
|
69
|
+
*/
|
|
70
|
+
type Profile = {
|
|
71
|
+
type: `profile`;
|
|
72
|
+
/**
|
|
73
|
+
* The distinct frames the samples reference.
|
|
74
|
+
*
|
|
75
|
+
* A {@link Sample.frameIndices} entry is an index into this list.
|
|
76
|
+
*/
|
|
77
|
+
frames: ProfileStackFrame[]; /** @see {@link AggregatedProfile.metrics} */
|
|
78
|
+
metrics: Metric[]; /** The samples as a lazily-consumed iterable. */
|
|
79
|
+
samples: Iterable<Sample>;
|
|
80
|
+
/**
|
|
81
|
+
* Per-line metrics added after the samples, so a format can break a
|
|
82
|
+
* function's self time down by line from data accumulated while iterating
|
|
83
|
+
* {@link Profile.samples}.
|
|
84
|
+
*/
|
|
85
|
+
lineMetrics?: Iterable<SampleLineMetrics>;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* A function occurrence at an executing position.
|
|
89
|
+
*
|
|
90
|
+
* Its {@link name} and {@link location} (the function's *definition* location)
|
|
91
|
+
* identify the function; frames sharing them are the same function.
|
|
92
|
+
*
|
|
93
|
+
* {@link line} is the *executing* line and is used for the per-line breakdown,
|
|
94
|
+
* not identity.
|
|
95
|
+
*
|
|
96
|
+
* A converter produces these raw; the resolved origin's `normalizeFrame` then
|
|
97
|
+
* splits out the location and line for variants that pack them into the frame
|
|
98
|
+
* string.
|
|
99
|
+
*/
|
|
100
|
+
type ProfileStackFrame = {
|
|
101
|
+
/** The function's name, if known. */name?: string; /** Where the function was defined, if known. */
|
|
102
|
+
location?: SourceLocationInput;
|
|
103
|
+
/**
|
|
104
|
+
* The 1-based line where this frame was sampled, if known.
|
|
105
|
+
*
|
|
106
|
+
* Distinct from {@link location}'s line (the definition line): this is the
|
|
107
|
+
* executing line, which the aggregator forwards to the leaf function's
|
|
108
|
+
* per-line breakdown. Never a function-identity component.
|
|
109
|
+
*/
|
|
110
|
+
line?: number;
|
|
111
|
+
};
|
|
112
|
+
/** A single sample within a profile. */
|
|
113
|
+
type Sample = {
|
|
114
|
+
/**
|
|
115
|
+
* An identifier for this sample's call stack, if the caller has one (e.g. a
|
|
116
|
+
* format that references stacks by a constant-pool index).
|
|
117
|
+
*
|
|
118
|
+
* When provided, the aggregator memoizes the resolved call stack by this ID.
|
|
119
|
+
*/
|
|
120
|
+
id?: number; /** The values recorded for each metric. */
|
|
121
|
+
values: number[]; /** The call stack as indices into {@link Profile.frames}. */
|
|
122
|
+
frameIndices: number[]; /** The 1-based line number where the sample was taken, if known. */
|
|
123
|
+
line?: number; /** The number of identical occurrences of this sample, defaulting to `1`. */
|
|
124
|
+
sampleCount?: number;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Per-line metrics for one frame, added after sampling.
|
|
128
|
+
*
|
|
129
|
+
* Used by formats that report a function's self time broken down by line
|
|
130
|
+
* separately from its samples.
|
|
131
|
+
*/
|
|
132
|
+
type SampleLineMetrics = {
|
|
133
|
+
/** The frame's index into {@link Profile.frames}. */frame: number; /** The sampled lines within the frame's function body. */
|
|
134
|
+
lines: {
|
|
135
|
+
line: number;
|
|
136
|
+
sampleCount: number;
|
|
137
|
+
values: number[];
|
|
138
|
+
}[];
|
|
139
|
+
};
|
|
25
140
|
//#endregion
|
|
26
|
-
//#region src/
|
|
141
|
+
//#region src/origins/index.d.ts
|
|
142
|
+
/**
|
|
143
|
+
* A profiling tool paired with the runtime it observed (e.g. `node` for Node's
|
|
144
|
+
* native V8 profiler, `node-pprof` for the `pprof` npm package, `jvm` for JFR
|
|
145
|
+
* producers).
|
|
146
|
+
*
|
|
147
|
+
* Auto-detected from a profile's entries via {@link OriginDetector}, or
|
|
148
|
+
* specified explicitly.
|
|
149
|
+
*/
|
|
150
|
+
type Origin = SpecificOriginSpec[`id`];
|
|
151
|
+
/**
|
|
152
|
+
* All origin specs in global detection-priority order.
|
|
153
|
+
*
|
|
154
|
+
* Within a format, the detector tries candidates in this order, so origins that
|
|
155
|
+
* share a format and whose marker entries overlap must be ordered carefully
|
|
156
|
+
* (e.g. Deno before Node, since Deno supports `node:` specifiers).
|
|
157
|
+
*/
|
|
158
|
+
declare const originSpecs: ({
|
|
159
|
+
readonly id: "deno";
|
|
160
|
+
readonly formats: ["v8-cpu-profile"];
|
|
161
|
+
readonly isMarkerEntry: ({
|
|
162
|
+
location
|
|
163
|
+
}: {
|
|
164
|
+
readonly id: number;
|
|
165
|
+
readonly name?: string | undefined;
|
|
166
|
+
readonly location?: {
|
|
167
|
+
readonly type: `absolute`;
|
|
168
|
+
readonly url: URL;
|
|
169
|
+
readonly line?: number | undefined;
|
|
170
|
+
readonly column?: number | undefined;
|
|
171
|
+
} | {
|
|
172
|
+
readonly type: `relative`;
|
|
173
|
+
readonly path: string;
|
|
174
|
+
readonly line?: number | undefined;
|
|
175
|
+
readonly column?: number | undefined;
|
|
176
|
+
} | undefined;
|
|
177
|
+
}) => boolean;
|
|
178
|
+
readonly categorizeEntry: (entry: {
|
|
179
|
+
readonly id: number;
|
|
180
|
+
readonly name?: string | undefined;
|
|
181
|
+
readonly location?: {
|
|
182
|
+
readonly type: `absolute`;
|
|
183
|
+
readonly url: URL;
|
|
184
|
+
readonly line?: number | undefined;
|
|
185
|
+
readonly column?: number | undefined;
|
|
186
|
+
} | {
|
|
187
|
+
readonly type: `relative`;
|
|
188
|
+
readonly path: string;
|
|
189
|
+
readonly line?: number | undefined;
|
|
190
|
+
readonly column?: number | undefined;
|
|
191
|
+
} | undefined;
|
|
192
|
+
}) => EntryCategory;
|
|
193
|
+
} | {
|
|
194
|
+
readonly id: "bun";
|
|
195
|
+
readonly formats: ["v8-cpu-profile"];
|
|
196
|
+
readonly isMarkerEntry: ({
|
|
197
|
+
name,
|
|
198
|
+
location
|
|
199
|
+
}: {
|
|
200
|
+
readonly id: number;
|
|
201
|
+
readonly name?: string | undefined;
|
|
202
|
+
readonly location?: {
|
|
203
|
+
readonly type: `absolute`;
|
|
204
|
+
readonly url: URL;
|
|
205
|
+
readonly line?: number | undefined;
|
|
206
|
+
readonly column?: number | undefined;
|
|
207
|
+
} | {
|
|
208
|
+
readonly type: `relative`;
|
|
209
|
+
readonly path: string;
|
|
210
|
+
readonly line?: number | undefined;
|
|
211
|
+
readonly column?: number | undefined;
|
|
212
|
+
} | undefined;
|
|
213
|
+
}) => boolean;
|
|
214
|
+
readonly categorizeEntry: (entry: {
|
|
215
|
+
readonly id: number;
|
|
216
|
+
readonly name?: string | undefined;
|
|
217
|
+
readonly location?: {
|
|
218
|
+
readonly type: `absolute`;
|
|
219
|
+
readonly url: URL;
|
|
220
|
+
readonly line?: number | undefined;
|
|
221
|
+
readonly column?: number | undefined;
|
|
222
|
+
} | {
|
|
223
|
+
readonly type: `relative`;
|
|
224
|
+
readonly path: string;
|
|
225
|
+
readonly line?: number | undefined;
|
|
226
|
+
readonly column?: number | undefined;
|
|
227
|
+
} | undefined;
|
|
228
|
+
}) => EntryCategory;
|
|
229
|
+
} | {
|
|
230
|
+
readonly id: "node";
|
|
231
|
+
readonly formats: ["v8-cpu-profile", "v8-heap-snapshot", "v8-heap-profile"];
|
|
232
|
+
readonly isMarkerEntry: ({
|
|
233
|
+
location
|
|
234
|
+
}: {
|
|
235
|
+
readonly id: number;
|
|
236
|
+
readonly name?: string | undefined;
|
|
237
|
+
readonly location?: {
|
|
238
|
+
readonly type: `absolute`;
|
|
239
|
+
readonly url: URL;
|
|
240
|
+
readonly line?: number | undefined;
|
|
241
|
+
readonly column?: number | undefined;
|
|
242
|
+
} | {
|
|
243
|
+
readonly type: `relative`;
|
|
244
|
+
readonly path: string;
|
|
245
|
+
readonly line?: number | undefined;
|
|
246
|
+
readonly column?: number | undefined;
|
|
247
|
+
} | undefined;
|
|
248
|
+
}) => boolean;
|
|
249
|
+
readonly categorizeEntry: (entry: {
|
|
250
|
+
readonly id: number;
|
|
251
|
+
readonly name?: string | undefined;
|
|
252
|
+
readonly location?: {
|
|
253
|
+
readonly type: `absolute`;
|
|
254
|
+
readonly url: URL;
|
|
255
|
+
readonly line?: number | undefined;
|
|
256
|
+
readonly column?: number | undefined;
|
|
257
|
+
} | {
|
|
258
|
+
readonly type: `relative`;
|
|
259
|
+
readonly path: string;
|
|
260
|
+
readonly line?: number | undefined;
|
|
261
|
+
readonly column?: number | undefined;
|
|
262
|
+
} | undefined;
|
|
263
|
+
}) => EntryCategory;
|
|
264
|
+
} | {
|
|
265
|
+
readonly id: "node-pprof";
|
|
266
|
+
readonly formats: ["pprof"];
|
|
267
|
+
readonly isMarkerEntry: ({
|
|
268
|
+
name,
|
|
269
|
+
location
|
|
270
|
+
}: {
|
|
271
|
+
readonly id: number;
|
|
272
|
+
readonly name?: string | undefined;
|
|
273
|
+
readonly location?: {
|
|
274
|
+
readonly type: `absolute`;
|
|
275
|
+
readonly url: URL;
|
|
276
|
+
readonly line?: number | undefined;
|
|
277
|
+
readonly column?: number | undefined;
|
|
278
|
+
} | {
|
|
279
|
+
readonly type: `relative`;
|
|
280
|
+
readonly path: string;
|
|
281
|
+
readonly line?: number | undefined;
|
|
282
|
+
readonly column?: number | undefined;
|
|
283
|
+
} | undefined;
|
|
284
|
+
}) => boolean;
|
|
285
|
+
readonly categorizeEntry: (entry: {
|
|
286
|
+
readonly id: number;
|
|
287
|
+
readonly name?: string | undefined;
|
|
288
|
+
readonly location?: {
|
|
289
|
+
readonly type: `absolute`;
|
|
290
|
+
readonly url: URL;
|
|
291
|
+
readonly line?: number | undefined;
|
|
292
|
+
readonly column?: number | undefined;
|
|
293
|
+
} | {
|
|
294
|
+
readonly type: `relative`;
|
|
295
|
+
readonly path: string;
|
|
296
|
+
readonly line?: number | undefined;
|
|
297
|
+
readonly column?: number | undefined;
|
|
298
|
+
} | undefined;
|
|
299
|
+
}) => EntryCategory;
|
|
300
|
+
readonly normalizeFrame: (input: ProfileStackFrame) => ProfileStackFrame;
|
|
301
|
+
} | {
|
|
302
|
+
readonly id: "pprof-rs";
|
|
303
|
+
readonly formats: ["pprof"];
|
|
304
|
+
readonly isMarkerEntry: (entry: {
|
|
305
|
+
readonly id: number;
|
|
306
|
+
readonly name?: string | undefined;
|
|
307
|
+
readonly location?: {
|
|
308
|
+
readonly type: `absolute`;
|
|
309
|
+
readonly url: URL;
|
|
310
|
+
readonly line?: number | undefined;
|
|
311
|
+
readonly column?: number | undefined;
|
|
312
|
+
} | {
|
|
313
|
+
readonly type: `relative`;
|
|
314
|
+
readonly path: string;
|
|
315
|
+
readonly line?: number | undefined;
|
|
316
|
+
readonly column?: number | undefined;
|
|
317
|
+
} | undefined;
|
|
318
|
+
}) => boolean;
|
|
319
|
+
readonly categorizeEntry: (entry: {
|
|
320
|
+
readonly id: number;
|
|
321
|
+
readonly name?: string | undefined;
|
|
322
|
+
readonly location?: {
|
|
323
|
+
readonly type: `absolute`;
|
|
324
|
+
readonly url: URL;
|
|
325
|
+
readonly line?: number | undefined;
|
|
326
|
+
readonly column?: number | undefined;
|
|
327
|
+
} | {
|
|
328
|
+
readonly type: `relative`;
|
|
329
|
+
readonly path: string;
|
|
330
|
+
readonly line?: number | undefined;
|
|
331
|
+
readonly column?: number | undefined;
|
|
332
|
+
} | undefined;
|
|
333
|
+
}) => EntryCategory;
|
|
334
|
+
readonly matchEntry: (entry: DeepReadonly<ProfileEntry>) => EntryMatch | undefined;
|
|
335
|
+
} | {
|
|
336
|
+
readonly id: "go";
|
|
337
|
+
readonly formats: ["pprof"];
|
|
338
|
+
readonly isMarkerEntry: (entry: {
|
|
339
|
+
readonly id: number;
|
|
340
|
+
readonly name?: string | undefined;
|
|
341
|
+
readonly location?: {
|
|
342
|
+
readonly type: `absolute`;
|
|
343
|
+
readonly url: URL;
|
|
344
|
+
readonly line?: number | undefined;
|
|
345
|
+
readonly column?: number | undefined;
|
|
346
|
+
} | {
|
|
347
|
+
readonly type: `relative`;
|
|
348
|
+
readonly path: string;
|
|
349
|
+
readonly line?: number | undefined;
|
|
350
|
+
readonly column?: number | undefined;
|
|
351
|
+
} | undefined;
|
|
352
|
+
}) => boolean;
|
|
353
|
+
readonly categorizeEntry: (entry: {
|
|
354
|
+
readonly id: number;
|
|
355
|
+
readonly name?: string | undefined;
|
|
356
|
+
readonly location?: {
|
|
357
|
+
readonly type: `absolute`;
|
|
358
|
+
readonly url: URL;
|
|
359
|
+
readonly line?: number | undefined;
|
|
360
|
+
readonly column?: number | undefined;
|
|
361
|
+
} | {
|
|
362
|
+
readonly type: `relative`;
|
|
363
|
+
readonly path: string;
|
|
364
|
+
readonly line?: number | undefined;
|
|
365
|
+
readonly column?: number | undefined;
|
|
366
|
+
} | undefined;
|
|
367
|
+
}) => EntryCategory;
|
|
368
|
+
} | {
|
|
369
|
+
readonly id: "pprof-jl";
|
|
370
|
+
readonly formats: ["pprof"];
|
|
371
|
+
readonly isMarkerEntry: (entry: {
|
|
372
|
+
readonly id: number;
|
|
373
|
+
readonly name?: string | undefined;
|
|
374
|
+
readonly location?: {
|
|
375
|
+
readonly type: `absolute`;
|
|
376
|
+
readonly url: URL;
|
|
377
|
+
readonly line?: number | undefined;
|
|
378
|
+
readonly column?: number | undefined;
|
|
379
|
+
} | {
|
|
380
|
+
readonly type: `relative`;
|
|
381
|
+
readonly path: string;
|
|
382
|
+
readonly line?: number | undefined;
|
|
383
|
+
readonly column?: number | undefined;
|
|
384
|
+
} | undefined;
|
|
385
|
+
}) => boolean;
|
|
386
|
+
readonly categorizeEntry: (entry: {
|
|
387
|
+
readonly id: number;
|
|
388
|
+
readonly name?: string | undefined;
|
|
389
|
+
readonly location?: {
|
|
390
|
+
readonly type: `absolute`;
|
|
391
|
+
readonly url: URL;
|
|
392
|
+
readonly line?: number | undefined;
|
|
393
|
+
readonly column?: number | undefined;
|
|
394
|
+
} | {
|
|
395
|
+
readonly type: `relative`;
|
|
396
|
+
readonly path: string;
|
|
397
|
+
readonly line?: number | undefined;
|
|
398
|
+
readonly column?: number | undefined;
|
|
399
|
+
} | undefined;
|
|
400
|
+
}) => EntryCategory;
|
|
401
|
+
readonly normalizeFrame: (input: ProfileStackFrame) => ProfileStackFrame | null;
|
|
402
|
+
} | {
|
|
403
|
+
readonly id: "py-spy";
|
|
404
|
+
readonly formats: ["collapsed", "speedscope"];
|
|
405
|
+
readonly isMarkerEntry: (entry: {
|
|
406
|
+
readonly id: number;
|
|
407
|
+
readonly name?: string | undefined;
|
|
408
|
+
readonly location?: {
|
|
409
|
+
readonly type: `absolute`;
|
|
410
|
+
readonly url: URL;
|
|
411
|
+
readonly line?: number | undefined;
|
|
412
|
+
readonly column?: number | undefined;
|
|
413
|
+
} | {
|
|
414
|
+
readonly type: `relative`;
|
|
415
|
+
readonly path: string;
|
|
416
|
+
readonly line?: number | undefined;
|
|
417
|
+
readonly column?: number | undefined;
|
|
418
|
+
} | undefined;
|
|
419
|
+
}) => boolean;
|
|
420
|
+
readonly categorizeEntry: (entry: DeepReadonly<ProfileEntry>) => EntryCategory;
|
|
421
|
+
readonly normalizeFrame: (input: ProfileStackFrame, format: "collapsed" | "jfr" | "pprof" | "systing" | "jsc-heap-snapshot" | "speedscope" | "v8-cpu-profile" | "v8-heap-profile" | "v8-heap-snapshot" | "webkit-timeline-recording") => ProfileStackFrame;
|
|
422
|
+
} | {
|
|
423
|
+
readonly id: "tachyon";
|
|
424
|
+
readonly formats: ["collapsed"];
|
|
425
|
+
readonly isMarkerEntry: (entry: {
|
|
426
|
+
readonly id: number;
|
|
427
|
+
readonly name?: string | undefined;
|
|
428
|
+
readonly location?: {
|
|
429
|
+
readonly type: `absolute`;
|
|
430
|
+
readonly url: URL;
|
|
431
|
+
readonly line?: number | undefined;
|
|
432
|
+
readonly column?: number | undefined;
|
|
433
|
+
} | {
|
|
434
|
+
readonly type: `relative`;
|
|
435
|
+
readonly path: string;
|
|
436
|
+
readonly line?: number | undefined;
|
|
437
|
+
readonly column?: number | undefined;
|
|
438
|
+
} | undefined;
|
|
439
|
+
}) => boolean;
|
|
440
|
+
readonly categorizeEntry: (entry: DeepReadonly<ProfileEntry>) => EntryCategory;
|
|
441
|
+
readonly normalizeFrame: (input: ProfileStackFrame) => ProfileStackFrame;
|
|
442
|
+
} | {
|
|
443
|
+
readonly id: "jvm";
|
|
444
|
+
readonly formats: ["jfr", "collapsed"];
|
|
445
|
+
readonly isMarkerEntry: (entry: {
|
|
446
|
+
readonly id: number;
|
|
447
|
+
readonly name?: string | undefined;
|
|
448
|
+
readonly location?: {
|
|
449
|
+
readonly type: `absolute`;
|
|
450
|
+
readonly url: URL;
|
|
451
|
+
readonly line?: number | undefined;
|
|
452
|
+
readonly column?: number | undefined;
|
|
453
|
+
} | {
|
|
454
|
+
readonly type: `relative`;
|
|
455
|
+
readonly path: string;
|
|
456
|
+
readonly line?: number | undefined;
|
|
457
|
+
readonly column?: number | undefined;
|
|
458
|
+
} | undefined;
|
|
459
|
+
}) => boolean;
|
|
460
|
+
readonly categorizeEntry: (entry: {
|
|
461
|
+
readonly id: number;
|
|
462
|
+
readonly name?: string | undefined;
|
|
463
|
+
readonly location?: {
|
|
464
|
+
readonly type: `absolute`;
|
|
465
|
+
readonly url: URL;
|
|
466
|
+
readonly line?: number | undefined;
|
|
467
|
+
readonly column?: number | undefined;
|
|
468
|
+
} | {
|
|
469
|
+
readonly type: `relative`;
|
|
470
|
+
readonly path: string;
|
|
471
|
+
readonly line?: number | undefined;
|
|
472
|
+
readonly column?: number | undefined;
|
|
473
|
+
} | undefined;
|
|
474
|
+
}) => EntryCategory;
|
|
475
|
+
readonly matchEntry: (entry: DeepReadonly<ProfileEntry>) => EntryMatch | undefined;
|
|
476
|
+
readonly normalizeFrame: (input: ProfileStackFrame) => ProfileStackFrame;
|
|
477
|
+
} | {
|
|
478
|
+
readonly id: "dotnet-trace";
|
|
479
|
+
readonly formats: ["speedscope"];
|
|
480
|
+
readonly isMarkerEntry: (entry: {
|
|
481
|
+
readonly id: number;
|
|
482
|
+
readonly name?: string | undefined;
|
|
483
|
+
readonly location?: {
|
|
484
|
+
readonly type: `absolute`;
|
|
485
|
+
readonly url: URL;
|
|
486
|
+
readonly line?: number | undefined;
|
|
487
|
+
readonly column?: number | undefined;
|
|
488
|
+
} | {
|
|
489
|
+
readonly type: `relative`;
|
|
490
|
+
readonly path: string;
|
|
491
|
+
readonly line?: number | undefined;
|
|
492
|
+
readonly column?: number | undefined;
|
|
493
|
+
} | undefined;
|
|
494
|
+
}) => boolean;
|
|
495
|
+
readonly categorizeEntry: (entry: {
|
|
496
|
+
readonly id: number;
|
|
497
|
+
readonly name?: string | undefined;
|
|
498
|
+
readonly location?: {
|
|
499
|
+
readonly type: `absolute`;
|
|
500
|
+
readonly url: URL;
|
|
501
|
+
readonly line?: number | undefined;
|
|
502
|
+
readonly column?: number | undefined;
|
|
503
|
+
} | {
|
|
504
|
+
readonly type: `relative`;
|
|
505
|
+
readonly path: string;
|
|
506
|
+
readonly line?: number | undefined;
|
|
507
|
+
readonly column?: number | undefined;
|
|
508
|
+
} | undefined;
|
|
509
|
+
}) => EntryCategory;
|
|
510
|
+
readonly normalizeFrame: (input: ProfileStackFrame) => ProfileStackFrame | null;
|
|
511
|
+
} | {
|
|
512
|
+
readonly id: "beam";
|
|
513
|
+
readonly formats: ["collapsed"];
|
|
514
|
+
readonly isMarkerEntry: (entry: {
|
|
515
|
+
readonly id: number;
|
|
516
|
+
readonly name?: string | undefined;
|
|
517
|
+
readonly location?: {
|
|
518
|
+
readonly type: `absolute`;
|
|
519
|
+
readonly url: URL;
|
|
520
|
+
readonly line?: number | undefined;
|
|
521
|
+
readonly column?: number | undefined;
|
|
522
|
+
} | {
|
|
523
|
+
readonly type: `relative`;
|
|
524
|
+
readonly path: string;
|
|
525
|
+
readonly line?: number | undefined;
|
|
526
|
+
readonly column?: number | undefined;
|
|
527
|
+
} | undefined;
|
|
528
|
+
}) => boolean;
|
|
529
|
+
readonly categorizeEntry: (entry: {
|
|
530
|
+
readonly id: number;
|
|
531
|
+
readonly name?: string | undefined;
|
|
532
|
+
readonly location?: {
|
|
533
|
+
readonly type: `absolute`;
|
|
534
|
+
readonly url: URL;
|
|
535
|
+
readonly line?: number | undefined;
|
|
536
|
+
readonly column?: number | undefined;
|
|
537
|
+
} | {
|
|
538
|
+
readonly type: `relative`;
|
|
539
|
+
readonly path: string;
|
|
540
|
+
readonly line?: number | undefined;
|
|
541
|
+
readonly column?: number | undefined;
|
|
542
|
+
} | undefined;
|
|
543
|
+
}) => EntryCategory;
|
|
544
|
+
readonly normalizeFrame: (input: ProfileStackFrame) => ProfileStackFrame;
|
|
545
|
+
} | {
|
|
546
|
+
readonly id: "rbspy";
|
|
547
|
+
readonly formats: ["collapsed", "pprof", "speedscope"];
|
|
548
|
+
readonly isMarkerEntry: (entry: {
|
|
549
|
+
readonly id: number;
|
|
550
|
+
readonly name?: string | undefined;
|
|
551
|
+
readonly location?: {
|
|
552
|
+
readonly type: `absolute`;
|
|
553
|
+
readonly url: URL;
|
|
554
|
+
readonly line?: number | undefined;
|
|
555
|
+
readonly column?: number | undefined;
|
|
556
|
+
} | {
|
|
557
|
+
readonly type: `relative`;
|
|
558
|
+
readonly path: string;
|
|
559
|
+
readonly line?: number | undefined;
|
|
560
|
+
readonly column?: number | undefined;
|
|
561
|
+
} | undefined;
|
|
562
|
+
}) => boolean;
|
|
563
|
+
readonly categorizeEntry: (entry: {
|
|
564
|
+
readonly id: number;
|
|
565
|
+
readonly name?: string | undefined;
|
|
566
|
+
readonly location?: {
|
|
567
|
+
readonly type: `absolute`;
|
|
568
|
+
readonly url: URL;
|
|
569
|
+
readonly line?: number | undefined;
|
|
570
|
+
readonly column?: number | undefined;
|
|
571
|
+
} | {
|
|
572
|
+
readonly type: `relative`;
|
|
573
|
+
readonly path: string;
|
|
574
|
+
readonly line?: number | undefined;
|
|
575
|
+
readonly column?: number | undefined;
|
|
576
|
+
} | undefined;
|
|
577
|
+
}) => EntryCategory;
|
|
578
|
+
readonly normalizeFrame: (input: ProfileStackFrame, format: "collapsed" | "jfr" | "pprof" | "systing" | "jsc-heap-snapshot" | "speedscope" | "v8-cpu-profile" | "v8-heap-profile" | "v8-heap-snapshot" | "webkit-timeline-recording") => ProfileStackFrame;
|
|
579
|
+
} | {
|
|
580
|
+
readonly id: "safari";
|
|
581
|
+
readonly formats: ["jsc-heap-snapshot", "webkit-timeline-recording"];
|
|
582
|
+
readonly isMarkerEntry: ({
|
|
583
|
+
name,
|
|
584
|
+
location
|
|
585
|
+
}: DeepReadonly<ProfileEntry>) => boolean;
|
|
586
|
+
readonly categorizeEntry: (entry: {
|
|
587
|
+
readonly id: number;
|
|
588
|
+
readonly name?: string | undefined;
|
|
589
|
+
readonly location?: {
|
|
590
|
+
readonly type: `absolute`;
|
|
591
|
+
readonly url: URL;
|
|
592
|
+
readonly line?: number | undefined;
|
|
593
|
+
readonly column?: number | undefined;
|
|
594
|
+
} | {
|
|
595
|
+
readonly type: `relative`;
|
|
596
|
+
readonly path: string;
|
|
597
|
+
readonly line?: number | undefined;
|
|
598
|
+
readonly column?: number | undefined;
|
|
599
|
+
} | undefined;
|
|
600
|
+
}) => EntryCategory;
|
|
601
|
+
} | {
|
|
602
|
+
readonly id: "systing";
|
|
603
|
+
readonly formats: ["systing"];
|
|
604
|
+
readonly isMarkerEntry: (entry: {
|
|
605
|
+
readonly id: number;
|
|
606
|
+
readonly name?: string | undefined;
|
|
607
|
+
readonly location?: {
|
|
608
|
+
readonly type: `absolute`;
|
|
609
|
+
readonly url: URL;
|
|
610
|
+
readonly line?: number | undefined;
|
|
611
|
+
readonly column?: number | undefined;
|
|
612
|
+
} | {
|
|
613
|
+
readonly type: `relative`;
|
|
614
|
+
readonly path: string;
|
|
615
|
+
readonly line?: number | undefined;
|
|
616
|
+
readonly column?: number | undefined;
|
|
617
|
+
} | undefined;
|
|
618
|
+
}) => boolean;
|
|
619
|
+
readonly categorizeEntry: (entry: {
|
|
620
|
+
readonly id: number;
|
|
621
|
+
readonly name?: string | undefined;
|
|
622
|
+
readonly location?: {
|
|
623
|
+
readonly type: `absolute`;
|
|
624
|
+
readonly url: URL;
|
|
625
|
+
readonly line?: number | undefined;
|
|
626
|
+
readonly column?: number | undefined;
|
|
627
|
+
} | {
|
|
628
|
+
readonly type: `relative`;
|
|
629
|
+
readonly path: string;
|
|
630
|
+
readonly line?: number | undefined;
|
|
631
|
+
readonly column?: number | undefined;
|
|
632
|
+
} | undefined;
|
|
633
|
+
}) => EntryCategory;
|
|
634
|
+
readonly normalizeFrame: (input: ProfileStackFrame) => ProfileStackFrame;
|
|
635
|
+
} | {
|
|
636
|
+
readonly id: "unknown";
|
|
637
|
+
readonly formats: [];
|
|
638
|
+
readonly isMarkerEntry: () => false;
|
|
639
|
+
readonly categorizeEntry: (entry: {
|
|
640
|
+
readonly id: number;
|
|
641
|
+
readonly name?: string | undefined;
|
|
642
|
+
readonly location?: {
|
|
643
|
+
readonly type: `absolute`;
|
|
644
|
+
readonly url: URL;
|
|
645
|
+
readonly line?: number | undefined;
|
|
646
|
+
readonly column?: number | undefined;
|
|
647
|
+
} | {
|
|
648
|
+
readonly type: `relative`;
|
|
649
|
+
readonly path: string;
|
|
650
|
+
readonly line?: number | undefined;
|
|
651
|
+
readonly column?: number | undefined;
|
|
652
|
+
} | undefined;
|
|
653
|
+
}) => EntryCategory;
|
|
654
|
+
})[];
|
|
655
|
+
/** One of the concrete origin specs, with its literal {@link Origin} ID. */
|
|
656
|
+
type SpecificOriginSpec = (typeof originSpecs)[number];
|
|
657
|
+
/** Every supported origin ID. */
|
|
658
|
+
//#endregion
|
|
659
|
+
//#region src/modalities/profile/aggregate.d.ts
|
|
27
660
|
/** An aggregation of samples taken at a given line within a function's body. */
|
|
28
661
|
type AggregatedProfileLineMetrics = {
|
|
29
662
|
/**
|
|
@@ -59,18 +692,24 @@ type AggregatedProfileCallerMetrics = {
|
|
|
59
692
|
* callees, with a given direct callee.
|
|
60
693
|
*/
|
|
61
694
|
type AggregatedProfileCalleeMetrics = {
|
|
62
|
-
/** The callee corresponding to the
|
|
695
|
+
/** The callee corresponding to the ID. */callee: AggregatedProfileFunction;
|
|
63
696
|
/**
|
|
64
|
-
* The number of samples taken directly within the function's, _and_
|
|
65
|
-
* its callees, with this callee.
|
|
697
|
+
* The number of samples taken directly within the function's body, _and_
|
|
698
|
+
* all its callees, with this callee.
|
|
66
699
|
*/
|
|
67
700
|
totalSampleCount: number;
|
|
68
701
|
/**
|
|
69
702
|
* For each metric in {@link AggregatedProfile.metrics}, the sum of values from
|
|
70
703
|
* samples taken directly within the function's body, _and_ all its
|
|
71
|
-
* callees
|
|
704
|
+
* callees, with this callee.
|
|
72
705
|
*/
|
|
73
706
|
totalValues: Float64Array;
|
|
707
|
+
/**
|
|
708
|
+
* Internal aggregation bookkeeping: the epoch of the most recent call stack
|
|
709
|
+
* whose total this frame pair was counted into, so one that recurs within
|
|
710
|
+
* one call stack is counted just once.
|
|
711
|
+
*/
|
|
712
|
+
lastSeenEpoch: number;
|
|
74
713
|
};
|
|
75
714
|
/**
|
|
76
715
|
* An aggregation of data from every sample involving a given function within a
|
|
@@ -80,7 +719,7 @@ type AggregatedProfileFunction = {
|
|
|
80
719
|
type: `function`; /** An index that uniquely identifies this function. */
|
|
81
720
|
id: number; /** The name of the function in code. */
|
|
82
721
|
name: string; /** Where the function was defined, if known. */
|
|
83
|
-
location?: SourceLocation; /**
|
|
722
|
+
location?: SourceLocation; /** The category of functions this function belongs to. */
|
|
84
723
|
category: string;
|
|
85
724
|
/**
|
|
86
725
|
* The number of samples taken directly within the function's body, excluding
|
|
@@ -115,11 +754,129 @@ type AggregatedProfileFunction = {
|
|
|
115
754
|
calleeIdToMetrics: Map<number, AggregatedProfileCalleeMetrics>;
|
|
116
755
|
};
|
|
117
756
|
//#endregion
|
|
118
|
-
//#region src/snapshot/
|
|
757
|
+
//#region src/modalities/snapshot/graph.d.ts
|
|
758
|
+
/**
|
|
759
|
+
* A successor and predecessor graph between heap snapshot nodes in CSR format.
|
|
760
|
+
*
|
|
761
|
+
* @see https://en.wikipedia.org/wiki/Sparse_matrix#Compressed_sparse_row_(CSR,_CRS_or_Yale_format)
|
|
762
|
+
*/
|
|
763
|
+
type NodeAdjacencyGraph = {
|
|
764
|
+
/**
|
|
765
|
+
* Start offset into
|
|
766
|
+
* {@link NodeAdjacencyGraph.offsetToSuccessorOrdinal} and
|
|
767
|
+
* {@link NodeAdjacencyGraph.offsetToSuccessorEdgeIndex} for each
|
|
768
|
+
* node's successors in the graph.
|
|
769
|
+
*
|
|
770
|
+
* Node `i`'s successor ordinals occupy:
|
|
771
|
+
* `[offsetToSuccessorOrdinal[i], offsetToSuccessorOrdinal[i + 1])`.
|
|
772
|
+
*
|
|
773
|
+
* Node `i`'s successor edges occupy:
|
|
774
|
+
* `[offsetToSuccessorEdgeIndex[i], offsetToSuccessorEdgeIndex[i + 1])`.
|
|
775
|
+
*/
|
|
776
|
+
ordinalToSuccessorStartOffset: Int32Array;
|
|
777
|
+
/**
|
|
778
|
+
* Successor ordinals, packed contiguously and indexed via
|
|
779
|
+
* {@link NodeAdjacencyGraph.ordinalToSuccessorStartOffset}.
|
|
780
|
+
*/
|
|
781
|
+
offsetToSuccessorOrdinal: Int32Array;
|
|
782
|
+
/**
|
|
783
|
+
* Successor edge indices, packed contiguously and indexed via
|
|
784
|
+
* {@link NodeAdjacencyGraph.ordinalToSuccessorStartOffset}.
|
|
785
|
+
*/
|
|
786
|
+
offsetToSuccessorEdgeIndex: Int32Array;
|
|
787
|
+
/**
|
|
788
|
+
* Start offset into
|
|
789
|
+
* {@link NodeAdjacencyGraph.offsetToPredecessorOrdinal} and
|
|
790
|
+
* {@link NodeAdjacencyGraph.offsetToPredecessorEdgeIndex} for each
|
|
791
|
+
* node's predecessors in the graph.
|
|
792
|
+
*
|
|
793
|
+
* Node `i`'s predecessor ordinals occupy:
|
|
794
|
+
* `[offsetToPredecessorOrdinal[i], offsetToPredecessorOrdinal[i + 1])`.
|
|
795
|
+
*
|
|
796
|
+
* Node `i`'s predecessor edges occupy:
|
|
797
|
+
* `[offsetToPredecessorEdgeIndex[i], offsetToPredecessorEdgeIndex[i + 1])`.
|
|
798
|
+
*/
|
|
799
|
+
ordinalToPredecessorStartOffset: Int32Array;
|
|
800
|
+
/**
|
|
801
|
+
* Predecessor ordinals, packed contiguously and indexed via
|
|
802
|
+
* {@link NodeAdjacencyGraph.ordinalToPredecessorStartOffset}.
|
|
803
|
+
*/
|
|
804
|
+
offsetToPredecessorOrdinal: Int32Array;
|
|
805
|
+
/**
|
|
806
|
+
* Predecessor edge indices, packed contiguously and indexed via
|
|
807
|
+
* {@link NodeAdjacencyGraph.ordinalToPredecessorStartOffset}.
|
|
808
|
+
*/
|
|
809
|
+
offsetToPredecessorEdgeIndex: Int32Array;
|
|
810
|
+
};
|
|
811
|
+
//#endregion
|
|
812
|
+
//#region src/modalities/snapshot/type.d.ts
|
|
813
|
+
/**
|
|
814
|
+
* A heap snapshot parsed into the uniform structure containing the node
|
|
815
|
+
* adjacency graph and each node's classification.
|
|
816
|
+
*
|
|
817
|
+
* A format that yields several snapshots returns one of these per snapshot.
|
|
818
|
+
*/
|
|
819
|
+
type HeapSnapshot = {
|
|
820
|
+
type: `snapshot`; /** Number of nodes in the snapshot. */
|
|
821
|
+
nodeCount: number; /** Number of edges between nodes in the snapshot. */
|
|
822
|
+
edgeCount: number; /** The successor and predecessor graph between the snapshot's nodes. */
|
|
823
|
+
nodeAdjacencyGraph: NodeAdjacencyGraph; /** Bytes allocated directly for the node. */
|
|
824
|
+
selfSizeOf: (nodeOrdinal: number) => number;
|
|
825
|
+
/**
|
|
826
|
+
* One entry per node ordinal, in ordinal order, as a lazily-consumed
|
|
827
|
+
* iterable.
|
|
828
|
+
*/
|
|
829
|
+
nodes: Iterable<SnapshotNode>;
|
|
830
|
+
/**
|
|
831
|
+
* Formats an edge label, which is computed lazily at formatting time, so it
|
|
832
|
+
* receives the resolved formatting options.
|
|
833
|
+
*/
|
|
834
|
+
formatEdgeLabel: (retainerOrdinal: number, edgeIndex: number, options: FormattingProfileToMdOptions) => string;
|
|
835
|
+
/**
|
|
836
|
+
* Formats a node label, which is computed lazily at formatting time, so it
|
|
837
|
+
* receives the resolved formatting options.
|
|
838
|
+
*/
|
|
839
|
+
formatNodeLabel: (nodeOrdinal: number, options: FormattingProfileToMdOptions) => string; /** Whether the node is a bookkeeping node that never points to user code. */
|
|
840
|
+
isInternalNode: (nodeOrdinal: number) => boolean;
|
|
841
|
+
};
|
|
842
|
+
/**
|
|
843
|
+
* A heap snapshot node's classification.
|
|
844
|
+
*
|
|
845
|
+
* Every node contributes to its {@link SnapshotNode.category}'s stats; a node
|
|
846
|
+
* with a `type` additionally aggregates into that type's entities.
|
|
847
|
+
*/
|
|
848
|
+
type SnapshotNode = {
|
|
849
|
+
category: string;
|
|
850
|
+
} & ({
|
|
851
|
+
type?: undefined;
|
|
852
|
+
} | {
|
|
853
|
+
type: `constructor`; /** A human readable label for this constructor. */
|
|
854
|
+
name: string; /** The exact location where the node was defined. */
|
|
855
|
+
location?: SourceLocation;
|
|
856
|
+
/**
|
|
857
|
+
* The file reference the {@link name} parses as, when it is URL-shaped.
|
|
858
|
+
*/
|
|
859
|
+
nameLocation?: FileReference;
|
|
860
|
+
} | {
|
|
861
|
+
type: `closure`; /** A human readable label for this closure. */
|
|
862
|
+
name: string; /** The exact location where the closure was defined. */
|
|
863
|
+
location?: SourceLocation;
|
|
864
|
+
} | {
|
|
865
|
+
type: `string`; /** The (truncated) string value, if known. */
|
|
866
|
+
name?: string;
|
|
867
|
+
});
|
|
868
|
+
//#endregion
|
|
869
|
+
//#region src/modalities/snapshot/aggregate.d.ts
|
|
119
870
|
type AggregatedSnapshotNode = {
|
|
120
871
|
type: `node`; /** Unique ID for this node that can also be used as an index. */
|
|
121
872
|
id: number; /** A human readable label for this node. */
|
|
122
|
-
name?: string;
|
|
873
|
+
name?: string;
|
|
874
|
+
/**
|
|
875
|
+
* The file reference the {@link name} parses as, when it is URL-shaped
|
|
876
|
+
* (e.g. a V8 module namespace object named by its file URL). Formatting
|
|
877
|
+
* shows it relative to the base URL in place of the raw name.
|
|
878
|
+
*/
|
|
879
|
+
nameLocation?: FileReference; /** Bytes allocated directly for this node. */
|
|
123
880
|
selfSize: number;
|
|
124
881
|
/**
|
|
125
882
|
* Bytes allocated for this node, as well as all nodes that would be freed if
|
|
@@ -129,23 +886,31 @@ type AggregatedSnapshotNode = {
|
|
|
129
886
|
location?: SourceLocation;
|
|
130
887
|
};
|
|
131
888
|
//#endregion
|
|
889
|
+
//#region src/source-map.d.ts
|
|
890
|
+
type NormalizedSourceMap = {
|
|
891
|
+
consumer: SourceMapConsumer;
|
|
892
|
+
fileReference: FileReference;
|
|
893
|
+
};
|
|
894
|
+
type NormalizedSourceMaps = NormalizedSourceMap[];
|
|
895
|
+
//#endregion
|
|
132
896
|
//#region src/options.d.ts
|
|
133
897
|
/** Profile data that can be synchronously parsed and converted to Markdown. */
|
|
134
898
|
type ProfileData = string | Uint8Array | Iterable<Uint8Array>;
|
|
135
899
|
/** Profile data that can be asynchronously parsed and converted to Markdown. */
|
|
136
900
|
type AsyncProfileData = Blob | ReadableStream<Uint8Array>;
|
|
137
901
|
/**
|
|
138
|
-
* Profile data with
|
|
902
|
+
* Profile data with an optional explicit format and origin.
|
|
139
903
|
*
|
|
140
|
-
* The format
|
|
904
|
+
* The format and origin are auto-detected if not specified.
|
|
141
905
|
*/
|
|
142
906
|
type ProfileInput<Data> = Data | {
|
|
143
907
|
data: Data;
|
|
144
|
-
format
|
|
908
|
+
format?: Format;
|
|
909
|
+
origin?: Origin;
|
|
145
910
|
};
|
|
146
911
|
/** The category of code an entry originated from. */
|
|
147
|
-
type
|
|
148
|
-
/** A single entry in a
|
|
912
|
+
type EntryCategory = `ours` | `native` | `stdlib` | `third-party` | (string & {});
|
|
913
|
+
/** A single entry in a formatted profile. */
|
|
149
914
|
type ProfileEntry = {
|
|
150
915
|
/** An index that uniquely identifies this entry. */id: number;
|
|
151
916
|
/**
|
|
@@ -155,7 +920,7 @@ type ProfileEntry = {
|
|
|
155
920
|
name?: string;
|
|
156
921
|
/**
|
|
157
922
|
* The location where the entity corresponding to this entry was defined, or
|
|
158
|
-
* undefined if
|
|
923
|
+
* undefined if unknown.
|
|
159
924
|
*/
|
|
160
925
|
location?: SourceLocation;
|
|
161
926
|
};
|
|
@@ -165,7 +930,7 @@ type ProfileEntry = {
|
|
|
165
930
|
* Only affects matching; the entry's displayed name and location are
|
|
166
931
|
* unchanged.
|
|
167
932
|
*/
|
|
168
|
-
type
|
|
933
|
+
type EntryMatch = {
|
|
169
934
|
/** The name to match by. Omit to match by the entry's name. */name?: string;
|
|
170
935
|
/**
|
|
171
936
|
* The location to match by, as a URL or file path string. Omit to match by
|
|
@@ -173,15 +938,19 @@ type NormalizedEntry = {
|
|
|
173
938
|
*/
|
|
174
939
|
location?: string;
|
|
175
940
|
};
|
|
176
|
-
/**
|
|
941
|
+
/** An aggregated entry in a formatted profile. */
|
|
177
942
|
type AggregatedProfileEntry = AggregatedProfileFunction | AggregatedSnapshotNode;
|
|
943
|
+
/** The context in which a profile is being converted to Markdown. */
|
|
944
|
+
type ProfileToMdContext = {
|
|
945
|
+
/** The format of the profile being converted. */format: Format; /** The origin of the profile being converted. */
|
|
946
|
+
origin: Origin;
|
|
947
|
+
};
|
|
178
948
|
/** Options for profile to Markdown converters. */
|
|
179
949
|
type ProfileToMdOptions = {
|
|
180
950
|
/**
|
|
181
951
|
* The number of entries to display when computing the "top N" by some metric.
|
|
182
952
|
*
|
|
183
|
-
* This value
|
|
184
|
-
* by a constant.
|
|
953
|
+
* This value, divided by a constant, also limits subsection entry count.
|
|
185
954
|
*
|
|
186
955
|
* Defaults to 20.
|
|
187
956
|
*/
|
|
@@ -192,14 +961,19 @@ type ProfileToMdOptions = {
|
|
|
192
961
|
* Accepts an absolute file path string or URL. File paths are converted to
|
|
193
962
|
* `file://` URLs internally.
|
|
194
963
|
*
|
|
195
|
-
* A value of `
|
|
964
|
+
* A value of `'auto'` infers the base URL as the common ancestor directory
|
|
965
|
+
* of the input's `ours`-categorized entries with absolute `file:` locations,
|
|
966
|
+
* across all profiles of an input and across both sides of a diff. Falls back
|
|
967
|
+
* to absolute paths when no entry qualifies.
|
|
968
|
+
*
|
|
969
|
+
* A value of `null` leaves URLs absolute.
|
|
196
970
|
*
|
|
197
971
|
* Defaults to `process.cwd()` when available. Otherwise leaves paths
|
|
198
972
|
* absolute.
|
|
199
973
|
*/
|
|
200
|
-
baseURL?: string | URL | null;
|
|
974
|
+
baseURL?: `auto` | (string & {}) | URL | null;
|
|
201
975
|
/**
|
|
202
|
-
* Source maps to apply when
|
|
976
|
+
* Source maps to apply when formatting source locations.
|
|
203
977
|
*
|
|
204
978
|
* Accepts either a list of raw source map objects, or a record mapping
|
|
205
979
|
* generated file URLs or absolute/relative paths to raw source map objects.
|
|
@@ -214,81 +988,222 @@ type ProfileToMdOptions = {
|
|
|
214
988
|
* location.
|
|
215
989
|
*
|
|
216
990
|
* Only affects which entries are considered the same entity when diffing
|
|
217
|
-
* (profile functions
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
* location
|
|
991
|
+
* (e.g. profile functions); displayed names and locations, categorization,
|
|
992
|
+
* and source map resolution always use the entry's real name and location.
|
|
993
|
+
*
|
|
994
|
+
* Matched entries display the _current_ profile's name and location (not
|
|
995
|
+
* _base_).
|
|
221
996
|
*
|
|
222
|
-
* Defaults to {@link defaultMatchEntry}
|
|
223
|
-
* locations so that the same function matches across profiles built from the
|
|
224
|
-
* same source.
|
|
997
|
+
* Defaults to {@link defaultMatchEntry}.
|
|
225
998
|
*/
|
|
226
|
-
matchEntry?: (entry: DeepReadonly<ProfileEntry
|
|
999
|
+
matchEntry?: (entry: DeepReadonly<ProfileEntry>, context: ProfileToMdContext) => EntryMatch | undefined;
|
|
227
1000
|
/**
|
|
228
|
-
* Returns
|
|
1001
|
+
* Returns a category string per entry of a profile, as an array aligned with
|
|
1002
|
+
* {@link entries} (index `i` categorizes entry `i`).
|
|
229
1003
|
*
|
|
230
|
-
* Used to compute
|
|
1004
|
+
* Used to compute:
|
|
1005
|
+
* - A category breakdown in the Markdown output
|
|
1006
|
+
* - The `baseURL` when using `baseURL: 'auto'`
|
|
1007
|
+
* - Which entries to show in {@link defaultShowEntry}
|
|
1008
|
+
*
|
|
1009
|
+
* Called once per profile with all its {@link entries}. Receiving every entry
|
|
1010
|
+
* up front lets the categorizer decide from the full set rather than per
|
|
1011
|
+
* entry in isolation.
|
|
1012
|
+
*
|
|
1013
|
+
* Defaults to {@link defaultCategorizeEntries}.
|
|
231
1014
|
*/
|
|
232
|
-
|
|
1015
|
+
categorizeEntries?: (entries: readonly DeepReadonly<ProfileEntry>[], context: ProfileToMdContext) => readonly EntryCategory[];
|
|
233
1016
|
/**
|
|
234
1017
|
* Whether to include the given entry in the Markdown output.
|
|
235
1018
|
*
|
|
236
|
-
*
|
|
1019
|
+
* Hidden entries still count in metric computations.
|
|
1020
|
+
*
|
|
1021
|
+
* Defaults to {@link defaultShowEntry}.
|
|
237
1022
|
*/
|
|
238
1023
|
showEntry?: (entry: DeepReadonly<AggregatedProfileEntry>) => boolean;
|
|
239
1024
|
};
|
|
1025
|
+
/** {@link ProfileToMdOptions} with defaults applied. */
|
|
1026
|
+
type NormalizedProfileToMdOptions = {
|
|
1027
|
+
topN: number;
|
|
1028
|
+
baseURL: URL | `auto` | undefined;
|
|
1029
|
+
sourceMaps: NormalizedSourceMaps;
|
|
1030
|
+
entryMatchKey: (entry: ProfileEntry, context: ProfileToMdContext) => string;
|
|
1031
|
+
categorizeEntries: (entries: readonly ProfileEntry[], context: ProfileToMdContext) => readonly EntryCategory[];
|
|
1032
|
+
showEntry: (entry: DeepReadonly<AggregatedProfileEntry>) => boolean;
|
|
1033
|
+
};
|
|
1034
|
+
/**
|
|
1035
|
+
* The options aggregation code receives.
|
|
1036
|
+
*
|
|
1037
|
+
* Everything except `baseURL`, which only affects formatting and, for `'auto'`,
|
|
1038
|
+
* is resolvable only after aggregation (from the aggregated entries). The
|
|
1039
|
+
* omission keeps aggregation logic from depending on it.
|
|
1040
|
+
*/
|
|
1041
|
+
type AggregationProfileToMdOptions = Omit<NormalizedProfileToMdOptions, `baseURL`>;
|
|
1042
|
+
/**
|
|
1043
|
+
* The options formatting code receives.
|
|
1044
|
+
*
|
|
1045
|
+
* {@link NormalizedProfileToMdOptions} with `'auto'` resolved to a concrete
|
|
1046
|
+
* base URL (or `undefined` when nothing qualified for inference).
|
|
1047
|
+
*/
|
|
1048
|
+
type FormattingProfileToMdOptions = AggregationProfileToMdOptions & {
|
|
1049
|
+
baseURL: URL | undefined;
|
|
1050
|
+
};
|
|
240
1051
|
/**
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
* the
|
|
1052
|
+
* The default {@link ProfileToMdOptions.matchEntry}.
|
|
1053
|
+
*
|
|
1054
|
+
* Applies the origin's match normalization to the entry, stripping the origin's
|
|
1055
|
+
* known run-varying identifiers (e.g. Rust build hashes for `pprof-rs`, JVM
|
|
1056
|
+
* runtime addresses for `jvm`), or `undefined` if the entry contains none.
|
|
244
1057
|
*/
|
|
245
|
-
declare const defaultMatchEntry: (entry: DeepReadonly<ProfileEntry
|
|
1058
|
+
declare const defaultMatchEntry: (entry: DeepReadonly<ProfileEntry>, {
|
|
1059
|
+
origin
|
|
1060
|
+
}: ProfileToMdContext) => EntryMatch | undefined;
|
|
246
1061
|
/**
|
|
247
|
-
*
|
|
1062
|
+
* The default {@link ProfileToMdOptions.categorizeEntries}.
|
|
248
1063
|
*
|
|
249
|
-
*
|
|
250
|
-
* by default.
|
|
1064
|
+
* Applies the library's origin-aware categorization to each entry.
|
|
251
1065
|
*/
|
|
252
|
-
declare const
|
|
1066
|
+
declare const defaultCategorizeEntries: (entries: readonly DeepReadonly<ProfileEntry>[], {
|
|
1067
|
+
origin
|
|
1068
|
+
}: ProfileToMdContext) => EntryCategory[];
|
|
253
1069
|
/**
|
|
254
1070
|
* Returns whether to include the given entry in the Markdown output.
|
|
255
1071
|
*
|
|
256
|
-
* Excludes synthetic and external
|
|
1072
|
+
* Excludes synthetic and external implementation detail entries.
|
|
257
1073
|
*/
|
|
258
1074
|
declare const defaultShowEntry: (entry: DeepReadonly<AggregatedProfileEntry>) => boolean;
|
|
259
1075
|
/**
|
|
260
|
-
* Returns true if the entry is
|
|
1076
|
+
* Returns true if the entry is synthetic.
|
|
261
1077
|
*
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
* synthetic `(root)` node is typically created for heap snapshots.
|
|
1078
|
+
* The profiler invents these entries; they correspond to nothing that exists
|
|
1079
|
+
* in code or at runtime (e.g. a synthetic `(root)` node for heap snapshots).
|
|
265
1080
|
*/
|
|
266
1081
|
declare const isSyntheticEntry: ({
|
|
267
1082
|
name
|
|
268
1083
|
}: DeepReadonly<AggregatedProfileEntry>) => boolean;
|
|
269
1084
|
/**
|
|
270
|
-
* Returns true if the entry corresponds to an external function (`
|
|
271
|
-
* `third-party`) that's never directly called by `ours` code.
|
|
1085
|
+
* Returns true if the entry corresponds to an external function (`native`,
|
|
1086
|
+
* `stdlib`, or `third-party`) that's never directly called by `ours` code.
|
|
272
1087
|
*
|
|
273
|
-
* These entries are typically implementation details of external code
|
|
274
|
-
*
|
|
275
|
-
*
|
|
276
|
-
* `third-party` code.
|
|
1088
|
+
* These entries are typically implementation details of external code.
|
|
1089
|
+
* Excluding them from the Markdown leaves only your code and the public API
|
|
1090
|
+
* of `stdlib` and `third-party` code.
|
|
277
1091
|
*/
|
|
278
1092
|
declare const isExternalImplementationDetailEntry: (entry: DeepReadonly<AggregatedProfileEntry>) => boolean;
|
|
279
1093
|
//#endregion
|
|
1094
|
+
//#region src/formats/registry.d.ts
|
|
1095
|
+
/** Every supported format's converter, keyed by format ID. */
|
|
1096
|
+
declare const formatConverters: {
|
|
1097
|
+
readonly collapsed: {
|
|
1098
|
+
readonly title: "Collapsed stacks";
|
|
1099
|
+
readonly extension: "collapsed";
|
|
1100
|
+
readonly languages: readonly ["elixir", "java", "python", "ruby"];
|
|
1101
|
+
readonly fallbackOrigin: "unknown";
|
|
1102
|
+
readonly type: "binary";
|
|
1103
|
+
readonly matches: (bytes: Uint8Array) => boolean;
|
|
1104
|
+
readonly parse: (bytes: Uint8Array) => Profile[];
|
|
1105
|
+
readonly parseAsync: (stream: ReadableStream<Uint8Array>) => Promise<Profile[]>;
|
|
1106
|
+
};
|
|
1107
|
+
readonly jfr: {
|
|
1108
|
+
readonly title: "JFR";
|
|
1109
|
+
readonly extension: "jfr";
|
|
1110
|
+
readonly languages: readonly ["java"];
|
|
1111
|
+
readonly fallbackOrigin: "jvm";
|
|
1112
|
+
readonly type: "binary";
|
|
1113
|
+
readonly matches: (bytes: Uint8Array) => boolean;
|
|
1114
|
+
readonly parse: (bytes: Uint8Array) => Profile[];
|
|
1115
|
+
readonly parseAsync: (stream: ReadableStream<Uint8Array>) => Promise<Profile[]>;
|
|
1116
|
+
};
|
|
1117
|
+
readonly 'jsc-heap-snapshot': {
|
|
1118
|
+
readonly title: "JSC heap snapshot";
|
|
1119
|
+
readonly extension: "jsc-heap-snapshot.json";
|
|
1120
|
+
readonly languages: readonly ["javascript"];
|
|
1121
|
+
readonly fallbackOrigin: "safari";
|
|
1122
|
+
readonly type: "json";
|
|
1123
|
+
readonly matches: (json: unknown) => boolean;
|
|
1124
|
+
readonly parse: (json: unknown) => HeapSnapshot[];
|
|
1125
|
+
};
|
|
1126
|
+
readonly pprof: {
|
|
1127
|
+
readonly title: "pprof";
|
|
1128
|
+
readonly extension: "pprof";
|
|
1129
|
+
readonly languages: readonly ["c", "go", "javascript", "julia", "ruby", "rust"];
|
|
1130
|
+
readonly fallbackOrigin: "unknown";
|
|
1131
|
+
readonly type: "binary";
|
|
1132
|
+
readonly matches: (bytes: Uint8Array) => boolean;
|
|
1133
|
+
readonly parse: (bytes: Uint8Array<ArrayBufferLike>) => Profile[];
|
|
1134
|
+
readonly parseAsync: (stream: ReadableStream<Uint8Array<ArrayBufferLike>>) => Promise<Profile[]>;
|
|
1135
|
+
};
|
|
1136
|
+
readonly speedscope: {
|
|
1137
|
+
readonly title: "Speedscope";
|
|
1138
|
+
readonly extension: "speedscope.json";
|
|
1139
|
+
readonly languages: readonly ["csharp", "php", "python", "ruby"];
|
|
1140
|
+
readonly fallbackOrigin: "unknown";
|
|
1141
|
+
readonly type: "json";
|
|
1142
|
+
readonly matches: (json: unknown) => boolean;
|
|
1143
|
+
readonly parse: (json: unknown) => Profile[];
|
|
1144
|
+
};
|
|
1145
|
+
readonly systing: {
|
|
1146
|
+
readonly title: "systing profile export";
|
|
1147
|
+
readonly extension: "systing";
|
|
1148
|
+
readonly languages: readonly ["c", "python", "rust"];
|
|
1149
|
+
readonly fallbackOrigin: "systing";
|
|
1150
|
+
readonly type: "binary";
|
|
1151
|
+
readonly matches: (bytes: Uint8Array) => boolean;
|
|
1152
|
+
readonly parse: (bytes: Uint8Array) => Profile[];
|
|
1153
|
+
readonly parseAsync: (stream: ReadableStream<Uint8Array>) => Promise<Profile[]>;
|
|
1154
|
+
};
|
|
1155
|
+
readonly 'v8-cpu-profile': {
|
|
1156
|
+
readonly title: "V8 CPU profile";
|
|
1157
|
+
readonly extension: "cpuprofile";
|
|
1158
|
+
readonly languages: readonly ["javascript"];
|
|
1159
|
+
readonly fallbackOrigin: "unknown";
|
|
1160
|
+
readonly type: "json";
|
|
1161
|
+
readonly matches: (json: unknown) => boolean;
|
|
1162
|
+
readonly parse: (json: unknown) => Profile[];
|
|
1163
|
+
};
|
|
1164
|
+
readonly 'v8-heap-profile': {
|
|
1165
|
+
readonly title: "V8 heap profile";
|
|
1166
|
+
readonly extension: "heapprofile";
|
|
1167
|
+
readonly languages: readonly ["javascript"];
|
|
1168
|
+
readonly fallbackOrigin: "node";
|
|
1169
|
+
readonly type: "json";
|
|
1170
|
+
readonly matches: (json: unknown) => boolean;
|
|
1171
|
+
readonly parse: (json: unknown) => Profile[];
|
|
1172
|
+
};
|
|
1173
|
+
readonly 'v8-heap-snapshot': {
|
|
1174
|
+
readonly title: "V8 heap snapshot";
|
|
1175
|
+
readonly extension: "heapsnapshot";
|
|
1176
|
+
readonly languages: readonly ["javascript", "julia"];
|
|
1177
|
+
readonly fallbackOrigin: "node";
|
|
1178
|
+
readonly type: "json";
|
|
1179
|
+
readonly matches: (json: unknown) => boolean;
|
|
1180
|
+
readonly parse: (json: unknown) => HeapSnapshot[];
|
|
1181
|
+
};
|
|
1182
|
+
readonly 'webkit-timeline-recording': {
|
|
1183
|
+
readonly title: "WebKit timeline recording";
|
|
1184
|
+
readonly extension: "webkit-timeline-recording.json";
|
|
1185
|
+
readonly languages: readonly ["javascript"];
|
|
1186
|
+
readonly fallbackOrigin: "safari";
|
|
1187
|
+
readonly type: "json";
|
|
1188
|
+
readonly matches: (json: unknown) => boolean;
|
|
1189
|
+
readonly parse: (json: unknown) => Profile[];
|
|
1190
|
+
};
|
|
1191
|
+
};
|
|
1192
|
+
/** Supported profile format IDs. */
|
|
1193
|
+
type Format = keyof typeof formatConverters;
|
|
1194
|
+
//#endregion
|
|
280
1195
|
//#region src/formats/index.d.ts
|
|
281
1196
|
/**
|
|
282
1197
|
* Converts the given profile data to Markdown.
|
|
283
1198
|
*
|
|
284
|
-
* See the [docs](https://github.com/TomerAberbach/profiler-md/blob/main/docs
|
|
1199
|
+
* See the [docs](https://github.com/TomerAberbach/profiler-md/blob/main/docs)
|
|
285
1200
|
* for supported formats and generation instructions.
|
|
286
1201
|
*/
|
|
287
1202
|
declare const profileToMd: (input: ProfileInput<ProfileData>, options?: ProfileToMdOptions) => string;
|
|
288
1203
|
/**
|
|
289
1204
|
* Asynchronously converts the given profile data to Markdown.
|
|
290
1205
|
*
|
|
291
|
-
* See the [docs](https://github.com/TomerAberbach/profiler-md/blob/main/docs
|
|
1206
|
+
* See the [docs](https://github.com/TomerAberbach/profiler-md/blob/main/docs)
|
|
292
1207
|
* for supported formats and generation instructions.
|
|
293
1208
|
*/
|
|
294
1209
|
declare const profileToMdAsync: (input: ProfileInput<AsyncProfileData>, options?: ProfileToMdOptions) => Promise<string>;
|
|
@@ -298,7 +1213,7 @@ declare const profileToMdAsync: (input: ProfileInput<AsyncProfileData>, options?
|
|
|
298
1213
|
*
|
|
299
1214
|
* Each side accepts the same input as {@link profileToMd}.
|
|
300
1215
|
*
|
|
301
|
-
* See the [docs](https://github.com/TomerAberbach/profiler-md/blob/main/docs
|
|
1216
|
+
* See the [docs](https://github.com/TomerAberbach/profiler-md/blob/main/docs)
|
|
302
1217
|
* for supported formats and generation instructions.
|
|
303
1218
|
*/
|
|
304
1219
|
declare const diffProfiles: (base: ProfileInput<ProfileData>, current: ProfileInput<ProfileData>, options?: ProfileToMdOptions) => string;
|
|
@@ -308,12 +1223,9 @@ declare const diffProfiles: (base: ProfileInput<ProfileData>, current: ProfileIn
|
|
|
308
1223
|
*
|
|
309
1224
|
* Each side accepts the same input as {@link profileToMdAsync}.
|
|
310
1225
|
*
|
|
311
|
-
* See the [docs](https://github.com/TomerAberbach/profiler-md/blob/main/docs
|
|
1226
|
+
* See the [docs](https://github.com/TomerAberbach/profiler-md/blob/main/docs)
|
|
312
1227
|
* for supported formats and generation instructions.
|
|
313
1228
|
*/
|
|
314
1229
|
declare const diffProfilesAsync: (base: ProfileInput<AsyncProfileData>, current: ProfileInput<AsyncProfileData>, options?: ProfileToMdOptions) => Promise<string>;
|
|
315
|
-
declare const formats: readonly ["collapsed", "jsc-heap-snapshot", "pprof", "speedscope", "v8-cpu-profile", "v8-heap-profile", "v8-heap-snapshot", "webkit-timeline-recording"];
|
|
316
|
-
/** Supported profile format IDs. */
|
|
317
|
-
type Format = (typeof formats)[number];
|
|
318
1230
|
//#endregion
|
|
319
|
-
export { type AggregatedProfileEntry, type AsyncProfileData, type
|
|
1231
|
+
export { type AggregatedProfileEntry, type AsyncProfileData, type EntryCategory, type EntryMatch, type FileReference, type Format, type Origin, type ProfileData, type ProfileEntry, type ProfileInput, type ProfileToMdContext, type ProfileToMdOptions, type SourceLocation, type SourceMap, defaultCategorizeEntries, defaultMatchEntry, defaultShowEntry, diffProfiles, diffProfilesAsync, isExternalImplementationDetailEntry, isSyntheticEntry, profileToMd, profileToMdAsync };
|