Skip to content

Add unified --profile flag with text and flamegraph output#642

Merged
stephenamar-db merged 1 commit intomasterfrom
stack/abc
Mar 6, 2026
Merged

Add unified --profile flag with text and flamegraph output#642
stephenamar-db merged 1 commit intomasterfrom
stack/abc

Conversation

@stephenamar-db
Copy link
Collaborator

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

  • sjsonnet.jvm[3.3.7].test passes (140/140)
  • sjsonnet.jvm[2.13.18].compile passes
  • sjsonnet.js[3.3.7].compile passes
  • Manual test: --profile /tmp/out.txt produces text profile
  • Manual test: --profile flamegraph:/tmp/out.txt produces filtered folded stack output

Replaces the --flamegraph flag with --profile <file> (text output,
default) or --profile flamegraph:<file> (folded stack format). Ports
the expression-level profiler from universe/jsonnet/profiler, which
measures self-time per expression via visitExpr instrumentation, and
merges it with the existing flamegraph stack recorder.

The text format shows top expressions by self-time, aggregated by
file and by expression type, with System.nanoTime overhead estimation.
The flamegraph format filters to Apply/ApplyBuiltin/comprehension
frames and includes filenames for non-builtin calls.

Deletes the old bench/ ProfilingEvaluator and RunProfiler which are
superseded by the new CLI-integrated profiler.
@stephenamar-db stephenamar-db merged commit 725f287 into master Mar 6, 2026
8 checks passed
@stephenamar-db stephenamar-db deleted the stack/abc branch March 6, 2026 05:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant