profiler-md 0.5.0 → 0.7.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 +14155 -5081
- package/dist/index.d.mts +1312 -263
- package/dist/index.js +2 -2
- package/docs/api.md +138 -0
- package/docs/formats/callgrind.md +25 -0
- package/docs/formats/collapsed.md +5 -3
- package/docs/formats/ghc-eventlog.md +20 -0
- package/docs/formats/ghc-json-profile.md +23 -0
- package/docs/formats/hprof.md +21 -0
- package/docs/formats/jfr.md +3 -3
- package/docs/formats/jsc-heap-snapshot.md +11 -5
- package/docs/formats/memray.md +30 -0
- package/docs/formats/perf.md +74 -0
- package/docs/formats/pprof.md +10 -6
- package/docs/formats/speedscope.md +7 -5
- package/docs/formats/systing.md +27 -0
- package/docs/formats/v8-cpu-profile.md +4 -3
- package/docs/formats/v8-heap-profile.md +8 -5
- package/docs/formats/v8-heap-snapshot.md +10 -5
- package/docs/formats/webkit-timeline-recording.md +6 -0
- package/docs/languages/c.md +138 -18
- package/docs/languages/csharp.md +7 -7
- package/docs/languages/elixir.md +22 -15
- package/docs/languages/fortran.md +141 -0
- package/docs/languages/go.md +36 -13
- package/docs/languages/haskell.md +134 -0
- package/docs/languages/java.md +89 -34
- package/docs/languages/javascript.md +37 -31
- package/docs/languages/julia.md +96 -14
- package/docs/languages/php.md +10 -4
- package/docs/languages/python.md +121 -15
- package/docs/languages/ruby.md +19 -22
- package/docs/languages/rust.md +40 -10
- package/docs/languages/swift.md +135 -0
- package/docs/languages/zig.md +155 -0
- package/package.json +47 -46
- package/readme.md +306 -242
- package/skills/profile-optimize/SKILL.md +162 -0
- package/docs/languages/cpp.md +0 -160
- package/docs/languages/erlang.md +0 -46
- package/docs/languages/fsharp.md +0 -52
- package/docs/languages/kotlin.md +0 -170
- package/docs/languages/typescript.md +0 -276
- package/examples/output/c.gperftools.cpu.base.pprof.md +0 -324
- package/examples/output/c.gperftools.cpu.current.pprof.md +0 -271
- package/examples/output/c.gperftools.cpu.diff.pprof.md +0 -98
- package/examples/output/c.gperftools.heap.base.pprof.md +0 -362
- package/examples/output/c.gperftools.heap.current.pprof.md +0 -362
- package/examples/output/c.gperftools.heap.diff.pprof.md +0 -28
- package/examples/output/cpp.gperftools.cpu.base.pprof.md +0 -557
- package/examples/output/cpp.gperftools.cpu.current.pprof.md +0 -573
- package/examples/output/cpp.gperftools.cpu.diff.pprof.md +0 -122
- package/examples/output/cpp.gperftools.heap.base.pprof.md +0 -67
- package/examples/output/cpp.gperftools.heap.current.pprof.md +0 -67
- package/examples/output/cpp.gperftools.heap.diff.pprof.md +0 -19
- package/examples/output/csharp.dotnet-trace.base.speedscope.json.md +0 -411
- package/examples/output/csharp.dotnet-trace.current.speedscope.json.md +0 -412
- package/examples/output/csharp.dotnet-trace.diff.speedscope.json.md +0 -122
- package/examples/output/elixir.eflambe.cpu.base.collapsed.md +0 -399
- package/examples/output/elixir.eflambe.cpu.current.collapsed.md +0 -398
- package/examples/output/elixir.eflambe.cpu.diff.collapsed.md +0 -92
- package/examples/output/erlang.eflambe.cpu.base.collapsed.md +0 -147
- package/examples/output/erlang.eflambe.cpu.current.collapsed.md +0 -147
- package/examples/output/erlang.eflambe.cpu.diff.collapsed.md +0 -18
- package/examples/output/fsharp.dotnet-trace.base.speedscope.json.md +0 -324
- package/examples/output/fsharp.dotnet-trace.current.speedscope.json.md +0 -314
- package/examples/output/fsharp.dotnet-trace.diff.speedscope.json.md +0 -119
- package/examples/output/go.pprof.block.base.pprof.md +0 -86
- package/examples/output/go.pprof.block.current.pprof.md +0 -83
- package/examples/output/go.pprof.block.diff.pprof.md +0 -42
- package/examples/output/go.pprof.cpu.base.pprof.md +0 -81
- package/examples/output/go.pprof.cpu.current.pprof.md +0 -70
- package/examples/output/go.pprof.cpu.diff.pprof.md +0 -52
- package/examples/output/go.pprof.goroutine.base.pprof.md +0 -43
- package/examples/output/go.pprof.goroutine.current.pprof.md +0 -43
- package/examples/output/go.pprof.goroutine.diff.pprof.md +0 -13
- package/examples/output/go.pprof.heap-alloc.base.pprof.md +0 -154
- package/examples/output/go.pprof.heap-alloc.current.pprof.md +0 -146
- package/examples/output/go.pprof.heap-alloc.diff.pprof.md +0 -67
- package/examples/output/go.pprof.heap.base.pprof.md +0 -154
- package/examples/output/go.pprof.heap.current.pprof.md +0 -146
- package/examples/output/go.pprof.heap.diff.pprof.md +0 -67
- package/examples/output/go.pprof.mutex.base.pprof.md +0 -55
- package/examples/output/go.pprof.mutex.current.pprof.md +0 -41
- package/examples/output/go.pprof.mutex.diff.pprof.md +0 -31
- package/examples/output/go.pprof.threadcreate.base.pprof.md +0 -55
- package/examples/output/go.pprof.threadcreate.current.pprof.md +0 -55
- package/examples/output/go.pprof.threadcreate.diff.pprof.md +0 -19
- package/examples/output/java.async-profiler.all.base.jfr.md +0 -1071
- package/examples/output/java.async-profiler.all.current.jfr.md +0 -1007
- package/examples/output/java.async-profiler.all.diff.jfr.md +0 -268
- package/examples/output/java.async-profiler.alloc.base.jfr.md +0 -425
- package/examples/output/java.async-profiler.alloc.current.jfr.md +0 -413
- package/examples/output/java.async-profiler.alloc.diff.jfr.md +0 -99
- package/examples/output/java.async-profiler.cpu.base.collapsed.md +0 -367
- package/examples/output/java.async-profiler.cpu.base.jfr.md +0 -485
- package/examples/output/java.async-profiler.cpu.current.collapsed.md +0 -355
- package/examples/output/java.async-profiler.cpu.current.jfr.md +0 -488
- package/examples/output/java.async-profiler.cpu.diff.collapsed.md +0 -117
- package/examples/output/java.async-profiler.cpu.diff.jfr.md +0 -118
- package/examples/output/java.async-profiler.live.base.jfr.md +0 -697
- package/examples/output/java.async-profiler.live.current.jfr.md +0 -684
- package/examples/output/java.async-profiler.live.diff.jfr.md +0 -191
- package/examples/output/java.async-profiler.lock.base.jfr.md +0 -140
- package/examples/output/java.async-profiler.lock.current.jfr.md +0 -108
- package/examples/output/java.async-profiler.lock.diff.jfr.md +0 -44
- package/examples/output/java.async-profiler.nativemem.base.jfr.md +0 -222
- package/examples/output/java.async-profiler.nativemem.current.jfr.md +0 -222
- package/examples/output/java.async-profiler.nativemem.diff.jfr.md +0 -65
- package/examples/output/java.async-profiler.wall.base.jfr.md +0 -400
- package/examples/output/java.async-profiler.wall.current.jfr.md +0 -420
- package/examples/output/java.async-profiler.wall.diff.jfr.md +0 -94
- package/examples/output/java.jdk.all.base.jfr.md +0 -1024
- package/examples/output/java.jdk.all.current.jfr.md +0 -1010
- package/examples/output/java.jdk.all.diff.jfr.md +0 -311
- package/examples/output/java.jdk.alloc.base.jfr.md +0 -1024
- package/examples/output/java.jdk.alloc.current.jfr.md +0 -1046
- package/examples/output/java.jdk.alloc.diff.jfr.md +0 -312
- package/examples/output/java.jdk.cpu.base.jfr.md +0 -1023
- package/examples/output/java.jdk.cpu.current.jfr.md +0 -1039
- package/examples/output/java.jdk.cpu.diff.jfr.md +0 -285
- package/examples/output/java.jdk.live.base.jfr.md +0 -1029
- package/examples/output/java.jdk.live.current.jfr.md +0 -1035
- package/examples/output/java.jdk.live.diff.jfr.md +0 -289
- package/examples/output/java.jdk.lock.base.jfr.md +0 -1040
- package/examples/output/java.jdk.lock.current.jfr.md +0 -1051
- package/examples/output/java.jdk.lock.diff.jfr.md +0 -339
- package/examples/output/javascript.bun.base.cpuprofile.md +0 -73
- package/examples/output/javascript.bun.base.heapsnapshot.md +0 -608
- package/examples/output/javascript.bun.base.jsc-heap-snapshot.json.md +0 -480
- package/examples/output/javascript.bun.current.cpuprofile.md +0 -73
- package/examples/output/javascript.bun.current.heapsnapshot.md +0 -608
- package/examples/output/javascript.bun.current.jsc-heap-snapshot.json.md +0 -480
- package/examples/output/javascript.bun.diff.cpuprofile.md +0 -54
- package/examples/output/javascript.bun.diff.heapsnapshot.md +0 -48
- package/examples/output/javascript.bun.diff.jsc-heap-snapshot.json.md +0 -62
- package/examples/output/javascript.chrome.base.cpuprofile.md +0 -163
- package/examples/output/javascript.chrome.base.heapprofile.md +0 -32
- package/examples/output/javascript.chrome.base.heapsnapshot.md +0 -649
- package/examples/output/javascript.chrome.current.cpuprofile.md +0 -149
- package/examples/output/javascript.chrome.current.heapprofile.md +0 -32
- package/examples/output/javascript.chrome.current.heapsnapshot.md +0 -647
- package/examples/output/javascript.chrome.diff.cpuprofile.md +0 -65
- package/examples/output/javascript.chrome.diff.heapprofile.md +0 -50
- package/examples/output/javascript.chrome.diff.heapsnapshot.md +0 -73
- package/examples/output/javascript.deno.base.cpuprofile.md +0 -122
- package/examples/output/javascript.deno.current.cpuprofile.md +0 -114
- package/examples/output/javascript.deno.diff.cpuprofile.md +0 -66
- package/examples/output/javascript.node.base.cpuprofile.md +0 -136
- package/examples/output/javascript.node.base.heapprofile.md +0 -56
- package/examples/output/javascript.node.base.heapsnapshot.md +0 -660
- package/examples/output/javascript.node.current.cpuprofile.md +0 -119
- package/examples/output/javascript.node.current.heapprofile.md +0 -52
- package/examples/output/javascript.node.current.heapsnapshot.md +0 -660
- package/examples/output/javascript.node.diff.cpuprofile.md +0 -70
- package/examples/output/javascript.node.diff.heapprofile.md +0 -34
- package/examples/output/javascript.node.diff.heapsnapshot.md +0 -39
- package/examples/output/javascript.pprof.cpu.base.pprof.md +0 -104
- package/examples/output/javascript.pprof.cpu.current.pprof.md +0 -120
- package/examples/output/javascript.pprof.cpu.diff.pprof.md +0 -63
- package/examples/output/javascript.pprof.heap.base.pprof.md +0 -86
- package/examples/output/javascript.pprof.heap.current.pprof.md +0 -57
- package/examples/output/javascript.pprof.heap.diff.pprof.md +0 -42
- package/examples/output/javascript.safari.base.webkit-timeline-recording.json.md +0 -388
- package/examples/output/javascript.safari.current.webkit-timeline-recording.json.md +0 -378
- package/examples/output/javascript.safari.diff.webkit-timeline-recording.json.md +0 -122
- package/examples/output/julia.pprof-jl.alloc.base.pprof.md +0 -124
- package/examples/output/julia.pprof-jl.alloc.current.pprof.md +0 -126
- package/examples/output/julia.pprof-jl.alloc.diff.pprof.md +0 -30
- package/examples/output/julia.pprof-jl.cpu.base.pprof.md +0 -177
- package/examples/output/julia.pprof-jl.cpu.current.pprof.md +0 -179
- package/examples/output/julia.pprof-jl.cpu.diff.pprof.md +0 -64
- package/examples/output/kotlin.async-profiler.all.base.jfr.md +0 -920
- package/examples/output/kotlin.async-profiler.all.current.jfr.md +0 -925
- package/examples/output/kotlin.async-profiler.all.diff.jfr.md +0 -247
- package/examples/output/kotlin.async-profiler.alloc.base.jfr.md +0 -467
- package/examples/output/kotlin.async-profiler.alloc.current.jfr.md +0 -473
- package/examples/output/kotlin.async-profiler.alloc.diff.jfr.md +0 -122
- package/examples/output/kotlin.async-profiler.cpu.base.collapsed.md +0 -371
- package/examples/output/kotlin.async-profiler.cpu.base.jfr.md +0 -472
- package/examples/output/kotlin.async-profiler.cpu.current.collapsed.md +0 -370
- package/examples/output/kotlin.async-profiler.cpu.current.jfr.md +0 -445
- package/examples/output/kotlin.async-profiler.cpu.diff.collapsed.md +0 -124
- package/examples/output/kotlin.async-profiler.cpu.diff.jfr.md +0 -125
- package/examples/output/kotlin.async-profiler.live.base.jfr.md +0 -934
- package/examples/output/kotlin.async-profiler.live.current.jfr.md +0 -917
- package/examples/output/kotlin.async-profiler.live.diff.jfr.md +0 -245
- package/examples/output/kotlin.async-profiler.lock.base.jfr.md +0 -1
- package/examples/output/kotlin.async-profiler.lock.current.jfr.md +0 -1
- package/examples/output/kotlin.async-profiler.lock.diff.jfr.md +0 -1
- package/examples/output/kotlin.async-profiler.nativemem.base.jfr.md +0 -234
- package/examples/output/kotlin.async-profiler.nativemem.current.jfr.md +0 -234
- package/examples/output/kotlin.async-profiler.nativemem.diff.jfr.md +0 -65
- package/examples/output/kotlin.async-profiler.wall.base.jfr.md +0 -452
- package/examples/output/kotlin.async-profiler.wall.current.jfr.md +0 -457
- package/examples/output/kotlin.async-profiler.wall.diff.jfr.md +0 -125
- package/examples/output/kotlin.jdk.all.base.jfr.md +0 -1442
- package/examples/output/kotlin.jdk.all.current.jfr.md +0 -1343
- package/examples/output/kotlin.jdk.all.diff.jfr.md +0 -392
- package/examples/output/kotlin.jdk.alloc.base.jfr.md +0 -1418
- package/examples/output/kotlin.jdk.alloc.current.jfr.md +0 -1389
- package/examples/output/kotlin.jdk.alloc.diff.jfr.md +0 -383
- package/examples/output/kotlin.jdk.cpu.base.jfr.md +0 -1406
- package/examples/output/kotlin.jdk.cpu.current.jfr.md +0 -1374
- package/examples/output/kotlin.jdk.cpu.diff.jfr.md +0 -380
- package/examples/output/kotlin.jdk.live.base.jfr.md +0 -1378
- package/examples/output/kotlin.jdk.live.current.jfr.md +0 -1311
- package/examples/output/kotlin.jdk.live.diff.jfr.md +0 -381
- package/examples/output/kotlin.jdk.lock.base.jfr.md +0 -1427
- package/examples/output/kotlin.jdk.lock.current.jfr.md +0 -1374
- package/examples/output/kotlin.jdk.lock.diff.jfr.md +0 -386
- package/examples/output/php.excimer.wall.base.speedscope.json.md +0 -25
- package/examples/output/php.excimer.wall.current.speedscope.json.md +0 -25
- package/examples/output/php.excimer.wall.diff.speedscope.json.md +0 -29
- package/examples/output/python.py-spy.cpu.base.collapsed.md +0 -526
- package/examples/output/python.py-spy.cpu.base.speedscope.json.md +0 -37
- package/examples/output/python.py-spy.cpu.current.collapsed.md +0 -514
- package/examples/output/python.py-spy.cpu.current.speedscope.json.md +0 -37
- package/examples/output/python.py-spy.cpu.diff.collapsed.md +0 -122
- package/examples/output/python.py-spy.cpu.diff.speedscope.json.md +0 -31
- package/examples/output/python.py-spy.wall.base.collapsed.md +0 -527
- package/examples/output/python.py-spy.wall.current.collapsed.md +0 -518
- package/examples/output/python.py-spy.wall.diff.collapsed.md +0 -122
- package/examples/output/ruby.rbspy.cpu.base.collapsed.md +0 -90
- package/examples/output/ruby.rbspy.cpu.base.pprof.md +0 -105
- package/examples/output/ruby.rbspy.cpu.base.speedscope.json.md +0 -105
- package/examples/output/ruby.rbspy.cpu.current.collapsed.md +0 -90
- package/examples/output/ruby.rbspy.cpu.current.pprof.md +0 -115
- package/examples/output/ruby.rbspy.cpu.current.speedscope.json.md +0 -115
- package/examples/output/ruby.rbspy.cpu.diff.collapsed.md +0 -32
- package/examples/output/ruby.rbspy.cpu.diff.pprof.md +0 -44
- package/examples/output/ruby.rbspy.cpu.diff.speedscope.json.md +0 -44
- package/examples/output/rust.pprof-rs.cpu.base.pprof.md +0 -60
- package/examples/output/rust.pprof-rs.cpu.current.pprof.md +0 -60
- package/examples/output/rust.pprof-rs.cpu.diff.pprof.md +0 -24
package/readme.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="assets/logo.svg" alt="Markdown flame logo" width="250" />
|
|
3
|
+
</div>
|
|
4
|
+
|
|
1
5
|
<h1 align="center">
|
|
2
6
|
profiler-md
|
|
3
7
|
</h1>
|
|
@@ -18,35 +22,258 @@
|
|
|
18
22
|
Converts performance profiles to human and LLM friendly Markdown.
|
|
19
23
|
</div>
|
|
20
24
|
|
|
25
|
+
<div align="center">
|
|
26
|
+
<a href="#demo">Demo</a> •
|
|
27
|
+
<a href="#features">Features</a> •
|
|
28
|
+
<a href="#install">Install</a> •
|
|
29
|
+
<a href="#usage">Usage</a> •
|
|
30
|
+
<a href="#skill">Skill</a> •
|
|
31
|
+
<a href="#languages-and-formats">Languages and formats</a>
|
|
32
|
+
</div>
|
|
33
|
+
|
|
21
34
|
> [!NOTE]
|
|
22
35
|
>
|
|
23
|
-
> This package is in **beta** and I'm excited for you to try it!
|
|
24
|
-
>
|
|
25
|
-
> I'd love your feedback! Share suggestions, bug reports, feature requests, or
|
|
26
|
-
> other thoughts by
|
|
36
|
+
> This package is in **beta** and I'm excited for you to try it! Share
|
|
37
|
+
> suggestions, bug reports, and feature requests by
|
|
27
38
|
> [filing an issue](https://github.com/TomerAberbach/profiler-md/issues/new).
|
|
28
39
|
|
|
40
|
+
## Demo
|
|
41
|
+
|
|
42
|
+
<div align="center">
|
|
43
|
+
<img src="assets/demo.gif" alt="Converting and diffing CPU profiles in the terminal" />
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<!-- prettier-ignore-start -->
|
|
47
|
+
|
|
48
|
+
<!-- EXAMPLE_OUTPUT START -->
|
|
49
|
+
|
|
50
|
+
```md
|
|
51
|
+
# CPU profile
|
|
52
|
+
|
|
53
|
+
Took 2.49s over 2,659 samples (939.9µs per sample).
|
|
54
|
+
|
|
55
|
+
| Category | % | Time | Samples |
|
|
56
|
+
| ------------------ | ----: | ------: | ------: |
|
|
57
|
+
| Third-party | 87.4% | 2.18s | 2,410 |
|
|
58
|
+
| Garbage collector | 7.6% | 191.0ms | 156 |
|
|
59
|
+
| Standard library | 3.9% | 96.8ms | 70 |
|
|
60
|
+
| Native | 0.9% | 22.7ms | 20 |
|
|
61
|
+
| Regular expression | 0.1% | 2.5ms | 2 |
|
|
62
|
+
| Ours | 0.1% | 1.3ms | 1 |
|
|
63
|
+
|
|
64
|
+
## Hottest functions
|
|
65
|
+
|
|
66
|
+
### Self time
|
|
67
|
+
|
|
68
|
+
Functions ranked by time spent directly in the function body, excluding callees.
|
|
69
|
+
|
|
70
|
+
| % | Time | Samples | Function | Location |
|
|
71
|
+
| ---: | ------: | ------: | ------------------------------- | ---------------------------------------------------- |
|
|
72
|
+
| 7.6% | 191.0ms | 156 | `(garbage collector)` | `<unknown>` |
|
|
73
|
+
| 2.9% | 71.5ms | 57 | `wrapSafe` | `node:internal/modules/cjs/loader:1671:18` |
|
|
74
|
+
| 2.8% | 69.0ms | 66 | `recursiveTypeRelatedTo` | `node_modules/typescript/lib/typescript.js:64383:38` |
|
|
75
|
+
| 2.5% | 63.0ms | 66 | `isRelatedTo` | `node_modules/typescript/lib/typescript.js:63813:27` |
|
|
76
|
+
| 2.1% | 51.7ms | 43 | `checkTypeRelatedTo` | `node_modules/typescript/lib/typescript.js:63505:32` |
|
|
77
|
+
…
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
<!-- EXAMPLE_OUTPUT END -->
|
|
81
|
+
|
|
82
|
+
<!-- prettier-ignore-end -->
|
|
83
|
+
|
|
84
|
+
The output continues with the hottest functions by total time, the hottest call
|
|
85
|
+
stacks, and per-line, caller, and callee detail. See the
|
|
86
|
+
[full output](examples/output/javascript.node.base.cpuprofile.md), or
|
|
87
|
+
[`examples/output/`](examples/output) for heap snapshots and diffs.
|
|
88
|
+
|
|
29
89
|
## Features
|
|
30
90
|
|
|
31
|
-
- **Polyglot:**
|
|
32
|
-
languages
|
|
33
|
-
|
|
34
|
-
- **
|
|
35
|
-
|
|
91
|
+
- **Polyglot:**
|
|
92
|
+
[profile, call graph, and heap snapshot formats](#languages-and-formats)
|
|
93
|
+
across many languages
|
|
94
|
+
- **Profile analysis:** sampling rates, category breakdowns, and the hottest
|
|
95
|
+
functions, call stacks, lines, callers, and callees
|
|
96
|
+
- **Heap analysis:** self and
|
|
97
|
+
[dominator](<https://en.wikipedia.org/wiki/Dominator_(graph_theory)>)-based
|
|
98
|
+
retained sizes, retainer paths, and the largest constructors and strings
|
|
99
|
+
- **Multi-profile inputs:** one `all` JFR recording becomes CPU, allocation, and
|
|
100
|
+
lock contention profiles
|
|
101
|
+
- **Diffing:** ranked regressions and improvements between two profiles or two
|
|
102
|
+
heap snapshots, across formats and profilers
|
|
36
103
|
- **Source maps:** resolves minified and transpiled locations back to original
|
|
37
104
|
sources
|
|
38
|
-
- **Zero config:** auto-detects the format
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
105
|
+
- **Zero config:** auto-detects the format and profiler
|
|
106
|
+
- **Configurable:** top entry counts, base URLs, categorization, filtering, and
|
|
107
|
+
diff matching
|
|
108
|
+
- **CLI and API:** a command line and a fully-typed API with sync and async
|
|
109
|
+
variants ([API docs](docs/api.md))
|
|
110
|
+
- **Self-documenting:** `--help <language>` and `--help <format>` explain how to
|
|
111
|
+
generate and read each profile type
|
|
112
|
+
- **Agent-ready:** ships a [skill](#skill) that guides an agent through
|
|
113
|
+
profiling and optimizing your code
|
|
114
|
+
|
|
115
|
+
## Install
|
|
116
|
+
|
|
117
|
+
```sh
|
|
118
|
+
# npm
|
|
119
|
+
$ npm i -g profiler-md
|
|
120
|
+
|
|
121
|
+
# Homebrew
|
|
122
|
+
$ brew install tomeraberbach/tap/profiler-md
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
<details>
|
|
126
|
+
<summary>Shell completions (optional)</summary>
|
|
127
|
+
|
|
128
|
+
```sh
|
|
129
|
+
# Bash (Linux)
|
|
130
|
+
$ profiler-md --completion bash > ~/.local/share/bash-completion/completions/profiler-md
|
|
131
|
+
|
|
132
|
+
# Bash (macOS/Homebrew)
|
|
133
|
+
$ profiler-md --completion bash > $(brew --prefix)/etc/bash_completion.d/profiler-md
|
|
134
|
+
|
|
135
|
+
# Fish
|
|
136
|
+
$ profiler-md --completion fish > ~/.config/fish/completions/profiler-md.fish
|
|
137
|
+
|
|
138
|
+
# Zsh
|
|
139
|
+
$ profiler-md --completion zsh > ~/.zfunc/_profiler-md
|
|
140
|
+
|
|
141
|
+
# PowerShell
|
|
142
|
+
$ profiler-md --completion pwsh >> $PROFILE.CurrentUserCurrentHost
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
</details>
|
|
146
|
+
|
|
147
|
+
## Usage
|
|
148
|
+
|
|
149
|
+
### CLI
|
|
150
|
+
|
|
151
|
+
```sh
|
|
152
|
+
# Convert a profile, paged and syntax highlighted
|
|
153
|
+
$ profiler-md profile.cpuprofile
|
|
154
|
+
|
|
155
|
+
# Diff two profiles or two heap snapshots
|
|
156
|
+
$ profiler-md base.cpuprofile current.cpuprofile
|
|
157
|
+
|
|
158
|
+
# Write the Markdown to a file
|
|
159
|
+
$ profiler-md profile.pb.gz -o profile.md
|
|
160
|
+
|
|
161
|
+
# Read a profile from stdin
|
|
162
|
+
$ node --cpu-prof app.js && cat *.cpuprofile | profiler-md
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
<details>
|
|
166
|
+
<summary>All flags</summary>
|
|
167
|
+
|
|
168
|
+
<!-- prettier-ignore-start -->
|
|
169
|
+
|
|
170
|
+
<!-- CLI_HELP START -->
|
|
171
|
+
|
|
172
|
+
```sh
|
|
173
|
+
$ profiler-md --help
|
|
174
|
+
Usage: profiler-md [(-h/--help [TOPIC])] [-f/--format FORMAT] [-r/--origin
|
|
175
|
+
ORIGIN] [-o/--output FILE] [--top-n N] [--min-category-share FRACTION] [
|
|
176
|
+
--base-url STRING] [--source-maps GLOB...] [--match-name
|
|
177
|
+
REGEX=REPLACEMENT...] [--match-location REGEX=REPLACEMENT...] [--category
|
|
178
|
+
REGEX=CATEGORY...] [--hide REGEX...] [--show REGEX...] [--hide-category
|
|
179
|
+
CATEGORY...] [--show-category CATEGORY...] [--no-pager] [--color/
|
|
180
|
+
--no-color] ([FILE] | BASE CURRENT)
|
|
181
|
+
|
|
182
|
+
Converts performance profiles to human and LLM friendly Markdown.
|
|
183
|
+
|
|
184
|
+
-h, --help [TOPIC] Show this help message or topic docs
|
|
185
|
+
-f, --format FORMAT Input profile format (default: auto)
|
|
186
|
+
-r, --origin ORIGIN Input profile origin (default: auto)
|
|
187
|
+
-o, --output FILE Output file (default: - for stdout)
|
|
188
|
+
--top-n N Entries to show per ranking, including
|
|
189
|
+
category subsections (default: 20)
|
|
190
|
+
--min-category-share FRACTION Share of a profile a category needs for
|
|
191
|
+
its own subsection, from 0 to 1 (default:
|
|
192
|
+
0.01)
|
|
193
|
+
--base-url STRING Base URL or path to show paths relative
|
|
194
|
+
to, or "auto" for their common ancestor
|
|
195
|
+
(default: cwd)
|
|
196
|
+
--source-maps GLOB Source maps (JSON or inline) to apply to
|
|
197
|
+
locations (repeatable)
|
|
198
|
+
--match-name REGEX=REPLACEMENT Rewrite names matching REGEX to
|
|
199
|
+
REPLACEMENT when pairing diffed entries
|
|
200
|
+
(repeatable)
|
|
201
|
+
--match-location REGEX=REPLACEMENT Rewrite locations (URL, path, or logical
|
|
202
|
+
name) matching REGEX to REPLACEMENT when
|
|
203
|
+
pairing diffed entries (repeatable)
|
|
204
|
+
--category REGEX=CATEGORY Categorize functions whose name or
|
|
205
|
+
location matches REGEX as CATEGORY, first
|
|
206
|
+
rule winning (repeatable)
|
|
207
|
+
--hide REGEX Hide entries whose name or location
|
|
208
|
+
matches REGEX, still counting hidden
|
|
209
|
+
entries in totals (repeatable)
|
|
210
|
+
--show REGEX Show only entries whose name or location
|
|
211
|
+
matches REGEX, still counting hidden
|
|
212
|
+
entries in totals (repeatable)
|
|
213
|
+
--hide-category CATEGORY Hide entries of CATEGORY, still counting
|
|
214
|
+
hidden entries in totals (repeatable)
|
|
215
|
+
--show-category CATEGORY Show only entries of CATEGORY, still
|
|
216
|
+
counting hidden entries in totals
|
|
217
|
+
(repeatable)
|
|
218
|
+
--no-pager Disable stdout paging (default: auto)
|
|
219
|
+
--color, --no-color Enable or disable ANSI syntax
|
|
220
|
+
highlighting (default: auto)
|
|
221
|
+
FILE Profile to convert (default: stdin)
|
|
222
|
+
BASE Base profile to diff
|
|
223
|
+
CURRENT Current profile to diff against the base
|
|
224
|
+
|
|
225
|
+
Formats: callgrind, collapsed, ghc-eventlog, ghc-json-profile, hprof, jfr, jsc-heap-snapshot, memray, perf, pprof, speedscope, systing, v8-cpu-profile, v8-heap-profile, v8-heap-snapshot, webkit-timeline-recording
|
|
226
|
+
Origins: async-profiler, bun, chrome, deno, dotnet-trace, eflambe, excimer, ghc, go, gperftools, jdk, memray, node, node-pprof, perf, pprof-jl, pprof-rs, profile-jl, py-spy, pyinstrument, rbspy, safari, simpleperf, systing, tachyon, unknown, valgrind
|
|
227
|
+
Function categories (--category, --hide-category, --show-category): ours, third-party, stdlib, native, unknown, garbage collector, compiler, jit, regexp, kernel, idle
|
|
228
|
+
Heap snapshot categories (--hide-category, --show-category): object, array, string, concatenated string, sliced string, function, code, regexp, number, big number, symbol, native, object shape, internal, synthetic, unknown
|
|
229
|
+
Languages: c/cpp, csharp/fsharp, elixir/erlang, fortran, go, haskell, java/kotlin/groovy, javascript/typescript, julia, php, python, ruby, rust, swift, zig
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
<!-- CLI_HELP END -->
|
|
233
|
+
|
|
234
|
+
<!-- prettier-ignore-end -->
|
|
235
|
+
|
|
236
|
+
</details>
|
|
237
|
+
|
|
238
|
+
### API
|
|
239
|
+
|
|
240
|
+
```js
|
|
241
|
+
import { openAsBlob } from 'node:fs'
|
|
242
|
+
import { diffProfilesAsync, profileToMdAsync } from 'profiler-md'
|
|
243
|
+
|
|
244
|
+
// Convert a profile or heap snapshot. The format and origin are auto-detected
|
|
245
|
+
console.log(await profileToMdAsync(await openAsBlob(`example.cpuprofile`)))
|
|
246
|
+
|
|
247
|
+
// Diff two profiles or two heap snapshots
|
|
248
|
+
console.log(
|
|
249
|
+
await diffProfilesAsync(
|
|
250
|
+
await openAsBlob(`base.cpuprofile`),
|
|
251
|
+
await openAsBlob(`current.cpuprofile`),
|
|
252
|
+
),
|
|
253
|
+
)
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
See the [API docs](docs/api.md) for sync variants, explicit formats and origins,
|
|
257
|
+
and configuration callbacks.
|
|
258
|
+
|
|
259
|
+
## Skill
|
|
260
|
+
|
|
261
|
+
Use the [`profiler-md` skill](./skills/profile-optimize/SKILL.md) to have an
|
|
262
|
+
agent profile and optimize your code:
|
|
263
|
+
|
|
264
|
+
```sh
|
|
265
|
+
$ npx skills add TomerAberbach/profiler-md --skill profile-optimize
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
See [skills.sh](https://skills.sh/docs) for more info.
|
|
269
|
+
|
|
270
|
+
Fun fact: the skill has profiled and optimized `profiler-md` itself!
|
|
45
271
|
|
|
46
272
|
## Languages and formats
|
|
47
273
|
|
|
48
|
-
|
|
49
|
-
|
|
274
|
+
The table lists only the formats each language's own tools generate. Third-party
|
|
275
|
+
tools convert others. Each format's [docs](docs/formats) explain how to generate
|
|
276
|
+
and read it.
|
|
50
277
|
|
|
51
278
|
<!-- prettier-ignore-start -->
|
|
52
279
|
|
|
@@ -58,78 +285,113 @@ it. Third-party tools can often convert others, though.
|
|
|
58
285
|
</thead>
|
|
59
286
|
<tbody>
|
|
60
287
|
<tr>
|
|
61
|
-
<td><a href="docs/languages/c.md">C
|
|
288
|
+
<td><a href="docs/languages/c.md">C/C++</a></td>
|
|
62
289
|
<td>
|
|
63
|
-
<
|
|
290
|
+
<details><summary><a href="docs/formats/callgrind.md">Callgrind</a></summary><ul><li>C Valgrind (<a href="examples/output/c.valgrind.base.callgrind.md">base</a>, <a href="examples/output/c.valgrind.current.callgrind.md">current</a>, <a href="examples/output/c.valgrind.diff.callgrind.md">diff</a>)</li></ul></details>
|
|
291
|
+
<details><summary><a href="docs/formats/perf.md">perf.data</a></summary><ul><li>C perf CPU (<a href="examples/output/c.perf.cpu.base.perf.data.md">base</a>, <a href="examples/output/c.perf.cpu.current.perf.data.md">current</a>, <a href="examples/output/c.perf.cpu.diff.perf.data.md">diff</a>)</li><li>C++ perf CPU (<a href="examples/output/cpp.perf.cpu.base.perf.data.md">base</a>, <a href="examples/output/cpp.perf.cpu.current.perf.data.md">current</a>, <a href="examples/output/cpp.perf.cpu.diff.perf.data.md">diff</a>)</li></ul></details>
|
|
292
|
+
<details><summary><a href="docs/formats/pprof.md">pprof</a></summary><ul><li>C gperftools CPU (<a href="examples/output/c.gperftools.cpu.base.pprof.md">base</a>, <a href="examples/output/c.gperftools.cpu.current.pprof.md">current</a>, <a href="examples/output/c.gperftools.cpu.diff.pprof.md">diff</a>)</li><li>C gperftools heap (<a href="examples/output/c.gperftools.heap.base.pprof.md">base</a>, <a href="examples/output/c.gperftools.heap.current.pprof.md">current</a>, <a href="examples/output/c.gperftools.heap.diff.pprof.md">diff</a>)</li><li>C++ gperftools CPU (<a href="examples/output/cpp.gperftools.cpu.base.pprof.md">base</a>, <a href="examples/output/cpp.gperftools.cpu.current.pprof.md">current</a>, <a href="examples/output/cpp.gperftools.cpu.diff.pprof.md">diff</a>)</li><li>C++ gperftools heap (<a href="examples/output/cpp.gperftools.heap.base.pprof.md">base</a>, <a href="examples/output/cpp.gperftools.heap.current.pprof.md">current</a>, <a href="examples/output/cpp.gperftools.heap.diff.pprof.md">diff</a>)</li></ul></details>
|
|
293
|
+
<details><summary><a href="docs/formats/systing.md">systing</a></summary><ul><li>C systing CPU (<a href="examples/output/c.systing.cpu.base.systing.md">base</a>, <a href="examples/output/c.systing.cpu.current.systing.md">current</a>, <a href="examples/output/c.systing.cpu.diff.systing.md">diff</a>)</li></ul></details>
|
|
64
294
|
</td>
|
|
65
295
|
</tr>
|
|
66
296
|
<tr>
|
|
67
|
-
<td><a href="docs/languages/csharp.md">C
|
|
297
|
+
<td><a href="docs/languages/csharp.md">C#/F#</a></td>
|
|
68
298
|
<td>
|
|
69
|
-
<
|
|
299
|
+
<details><summary><a href="docs/formats/speedscope.md">Speedscope</a></summary><ul><li>C# dotnet-trace (<a href="examples/output/csharp.dotnet-trace.base.speedscope.json.md">base</a>, <a href="examples/output/csharp.dotnet-trace.current.speedscope.json.md">current</a>, <a href="examples/output/csharp.dotnet-trace.diff.speedscope.json.md">diff</a>)</li><li>F# dotnet-trace (<a href="examples/output/fsharp.dotnet-trace.base.speedscope.json.md">base</a>, <a href="examples/output/fsharp.dotnet-trace.current.speedscope.json.md">current</a>, <a href="examples/output/fsharp.dotnet-trace.diff.speedscope.json.md">diff</a>)</li></ul></details>
|
|
70
300
|
</td>
|
|
71
301
|
</tr>
|
|
72
302
|
<tr>
|
|
73
|
-
<td><a href="docs/languages/elixir.md">Elixir
|
|
303
|
+
<td><a href="docs/languages/elixir.md">Elixir/Erlang</a></td>
|
|
74
304
|
<td>
|
|
75
|
-
<
|
|
305
|
+
<details><summary><a href="docs/formats/collapsed.md">Collapsed stacks</a></summary><ul><li>Elixir eflambe wall (<a href="examples/output/elixir.eflambe.wall.base.collapsed.md">base</a>, <a href="examples/output/elixir.eflambe.wall.current.collapsed.md">current</a>, <a href="examples/output/elixir.eflambe.wall.diff.collapsed.md">diff</a>)</li><li>Erlang eflambe wall (<a href="examples/output/erlang.eflambe.wall.base.collapsed.md">base</a>, <a href="examples/output/erlang.eflambe.wall.current.collapsed.md">current</a>, <a href="examples/output/erlang.eflambe.wall.diff.collapsed.md">diff</a>)</li></ul></details>
|
|
306
|
+
</td>
|
|
307
|
+
</tr>
|
|
308
|
+
<tr>
|
|
309
|
+
<td><a href="docs/languages/fortran.md">Fortran</a></td>
|
|
310
|
+
<td>
|
|
311
|
+
<details><summary><a href="docs/formats/pprof.md">pprof</a></summary><ul><li>Fortran gperftools CPU (<a href="examples/output/fortran.gperftools.cpu.base.pprof.md">base</a>, <a href="examples/output/fortran.gperftools.cpu.current.pprof.md">current</a>, <a href="examples/output/fortran.gperftools.cpu.diff.pprof.md">diff</a>)</li><li>Fortran gperftools heap (<a href="examples/output/fortran.gperftools.heap.base.pprof.md">base</a>, <a href="examples/output/fortran.gperftools.heap.current.pprof.md">current</a>, <a href="examples/output/fortran.gperftools.heap.diff.pprof.md">diff</a>)</li></ul></details>
|
|
76
312
|
</td>
|
|
77
313
|
</tr>
|
|
78
314
|
<tr>
|
|
79
315
|
<td><a href="docs/languages/go.md">Go</a></td>
|
|
80
316
|
<td>
|
|
81
|
-
<
|
|
317
|
+
<details><summary><a href="docs/formats/pprof.md">pprof</a></summary><ul><li>Go pprof block (<a href="examples/output/go.go.block.base.pprof.md">base</a>, <a href="examples/output/go.go.block.current.pprof.md">current</a>, <a href="examples/output/go.go.block.diff.pprof.md">diff</a>)</li><li>Go pprof CPU (<a href="examples/output/go.go.cpu.base.pprof.md">base</a>, <a href="examples/output/go.go.cpu.current.pprof.md">current</a>, <a href="examples/output/go.go.cpu.diff.pprof.md">diff</a>)</li><li>Go pprof goroutine (<a href="examples/output/go.go.goroutine.base.pprof.md">base</a>, <a href="examples/output/go.go.goroutine.current.pprof.md">current</a>, <a href="examples/output/go.go.goroutine.diff.pprof.md">diff</a>)</li><li>Go pprof goroutine leak (<a href="examples/output/go.go.goroutineleak.base.pprof.md">base</a>, <a href="examples/output/go.go.goroutineleak.current.pprof.md">current</a>, <a href="examples/output/go.go.goroutineleak.diff.pprof.md">diff</a>)</li><li>Go pprof heap (<a href="examples/output/go.go.heap.base.pprof.md">base</a>, <a href="examples/output/go.go.heap.current.pprof.md">current</a>, <a href="examples/output/go.go.heap.diff.pprof.md">diff</a>)</li><li>Go pprof heap-alloc (<a href="examples/output/go.go.heap-alloc.base.pprof.md">base</a>, <a href="examples/output/go.go.heap-alloc.current.pprof.md">current</a>, <a href="examples/output/go.go.heap-alloc.diff.pprof.md">diff</a>)</li><li>Go pprof mutex (<a href="examples/output/go.go.mutex.base.pprof.md">base</a>, <a href="examples/output/go.go.mutex.current.pprof.md">current</a>, <a href="examples/output/go.go.mutex.diff.pprof.md">diff</a>)</li><li>Go pprof threadcreate (<a href="examples/output/go.go.threadcreate.base.pprof.md">base</a>, <a href="examples/output/go.go.threadcreate.current.pprof.md">current</a>, <a href="examples/output/go.go.threadcreate.diff.pprof.md">diff</a>)</li></ul></details>
|
|
82
318
|
</td>
|
|
83
319
|
</tr>
|
|
84
320
|
<tr>
|
|
85
|
-
<td><a href="docs/languages/
|
|
321
|
+
<td><a href="docs/languages/haskell.md">Haskell</a></td>
|
|
86
322
|
<td>
|
|
87
|
-
<
|
|
88
|
-
<
|
|
323
|
+
<details><summary><a href="docs/formats/ghc-eventlog.md">GHC eventlog</a></summary><ul><li>Haskell GHC (<a href="examples/output/haskell.ghc.base.eventlog.md">base</a>, <a href="examples/output/haskell.ghc.current.eventlog.md">current</a>, <a href="examples/output/haskell.ghc.diff.eventlog.md">diff</a>)</li></ul></details>
|
|
324
|
+
<details><summary><a href="docs/formats/ghc-json-profile.md">GHC JSON profile</a></summary><ul><li>Haskell GHC (<a href="examples/output/haskell.ghc.base.prof.json.md">base</a>, <a href="examples/output/haskell.ghc.current.prof.json.md">current</a>, <a href="examples/output/haskell.ghc.diff.prof.json.md">diff</a>)</li></ul></details>
|
|
89
325
|
</td>
|
|
90
326
|
</tr>
|
|
91
327
|
<tr>
|
|
92
|
-
<td><a href="docs/languages/
|
|
328
|
+
<td><a href="docs/languages/java.md">Java/Kotlin/Groovy</a></td>
|
|
93
329
|
<td>
|
|
94
|
-
<
|
|
95
|
-
<
|
|
96
|
-
<
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
<
|
|
330
|
+
<details><summary><a href="docs/formats/collapsed.md">Collapsed stacks</a></summary><ul><li>Groovy async-profiler CPU (<a href="examples/output/groovy.async-profiler.cpu.base.collapsed.md">base</a>, <a href="examples/output/groovy.async-profiler.cpu.current.collapsed.md">current</a>, <a href="examples/output/groovy.async-profiler.cpu.diff.collapsed.md">diff</a>)</li><li>Java async-profiler CPU (<a href="examples/output/java.async-profiler.cpu.base.collapsed.md">base</a>, <a href="examples/output/java.async-profiler.cpu.current.collapsed.md">current</a>, <a href="examples/output/java.async-profiler.cpu.diff.collapsed.md">diff</a>)</li><li>Kotlin async-profiler CPU (<a href="examples/output/kotlin.async-profiler.cpu.base.collapsed.md">base</a>, <a href="examples/output/kotlin.async-profiler.cpu.current.collapsed.md">current</a>, <a href="examples/output/kotlin.async-profiler.cpu.diff.collapsed.md">diff</a>)</li></ul></details>
|
|
331
|
+
<details><summary><a href="docs/formats/hprof.md">HPROF</a></summary><ul><li>Java JDK (<a href="examples/output/java.jdk.base.hprof.md">base</a>, <a href="examples/output/java.jdk.current.hprof.md">current</a>, <a href="examples/output/java.jdk.diff.hprof.md">diff</a>)</li></ul></details>
|
|
332
|
+
<details><summary><a href="docs/formats/jfr.md">JFR</a></summary><ul><li>Groovy async-profiler all (<a href="examples/output/groovy.async-profiler.all.base.jfr.md">base</a>, <a href="examples/output/groovy.async-profiler.all.current.jfr.md">current</a>, <a href="examples/output/groovy.async-profiler.all.diff.jfr.md">diff</a>)</li><li>Groovy async-profiler alloc (<a href="examples/output/groovy.async-profiler.alloc.base.jfr.md">base</a>, <a href="examples/output/groovy.async-profiler.alloc.current.jfr.md">current</a>, <a href="examples/output/groovy.async-profiler.alloc.diff.jfr.md">diff</a>)</li><li>Groovy async-profiler CPU (<a href="examples/output/groovy.async-profiler.cpu.base.jfr.md">base</a>, <a href="examples/output/groovy.async-profiler.cpu.current.jfr.md">current</a>, <a href="examples/output/groovy.async-profiler.cpu.diff.jfr.md">diff</a>)</li><li>Groovy async-profiler live (<a href="examples/output/groovy.async-profiler.live.base.jfr.md">base</a>, <a href="examples/output/groovy.async-profiler.live.current.jfr.md">current</a>, <a href="examples/output/groovy.async-profiler.live.diff.jfr.md">diff</a>)</li><li>Groovy async-profiler lock (<a href="examples/output/groovy.async-profiler.lock.base.jfr.md">base</a>, <a href="examples/output/groovy.async-profiler.lock.current.jfr.md">current</a>, <a href="examples/output/groovy.async-profiler.lock.diff.jfr.md">diff</a>)</li><li>Groovy async-profiler nativemem (<a href="examples/output/groovy.async-profiler.nativemem.base.jfr.md">base</a>, <a href="examples/output/groovy.async-profiler.nativemem.current.jfr.md">current</a>, <a href="examples/output/groovy.async-profiler.nativemem.diff.jfr.md">diff</a>)</li><li>Groovy async-profiler wall (<a href="examples/output/groovy.async-profiler.wall.base.jfr.md">base</a>, <a href="examples/output/groovy.async-profiler.wall.current.jfr.md">current</a>, <a href="examples/output/groovy.async-profiler.wall.diff.jfr.md">diff</a>)</li><li>Groovy JDK all (<a href="examples/output/groovy.jdk.all.base.jfr.md">base</a>, <a href="examples/output/groovy.jdk.all.current.jfr.md">current</a>, <a href="examples/output/groovy.jdk.all.diff.jfr.md">diff</a>)</li><li>Groovy JDK alloc (<a href="examples/output/groovy.jdk.alloc.base.jfr.md">base</a>, <a href="examples/output/groovy.jdk.alloc.current.jfr.md">current</a>, <a href="examples/output/groovy.jdk.alloc.diff.jfr.md">diff</a>)</li><li>Groovy JDK CPU (<a href="examples/output/groovy.jdk.cpu.base.jfr.md">base</a>, <a href="examples/output/groovy.jdk.cpu.current.jfr.md">current</a>, <a href="examples/output/groovy.jdk.cpu.diff.jfr.md">diff</a>)</li><li>Groovy JDK live (<a href="examples/output/groovy.jdk.live.base.jfr.md">base</a>, <a href="examples/output/groovy.jdk.live.current.jfr.md">current</a>, <a href="examples/output/groovy.jdk.live.diff.jfr.md">diff</a>)</li><li>Groovy JDK lock (<a href="examples/output/groovy.jdk.lock.base.jfr.md">base</a>, <a href="examples/output/groovy.jdk.lock.current.jfr.md">current</a>, <a href="examples/output/groovy.jdk.lock.diff.jfr.md">diff</a>)</li><li>Java async-profiler all (<a href="examples/output/java.async-profiler.all.base.jfr.md">base</a>, <a href="examples/output/java.async-profiler.all.current.jfr.md">current</a>, <a href="examples/output/java.async-profiler.all.diff.jfr.md">diff</a>)</li><li>Java async-profiler alloc (<a href="examples/output/java.async-profiler.alloc.base.jfr.md">base</a>, <a href="examples/output/java.async-profiler.alloc.current.jfr.md">current</a>, <a href="examples/output/java.async-profiler.alloc.diff.jfr.md">diff</a>)</li><li>Java async-profiler CPU (<a href="examples/output/java.async-profiler.cpu.base.jfr.md">base</a>, <a href="examples/output/java.async-profiler.cpu.current.jfr.md">current</a>, <a href="examples/output/java.async-profiler.cpu.diff.jfr.md">diff</a>)</li><li>Java async-profiler live (<a href="examples/output/java.async-profiler.live.base.jfr.md">base</a>, <a href="examples/output/java.async-profiler.live.current.jfr.md">current</a>, <a href="examples/output/java.async-profiler.live.diff.jfr.md">diff</a>)</li><li>Java async-profiler lock (<a href="examples/output/java.async-profiler.lock.base.jfr.md">base</a>, <a href="examples/output/java.async-profiler.lock.current.jfr.md">current</a>, <a href="examples/output/java.async-profiler.lock.diff.jfr.md">diff</a>)</li><li>Java async-profiler nativemem (<a href="examples/output/java.async-profiler.nativemem.base.jfr.md">base</a>, <a href="examples/output/java.async-profiler.nativemem.current.jfr.md">current</a>, <a href="examples/output/java.async-profiler.nativemem.diff.jfr.md">diff</a>)</li><li>Java async-profiler wall (<a href="examples/output/java.async-profiler.wall.base.jfr.md">base</a>, <a href="examples/output/java.async-profiler.wall.current.jfr.md">current</a>, <a href="examples/output/java.async-profiler.wall.diff.jfr.md">diff</a>)</li><li>Java JDK all (<a href="examples/output/java.jdk.all.base.jfr.md">base</a>, <a href="examples/output/java.jdk.all.current.jfr.md">current</a>, <a href="examples/output/java.jdk.all.diff.jfr.md">diff</a>)</li><li>Java JDK alloc (<a href="examples/output/java.jdk.alloc.base.jfr.md">base</a>, <a href="examples/output/java.jdk.alloc.current.jfr.md">current</a>, <a href="examples/output/java.jdk.alloc.diff.jfr.md">diff</a>)</li><li>Java JDK CPU (<a href="examples/output/java.jdk.cpu.base.jfr.md">base</a>, <a href="examples/output/java.jdk.cpu.current.jfr.md">current</a>, <a href="examples/output/java.jdk.cpu.diff.jfr.md">diff</a>)</li><li>Java JDK live (<a href="examples/output/java.jdk.live.base.jfr.md">base</a>, <a href="examples/output/java.jdk.live.current.jfr.md">current</a>, <a href="examples/output/java.jdk.live.diff.jfr.md">diff</a>)</li><li>Java JDK lock (<a href="examples/output/java.jdk.lock.base.jfr.md">base</a>, <a href="examples/output/java.jdk.lock.current.jfr.md">current</a>, <a href="examples/output/java.jdk.lock.diff.jfr.md">diff</a>)</li><li>Kotlin async-profiler all (<a href="examples/output/kotlin.async-profiler.all.base.jfr.md">base</a>, <a href="examples/output/kotlin.async-profiler.all.current.jfr.md">current</a>, <a href="examples/output/kotlin.async-profiler.all.diff.jfr.md">diff</a>)</li><li>Kotlin async-profiler alloc (<a href="examples/output/kotlin.async-profiler.alloc.base.jfr.md">base</a>, <a href="examples/output/kotlin.async-profiler.alloc.current.jfr.md">current</a>, <a href="examples/output/kotlin.async-profiler.alloc.diff.jfr.md">diff</a>)</li><li>Kotlin async-profiler CPU (<a href="examples/output/kotlin.async-profiler.cpu.base.jfr.md">base</a>, <a href="examples/output/kotlin.async-profiler.cpu.current.jfr.md">current</a>, <a href="examples/output/kotlin.async-profiler.cpu.diff.jfr.md">diff</a>)</li><li>Kotlin async-profiler live (<a href="examples/output/kotlin.async-profiler.live.base.jfr.md">base</a>, <a href="examples/output/kotlin.async-profiler.live.current.jfr.md">current</a>, <a href="examples/output/kotlin.async-profiler.live.diff.jfr.md">diff</a>)</li><li>Kotlin async-profiler lock (<a href="examples/output/kotlin.async-profiler.lock.base.jfr.md">base</a>, <a href="examples/output/kotlin.async-profiler.lock.current.jfr.md">current</a>, <a href="examples/output/kotlin.async-profiler.lock.diff.jfr.md">diff</a>)</li><li>Kotlin async-profiler nativemem (<a href="examples/output/kotlin.async-profiler.nativemem.base.jfr.md">base</a>, <a href="examples/output/kotlin.async-profiler.nativemem.current.jfr.md">current</a>, <a href="examples/output/kotlin.async-profiler.nativemem.diff.jfr.md">diff</a>)</li><li>Kotlin async-profiler wall (<a href="examples/output/kotlin.async-profiler.wall.base.jfr.md">base</a>, <a href="examples/output/kotlin.async-profiler.wall.current.jfr.md">current</a>, <a href="examples/output/kotlin.async-profiler.wall.diff.jfr.md">diff</a>)</li><li>Kotlin JDK all (<a href="examples/output/kotlin.jdk.all.base.jfr.md">base</a>, <a href="examples/output/kotlin.jdk.all.current.jfr.md">current</a>, <a href="examples/output/kotlin.jdk.all.diff.jfr.md">diff</a>)</li><li>Kotlin JDK alloc (<a href="examples/output/kotlin.jdk.alloc.base.jfr.md">base</a>, <a href="examples/output/kotlin.jdk.alloc.current.jfr.md">current</a>, <a href="examples/output/kotlin.jdk.alloc.diff.jfr.md">diff</a>)</li><li>Kotlin JDK CPU (<a href="examples/output/kotlin.jdk.cpu.base.jfr.md">base</a>, <a href="examples/output/kotlin.jdk.cpu.current.jfr.md">current</a>, <a href="examples/output/kotlin.jdk.cpu.diff.jfr.md">diff</a>)</li><li>Kotlin JDK live (<a href="examples/output/kotlin.jdk.live.base.jfr.md">base</a>, <a href="examples/output/kotlin.jdk.live.current.jfr.md">current</a>, <a href="examples/output/kotlin.jdk.live.diff.jfr.md">diff</a>)</li><li>Kotlin JDK lock (<a href="examples/output/kotlin.jdk.lock.base.jfr.md">base</a>, <a href="examples/output/kotlin.jdk.lock.current.jfr.md">current</a>, <a href="examples/output/kotlin.jdk.lock.diff.jfr.md">diff</a>)</li></ul></details>
|
|
333
|
+
</td>
|
|
334
|
+
</tr>
|
|
335
|
+
<tr>
|
|
336
|
+
<td><a href="docs/languages/javascript.md">JavaScript/TypeScript</a></td>
|
|
337
|
+
<td>
|
|
338
|
+
<details><summary><a href="docs/formats/jsc-heap-snapshot.md">JSC heap snapshot</a></summary><ul><li>JavaScript Bun (<a href="examples/output/javascript.bun.base.jsc-heap-snapshot.json.md">base</a>, <a href="examples/output/javascript.bun.current.jsc-heap-snapshot.json.md">current</a>, <a href="examples/output/javascript.bun.diff.jsc-heap-snapshot.json.md">diff</a>)</li><li>JavaScript Safari (<a href="examples/output/javascript.safari.base.jsc-heap-snapshot.json.md">base</a>, <a href="examples/output/javascript.safari.current.jsc-heap-snapshot.json.md">current</a>, <a href="examples/output/javascript.safari.diff.jsc-heap-snapshot.json.md">diff</a>)</li></ul></details>
|
|
339
|
+
<details><summary><a href="docs/formats/pprof.md">pprof</a></summary><ul><li>JavaScript node-pprof CPU (<a href="examples/output/javascript.node-pprof.cpu.base.pprof.md">base</a>, <a href="examples/output/javascript.node-pprof.cpu.current.pprof.md">current</a>, <a href="examples/output/javascript.node-pprof.cpu.diff.pprof.md">diff</a>)</li><li>JavaScript node-pprof heap (<a href="examples/output/javascript.node-pprof.heap.base.pprof.md">base</a>, <a href="examples/output/javascript.node-pprof.heap.current.pprof.md">current</a>, <a href="examples/output/javascript.node-pprof.heap.diff.pprof.md">diff</a>)</li></ul></details>
|
|
340
|
+
<details><summary><a href="docs/formats/v8-cpu-profile.md">V8 CPU profile</a></summary><ul><li>JavaScript Bun (<a href="examples/output/javascript.bun.base.cpuprofile.md">base</a>, <a href="examples/output/javascript.bun.current.cpuprofile.md">current</a>, <a href="examples/output/javascript.bun.diff.cpuprofile.md">diff</a>)</li><li>JavaScript Chrome (<a href="examples/output/javascript.chrome.base.cpuprofile.md">base</a>, <a href="examples/output/javascript.chrome.current.cpuprofile.md">current</a>, <a href="examples/output/javascript.chrome.diff.cpuprofile.md">diff</a>)</li><li>JavaScript Deno (<a href="examples/output/javascript.deno.base.cpuprofile.md">base</a>, <a href="examples/output/javascript.deno.current.cpuprofile.md">current</a>, <a href="examples/output/javascript.deno.diff.cpuprofile.md">diff</a>)</li><li>JavaScript Node.js (<a href="examples/output/javascript.node.base.cpuprofile.md">base</a>, <a href="examples/output/javascript.node.current.cpuprofile.md">current</a>, <a href="examples/output/javascript.node.diff.cpuprofile.md">diff</a>)</li></ul></details>
|
|
341
|
+
<details><summary><a href="docs/formats/v8-heap-profile.md">V8 heap profile</a></summary><ul><li>JavaScript Chrome (<a href="examples/output/javascript.chrome.base.heapprofile.md">base</a>, <a href="examples/output/javascript.chrome.current.heapprofile.md">current</a>, <a href="examples/output/javascript.chrome.diff.heapprofile.md">diff</a>)</li><li>JavaScript Node.js (<a href="examples/output/javascript.node.base.heapprofile.md">base</a>, <a href="examples/output/javascript.node.current.heapprofile.md">current</a>, <a href="examples/output/javascript.node.diff.heapprofile.md">diff</a>)</li></ul></details>
|
|
342
|
+
<details><summary><a href="docs/formats/v8-heap-snapshot.md">V8 heap snapshot</a></summary><ul><li>JavaScript Bun (<a href="examples/output/javascript.bun.base.heapsnapshot.md">base</a>, <a href="examples/output/javascript.bun.current.heapsnapshot.md">current</a>, <a href="examples/output/javascript.bun.diff.heapsnapshot.md">diff</a>)</li><li>JavaScript Chrome (<a href="examples/output/javascript.chrome.base.heapsnapshot.md">base</a>, <a href="examples/output/javascript.chrome.current.heapsnapshot.md">current</a>, <a href="examples/output/javascript.chrome.diff.heapsnapshot.md">diff</a>)</li><li>JavaScript Node.js (<a href="examples/output/javascript.node.base.heapsnapshot.md">base</a>, <a href="examples/output/javascript.node.current.heapsnapshot.md">current</a>, <a href="examples/output/javascript.node.diff.heapsnapshot.md">diff</a>)</li></ul></details>
|
|
343
|
+
<details><summary><a href="docs/formats/webkit-timeline-recording.md">WebKit timeline recording</a></summary><ul><li>JavaScript Safari (<a href="examples/output/javascript.safari.base.webkit-timeline-recording.json.md">base</a>, <a href="examples/output/javascript.safari.current.webkit-timeline-recording.json.md">current</a>, <a href="examples/output/javascript.safari.diff.webkit-timeline-recording.json.md">diff</a>)</li></ul></details>
|
|
100
344
|
</td>
|
|
101
345
|
</tr>
|
|
102
346
|
<tr>
|
|
103
347
|
<td><a href="docs/languages/julia.md">Julia</a></td>
|
|
104
348
|
<td>
|
|
105
|
-
<
|
|
349
|
+
<details><summary><a href="docs/formats/pprof.md">pprof</a></summary><ul><li>Julia pprof-jl alloc (<a href="examples/output/julia.pprof-jl.alloc.base.pprof.md">base</a>, <a href="examples/output/julia.pprof-jl.alloc.current.pprof.md">current</a>, <a href="examples/output/julia.pprof-jl.alloc.diff.pprof.md">diff</a>)</li><li>Julia pprof-jl CPU (<a href="examples/output/julia.pprof-jl.cpu.base.pprof.md">base</a>, <a href="examples/output/julia.pprof-jl.cpu.current.pprof.md">current</a>, <a href="examples/output/julia.pprof-jl.cpu.diff.pprof.md">diff</a>)</li><li>Julia pprof-jl wall (<a href="examples/output/julia.pprof-jl.wall.base.pprof.md">base</a>, <a href="examples/output/julia.pprof-jl.wall.current.pprof.md">current</a>, <a href="examples/output/julia.pprof-jl.wall.diff.pprof.md">diff</a>)</li></ul></details>
|
|
350
|
+
<details><summary><a href="docs/formats/v8-heap-snapshot.md">V8 heap snapshot</a></summary><ul><li>Julia Profile (<a href="examples/output/julia.profile-jl.base.heapsnapshot.md">base</a>, <a href="examples/output/julia.profile-jl.current.heapsnapshot.md">current</a>, <a href="examples/output/julia.profile-jl.diff.heapsnapshot.md">diff</a>)</li></ul></details>
|
|
106
351
|
</td>
|
|
107
352
|
</tr>
|
|
108
353
|
<tr>
|
|
109
354
|
<td><a href="docs/languages/php.md">PHP</a></td>
|
|
110
355
|
<td>
|
|
111
|
-
<
|
|
356
|
+
<details><summary><a href="docs/formats/speedscope.md">Speedscope</a></summary><ul><li>PHP Excimer wall (<a href="examples/output/php.excimer.wall.base.speedscope.json.md">base</a>, <a href="examples/output/php.excimer.wall.current.speedscope.json.md">current</a>, <a href="examples/output/php.excimer.wall.diff.speedscope.json.md">diff</a>)</li></ul></details>
|
|
112
357
|
</td>
|
|
113
358
|
</tr>
|
|
114
359
|
<tr>
|
|
115
360
|
<td><a href="docs/languages/python.md">Python</a></td>
|
|
116
361
|
<td>
|
|
117
|
-
<
|
|
118
|
-
<
|
|
362
|
+
<details><summary><a href="docs/formats/collapsed.md">Collapsed stacks</a></summary><ul><li>Python py-spy CPU (<a href="examples/output/python.py-spy.cpu.base.collapsed.md">base</a>, <a href="examples/output/python.py-spy.cpu.current.collapsed.md">current</a>, <a href="examples/output/python.py-spy.cpu.diff.collapsed.md">diff</a>)</li><li>Python py-spy wall (<a href="examples/output/python.py-spy.wall.base.collapsed.md">base</a>, <a href="examples/output/python.py-spy.wall.current.collapsed.md">current</a>, <a href="examples/output/python.py-spy.wall.diff.collapsed.md">diff</a>)</li></ul></details>
|
|
363
|
+
<details><summary><a href="docs/formats/memray.md">memray</a></summary><ul><li>Python memray (<a href="examples/output/python.memray.base.memray.bin.md">base</a>, <a href="examples/output/python.memray.current.memray.bin.md">current</a>, <a href="examples/output/python.memray.diff.memray.bin.md">diff</a>)</li><li>Python memray aggregated (<a href="examples/output/python.memray.aggregated.base.memray.bin.md">base</a>, <a href="examples/output/python.memray.aggregated.current.memray.bin.md">current</a>, <a href="examples/output/python.memray.aggregated.diff.memray.bin.md">diff</a>)</li><li>Python memray v13 (<a href="examples/output/python.memray.v13.base.memray.bin.md">base</a>, <a href="examples/output/python.memray.v13.current.memray.bin.md">current</a>, <a href="examples/output/python.memray.v13.diff.memray.bin.md">diff</a>)</li></ul></details>
|
|
364
|
+
<details><summary><a href="docs/formats/speedscope.md">Speedscope</a></summary><ul><li>Python py-spy CPU (<a href="examples/output/python.py-spy.cpu.base.speedscope.json.md">base</a>, <a href="examples/output/python.py-spy.cpu.current.speedscope.json.md">current</a>, <a href="examples/output/python.py-spy.cpu.diff.speedscope.json.md">diff</a>)</li><li>Python pyinstrument (<a href="examples/output/python.pyinstrument.base.speedscope.json.md">base</a>, <a href="examples/output/python.pyinstrument.current.speedscope.json.md">current</a>, <a href="examples/output/python.pyinstrument.diff.speedscope.json.md">diff</a>)</li></ul></details>
|
|
365
|
+
<div><a href="docs/formats/systing.md">systing</a></div>
|
|
119
366
|
</td>
|
|
120
367
|
</tr>
|
|
121
368
|
<tr>
|
|
122
369
|
<td><a href="docs/languages/ruby.md">Ruby</a></td>
|
|
123
370
|
<td>
|
|
124
|
-
<
|
|
125
|
-
<
|
|
126
|
-
<
|
|
371
|
+
<details><summary><a href="docs/formats/callgrind.md">Callgrind</a></summary><ul><li>Ruby rbspy CPU (<a href="examples/output/ruby.rbspy.cpu.base.callgrind.md">base</a>, <a href="examples/output/ruby.rbspy.cpu.current.callgrind.md">current</a>, <a href="examples/output/ruby.rbspy.cpu.diff.callgrind.md">diff</a>)</li></ul></details>
|
|
372
|
+
<details><summary><a href="docs/formats/collapsed.md">Collapsed stacks</a></summary><ul><li>Ruby rbspy CPU (<a href="examples/output/ruby.rbspy.cpu.base.collapsed.md">base</a>, <a href="examples/output/ruby.rbspy.cpu.current.collapsed.md">current</a>, <a href="examples/output/ruby.rbspy.cpu.diff.collapsed.md">diff</a>)</li></ul></details>
|
|
373
|
+
<details><summary><a href="docs/formats/pprof.md">pprof</a></summary><ul><li>Ruby rbspy CPU (<a href="examples/output/ruby.rbspy.cpu.base.pprof.md">base</a>, <a href="examples/output/ruby.rbspy.cpu.current.pprof.md">current</a>, <a href="examples/output/ruby.rbspy.cpu.diff.pprof.md">diff</a>)</li></ul></details>
|
|
374
|
+
<details><summary><a href="docs/formats/speedscope.md">Speedscope</a></summary><ul><li>Ruby rbspy CPU (<a href="examples/output/ruby.rbspy.cpu.base.speedscope.json.md">base</a>, <a href="examples/output/ruby.rbspy.cpu.current.speedscope.json.md">current</a>, <a href="examples/output/ruby.rbspy.cpu.diff.speedscope.json.md">diff</a>)</li></ul></details>
|
|
127
375
|
</td>
|
|
128
376
|
</tr>
|
|
129
377
|
<tr>
|
|
130
378
|
<td><a href="docs/languages/rust.md">Rust</a></td>
|
|
131
379
|
<td>
|
|
132
|
-
<
|
|
380
|
+
<details><summary><a href="docs/formats/pprof.md">pprof</a></summary><ul><li>Rust pprof-rs CPU (<a href="examples/output/rust.pprof-rs.cpu.base.pprof.md">base</a>, <a href="examples/output/rust.pprof-rs.cpu.current.pprof.md">current</a>, <a href="examples/output/rust.pprof-rs.cpu.diff.pprof.md">diff</a>)</li></ul></details>
|
|
381
|
+
<div><a href="docs/formats/systing.md">systing</a></div>
|
|
382
|
+
</td>
|
|
383
|
+
</tr>
|
|
384
|
+
<tr>
|
|
385
|
+
<td><a href="docs/languages/swift.md">Swift</a></td>
|
|
386
|
+
<td>
|
|
387
|
+
<details><summary><a href="docs/formats/pprof.md">pprof</a></summary><ul><li>Swift gperftools CPU (<a href="examples/output/swift.gperftools.cpu.base.pprof.md">base</a>, <a href="examples/output/swift.gperftools.cpu.current.pprof.md">current</a>, <a href="examples/output/swift.gperftools.cpu.diff.pprof.md">diff</a>)</li><li>Swift gperftools heap (<a href="examples/output/swift.gperftools.heap.base.pprof.md">base</a>, <a href="examples/output/swift.gperftools.heap.current.pprof.md">current</a>, <a href="examples/output/swift.gperftools.heap.diff.pprof.md">diff</a>)</li></ul></details>
|
|
388
|
+
</td>
|
|
389
|
+
</tr>
|
|
390
|
+
<tr>
|
|
391
|
+
<td><a href="docs/languages/zig.md">Zig</a></td>
|
|
392
|
+
<td>
|
|
393
|
+
<details><summary><a href="docs/formats/perf.md">perf.data</a></summary><ul><li>Zig perf CPU (<a href="examples/output/zig.perf.cpu.base.perf.data.md">base</a>, <a href="examples/output/zig.perf.cpu.current.perf.data.md">current</a>, <a href="examples/output/zig.perf.cpu.diff.perf.data.md">diff</a>)</li></ul></details>
|
|
394
|
+
<details><summary><a href="docs/formats/pprof.md">pprof</a></summary><ul><li>Zig gperftools CPU (<a href="examples/output/zig.gperftools.cpu.base.pprof.md">base</a>, <a href="examples/output/zig.gperftools.cpu.current.pprof.md">current</a>, <a href="examples/output/zig.gperftools.cpu.diff.pprof.md">diff</a>)</li><li>Zig gperftools heap (<a href="examples/output/zig.gperftools.heap.base.pprof.md">base</a>, <a href="examples/output/zig.gperftools.heap.current.pprof.md">current</a>, <a href="examples/output/zig.gperftools.heap.diff.pprof.md">diff</a>)</li></ul></details>
|
|
133
395
|
</td>
|
|
134
396
|
</tr>
|
|
135
397
|
</tbody>
|
|
@@ -139,210 +401,12 @@ it. Third-party tools can often convert others, though.
|
|
|
139
401
|
|
|
140
402
|
<!-- prettier-ignore-end -->
|
|
141
403
|
|
|
142
|
-
## Install
|
|
143
|
-
|
|
144
|
-
```sh
|
|
145
|
-
$ npm i -g profiler-md
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
## Usage
|
|
149
|
-
|
|
150
|
-
### CLI
|
|
151
|
-
|
|
152
|
-
<!-- prettier-ignore-start -->
|
|
153
|
-
|
|
154
|
-
<!-- CLI_HELP START -->
|
|
155
|
-
|
|
156
|
-
```sh
|
|
157
|
-
$ profiler-md --help
|
|
158
|
-
Usage: profiler-md [(-h/--help [TOPIC])] [-f/--format FORMAT] [-r/--origin
|
|
159
|
-
ORIGIN] [-o/--output FILE] [--top-n N] [--base-url STRING] [--source-maps
|
|
160
|
-
GLOB...] [--match REGEX=REPLACEMENT...] [--third-party GLOB...] [
|
|
161
|
-
--no-pager] [(--color | --no-color)] ([FILE] | BASE CURRENT)
|
|
162
|
-
|
|
163
|
-
Converts performance profiles to human and LLM friendly Markdown.
|
|
164
|
-
|
|
165
|
-
-h, --help [TOPIC] Show this help message or topic docs
|
|
166
|
-
-f, --format FORMAT Input profile format (default: auto)
|
|
167
|
-
-r, --origin ORIGIN Input profile origin (default: auto)
|
|
168
|
-
-o, --output FILE Output file (default: - for stdout)
|
|
169
|
-
--top-n N Number of top entries to show (default: 20)
|
|
170
|
-
--base-url STRING Base URL or path to show paths relative to
|
|
171
|
-
(default: cwd)
|
|
172
|
-
--source-maps GLOB Source maps (JSON or inline) to apply to profile
|
|
173
|
-
locations (repeatable)
|
|
174
|
-
--match REGEX=REPLACEMENT Treat locations matching REGEX as REPLACEMENT
|
|
175
|
-
when matching entries across diffed profiles
|
|
176
|
-
(repeatable)
|
|
177
|
-
--third-party GLOB Additional URLs or paths to consider third-party
|
|
178
|
-
(repeatable)
|
|
179
|
-
--no-pager Disable stdout output paging (default: auto)
|
|
180
|
-
--color Enable or disable ANSI syntax highlighting
|
|
181
|
-
(default: auto)
|
|
182
|
-
--no-color
|
|
183
|
-
FILE Profile to convert (reads from stdin if omitted)
|
|
184
|
-
BASE Base profile to diff
|
|
185
|
-
CURRENT Current profile to diff against the base
|
|
186
|
-
|
|
187
|
-
Formats: collapsed, jfr, jsc-heap-snapshot, pprof, speedscope, v8-cpu-profile, v8-heap-profile, v8-heap-snapshot, webkit-timeline-recording
|
|
188
|
-
Origins: beam, bun, deno, dotnet-trace, go, jvm, node, node-pprof, pprof-jl, pprof-rs, py-spy, rbspy, safari, tachyon, unknown
|
|
189
|
-
Languages: c, cpp, csharp, fsharp, elixir, erlang, go, java, kotlin, javascript, typescript, julia, php, python, ruby, rust
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
<!-- CLI_HELP END -->
|
|
193
|
-
|
|
194
|
-
<!-- prettier-ignore-end -->
|
|
195
|
-
|
|
196
|
-
### API
|
|
197
|
-
|
|
198
|
-
```js
|
|
199
|
-
import { openAsBlob, readFileSync } from 'node:fs'
|
|
200
|
-
import {
|
|
201
|
-
defaultCategorizeEntries,
|
|
202
|
-
defaultMatchEntry,
|
|
203
|
-
defaultShowEntry,
|
|
204
|
-
diffProfiles,
|
|
205
|
-
diffProfilesAsync,
|
|
206
|
-
profileToMd,
|
|
207
|
-
profileToMdAsync,
|
|
208
|
-
} from 'profiler-md'
|
|
209
|
-
|
|
210
|
-
// Auto-detect format and origin (async)
|
|
211
|
-
console.log(await profileToMdAsync(await openAsBlob(`example.cpuprofile`)))
|
|
212
|
-
console.log(await profileToMdAsync(await openAsBlob(`example.pprof`)))
|
|
213
|
-
|
|
214
|
-
// Explicit format
|
|
215
|
-
console.log(
|
|
216
|
-
await profileToMdAsync({
|
|
217
|
-
data: await openAsBlob(`example.pprof`),
|
|
218
|
-
format: `pprof`,
|
|
219
|
-
}),
|
|
220
|
-
)
|
|
221
|
-
// Explicit origin
|
|
222
|
-
console.log(
|
|
223
|
-
await profileToMdAsync({
|
|
224
|
-
data: await openAsBlob(`example.cpuprofile`),
|
|
225
|
-
origin: `deno`,
|
|
226
|
-
}),
|
|
227
|
-
)
|
|
228
|
-
|
|
229
|
-
// Synchronous usage (auto-detect)
|
|
230
|
-
console.log(profileToMd(readFileSync(`example.cpuprofile`, `utf8`)))
|
|
231
|
-
console.log(profileToMd(readFileSync(`example.pprof`)))
|
|
232
|
-
|
|
233
|
-
// Synchronous usage with explicit format and origin
|
|
234
|
-
console.log(
|
|
235
|
-
profileToMd({
|
|
236
|
-
data: readFileSync(`example.pprof`),
|
|
237
|
-
format: `pprof`,
|
|
238
|
-
origin: `node-pprof`,
|
|
239
|
-
}),
|
|
240
|
-
)
|
|
241
|
-
|
|
242
|
-
// Diff two profiles or two heap snapshots (async, auto-detect)
|
|
243
|
-
console.log(
|
|
244
|
-
await diffProfilesAsync(
|
|
245
|
-
await openAsBlob(`base.cpuprofile`),
|
|
246
|
-
await openAsBlob(`current.cpuprofile`),
|
|
247
|
-
),
|
|
248
|
-
)
|
|
249
|
-
console.log(
|
|
250
|
-
await diffProfilesAsync(
|
|
251
|
-
await openAsBlob(`base.heapsnapshot`),
|
|
252
|
-
await openAsBlob(`current.heapsnapshot`),
|
|
253
|
-
),
|
|
254
|
-
)
|
|
255
|
-
|
|
256
|
-
// Synchronous diff with explicit format
|
|
257
|
-
console.log(
|
|
258
|
-
diffProfiles(
|
|
259
|
-
{ data: readFileSync(`base.pprof`), format: `pprof` },
|
|
260
|
-
{ data: readFileSync(`current.pprof`), format: `pprof` },
|
|
261
|
-
),
|
|
262
|
-
)
|
|
263
|
-
|
|
264
|
-
// Complex usage
|
|
265
|
-
const options = {
|
|
266
|
-
// Show top 10 functions instead of the default 20.
|
|
267
|
-
topN: 10,
|
|
268
|
-
// Make paths relative to a custom base URL or directory.
|
|
269
|
-
baseURL: `/path/to/project`,
|
|
270
|
-
matchEntry: entry => {
|
|
271
|
-
if (entry.location?.url.pathname.includes(`/bundle.`)) {
|
|
272
|
-
// Match bundled entries when diffing by name only, ignoring
|
|
273
|
-
// content-hashed filenames.
|
|
274
|
-
return { name: entry.name }
|
|
275
|
-
}
|
|
276
|
-
return defaultMatchEntry(entry)
|
|
277
|
-
},
|
|
278
|
-
categorizeEntries: (entries, context) => {
|
|
279
|
-
const categories = defaultCategorizeEntries(entries, context)
|
|
280
|
-
return entries.map((entry, index) =>
|
|
281
|
-
// Treat an additional vendor directory as third-party.
|
|
282
|
-
entry.location?.url?.pathname.includes(`/vendor/`)
|
|
283
|
-
? `third-party`
|
|
284
|
-
: categories[index],
|
|
285
|
-
)
|
|
286
|
-
},
|
|
287
|
-
showEntry: entry =>
|
|
288
|
-
defaultShowEntry(entry) &&
|
|
289
|
-
// Exclude entries from a specific file.
|
|
290
|
-
!entry.location?.includes(`/path/to/project/src/noisy`),
|
|
291
|
-
}
|
|
292
|
-
console.log(await profileToMdAsync(await openAsBlob(`example.pprof`), options))
|
|
293
|
-
console.log(
|
|
294
|
-
await profileToMdAsync(await openAsBlob(`example.cpuprofile`), options),
|
|
295
|
-
)
|
|
296
|
-
|
|
297
|
-
// The same options also apply to diffs. `matchEntry` only takes effect here,
|
|
298
|
-
// where it controls which entries are considered the same across the two sides.
|
|
299
|
-
console.log(
|
|
300
|
-
await diffProfilesAsync(
|
|
301
|
-
await openAsBlob(`base.pprof`),
|
|
302
|
-
await openAsBlob(`current.pprof`),
|
|
303
|
-
options,
|
|
304
|
-
),
|
|
305
|
-
)
|
|
306
|
-
```
|
|
307
|
-
|
|
308
|
-
## Shell completions
|
|
309
|
-
|
|
310
|
-
```sh
|
|
311
|
-
# Bash (Linux)
|
|
312
|
-
$ profiler-md --completion bash > ~/.local/share/bash-completion/completions/profiler-md
|
|
313
|
-
|
|
314
|
-
# Bash (macOS/Homebrew)
|
|
315
|
-
$ profiler-md --completion bash > $(brew --prefix)/etc/bash_completion.d/profiler-md
|
|
316
|
-
|
|
317
|
-
# Fish
|
|
318
|
-
$ profiler-md --completion fish > ~/.config/fish/completions/profiler-md.fish
|
|
319
|
-
|
|
320
|
-
# Zsh
|
|
321
|
-
$ profiler-md --completion zsh > ~/.zfunc/_profiler-md
|
|
322
|
-
|
|
323
|
-
# PowerShell
|
|
324
|
-
$ profiler-md --completion pwsh >> $PROFILE.CurrentUserCurrentHost
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
## Skills
|
|
328
|
-
|
|
329
|
-
Use the [`profiler-md` skill](./skills/profile-optimize/SKILL.md) to have an
|
|
330
|
-
agent profile and optimize your code:
|
|
331
|
-
|
|
332
|
-
```sh
|
|
333
|
-
$ npx skills add TomerAberbach/profiler-md --skill profile-optimize
|
|
334
|
-
```
|
|
335
|
-
|
|
336
|
-
See [skills.sh](https://skills.sh/docs) for more info.
|
|
337
|
-
|
|
338
|
-
Fun fact: the skill has profiled and optimized `profiler-md` itself!
|
|
339
|
-
|
|
340
404
|
## Contributing
|
|
341
405
|
|
|
342
406
|
Stars are always welcome!
|
|
343
407
|
|
|
344
408
|
For bugs and feature requests,
|
|
345
|
-
[
|
|
409
|
+
[create an issue](https://github.com/TomerAberbach/profiler-md/issues/new).
|
|
346
410
|
|
|
347
411
|
## License
|
|
348
412
|
|