Skip to content

Comments

feature: flamegraph flag to customize java profiling data collection#649

Open
harp-intel wants to merge 3 commits intomainfrom
flame-java-options
Open

feature: flamegraph flag to customize java profiling data collection#649
harp-intel wants to merge 3 commits intomainfrom
flame-java-options

Conversation

@harp-intel
Copy link
Contributor

This pull request adds support for selecting sample types (native, Java) and passing custom arguments to async-profiler when generating flamegraphs. It introduces new command-line flags, updates the validation and help text, and modifies the underlying script logic to respect these options. The output and rendering logic are also updated to reflect and display the new configuration.

Command-line interface enhancements:

  • Added --sample flag to specify sample types (native, java) and --asprof-args flag to pass custom arguments to async-profiler; both are validated and included in help text. [1] [2] [3] [4] [5] [6]

Script and data pipeline updates:

  • Updated the profiling script to conditionally collect native and/or Java stacks based on the sample_types parameter, and to pass custom asprof_arguments to async-profiler. [1] [2] [3] [4] [5] [6]

  • Extended the data pipeline to capture and propagate the new parameters (SampleTypes, AsprofArguments) through the table values and output. [1] [2] [3]

Rendering improvements:

  • Modified the HTML renderer to display the perf event and asprof arguments used for each flamegraph, improving clarity for users.

Other improvements:

  • Improved error handling and settings restoration in the profiling script for robustness. [1] [2]

These changes make the flamegraph command more flexible and informative, especially for environments profiling both native and Java workloads.

Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds flexibility to the flamegraph command by allowing users to select which sample types to collect (native, Java, or both) and to pass custom arguments to async-profiler. The changes introduce two new command-line flags (--sample and --asprof-args), update the underlying bash script to conditionally execute profiling based on sample type selection, and enhance the HTML output to display the profiling configuration used.

Changes:

  • Added --sample flag to select sample types (native, java) with validation, and --asprof-args flag to customize async-profiler arguments
  • Modified the flamegraph profiling script to conditionally collect native and/or Java stacks based on sample type selection, and to pass custom arguments to async-profiler
  • Enhanced HTML rendering to display both the perf event and async-profiler arguments used in the flamegraph collection

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.

File Description
cmd/flamegraph/flamegraph.go Adds new flags for sample types and asprof arguments with validation and help text
internal/script/scripts.go Updates flamegraph script to parse sample types, conditionally start profiling, and use custom asprof arguments
cmd/flamegraph/flamegraph_tables.go Adds extraction function for asprof arguments and removes warning about missing native stacks
cmd/flamegraph/flamegraph_renderers.go Enhances HTML rendering to display perf event and asprof arguments in flamegraph headers

harp-intel and others added 2 commits February 24, 2026 15:45
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
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