Commit 725f287
authored
Add unified --profile flag with text and flamegraph output (#642)
## Summary
- Replaces `--flamegraph <file>` with `--profile <file>` (text, default)
or `--profile flamegraph:<file>` (folded stack format for flame graphs)
- Ports the expression-level profiler from `universe/jsonnet/profiler`:
measures self-time per evaluated expression via `Evaluator.visitExpr`
instrumentation, with `System.nanoTime` overhead compensation
- Text output shows top 50 expressions by self-time, plus aggregations
by file name and expression type
- Flamegraph output filters to Apply/ApplyBuiltin/comprehension frames,
includes filenames for non-builtin calls
- Deletes old `bench/ProfilingEvaluator` and `bench/RunProfiler`,
superseded by the CLI-integrated profiler
## Test plan
- [x] `sjsonnet.jvm[3.3.7].test` passes (140/140)
- [x] `sjsonnet.jvm[2.13.18].compile` passes
- [x] `sjsonnet.js[3.3.7].compile` passes
- [x] Manual test: `--profile /tmp/out.txt` produces text profile
- [x] Manual test: `--profile flamegraph:/tmp/out.txt` produces filtered
folded stack output1 parent 8d68091 commit 725f287
7 files changed
Lines changed: 420 additions & 391 deletions
File tree
- bench/src/sjsonnet/bench
- sjsonnet
- src-jvm-native/sjsonnet
- src/sjsonnet
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
171 | | - | |
| 171 | + | |
172 | 172 | | |
173 | | - | |
| 173 | + | |
174 | 174 | | |
175 | | - | |
| 175 | + | |
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
173 | | - | |
| 173 | + | |
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
| |||
320 | 320 | | |
321 | 321 | | |
322 | 322 | | |
323 | | - | |
| 323 | + | |
324 | 324 | | |
325 | 325 | | |
326 | 326 | | |
| |||
349 | 349 | | |
350 | 350 | | |
351 | 351 | | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
352 | 363 | | |
353 | | - | |
| 364 | + | |
354 | 365 | | |
355 | 366 | | |
356 | 367 | | |
| |||
372 | 383 | | |
373 | 384 | | |
374 | 385 | | |
375 | | - | |
376 | | - | |
377 | | - | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
378 | 389 | | |
379 | 390 | | |
380 | 391 | | |
| |||
448 | 459 | | |
449 | 460 | | |
450 | 461 | | |
451 | | - | |
452 | | - | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
453 | 466 | | |
454 | 467 | | |
455 | 468 | | |
| |||
0 commit comments