Create Flamegraph
This action merges time-trace files generated by Clang and generates a FlameGraph.
This is usually the next step in your workflow if some Coverage factor is defined in the entry after building and testing your library with CMake Workflow.
To generate the files, build the project with Clang and the -ftime-trace flag.
For every object file, there will be a corresponding json file with details about build time.
Each file in the build-dir will be combined into a single output file that contains
all traces. The combined time-trace is used to generate a report and then converted to an image with
FlameGraph.
The combined time-trace files are uploaded to artifacts. It contains the svg file generated with FlameGraph, which you can open directly in the browser. It also contains a json file you can open with:
-
https://www.speedscope.app/ (https://github.com/jlfwong/speedscope), or
-
chrome://tracing/
A simple analysis is performed while combining the trace files and a report in markdown format is also generated. This report is saved to 'inputs.report-path' and also included with the artifacts.
Example
steps:
- name: FlameGraph
uses: alandefreitas/cpp-actions/flamegraph@v1
with:
source-dir: tests
build-dir: tests/build
github-token: ${{ secrets.GITHUB_TOKEN }}
Input Parameters
Parameter |
Description |
Default |
|
Trace commands executed by the workflow. |
|
|
The source directory used to generate time-traces. Relative paths in the report will be relative to the current working directory. |
|
|
The directory with the time-traces. This should usually be your The default value is the same as the source-dir, so all time-trace files will be scanned in all subdirectories of the source-dir. If this is a relative path, it will be made relative to the current working directory. |
|
|
The path where the combined traces will be stored. If this is a relative path, it will be made relative to the build-dir. |
|
|
The path where the report will be stored. If this is a relative path, it will be made relative to the build-dir. |
|
|
Generate an SVG file with the output. |
|
|
Generate a markdown report analyzing compilation times. The report includes: - Summary of time spent in each compilation phase (frontend, backend, parsing, instantiation) - Per-file breakdown showing which files take longest to compile - Symbol analysis showing which templates and functions are slowest to parse/instantiate. |
|
|
Update the GitHub Actions job summary with the time-trace report. When enabled, the compilation time analysis is displayed directly in the workflow run summary, making it easy to review without downloading artifacts. |
|
|
The GitHub token used to upload the artifacts. |
|
|
Upload combined traces and visualizations as a GitHub Actions artifact. The artifact includes: - combined-traces.json: Can be opened with speedscope.app or chrome://tracing - combined-traces.json.svg: Interactive SVG flamegraph viewable in browser - time-trace-report.md: Markdown report with compilation time analysis. |
|