Create Flamegraph

This action merges time-trace files generated by Clang and generates a FlameGraph.

This is usually the next step in your workflow 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:

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.8.2
  with:
    source-dir: tests
    build-dir: tests/build
    github_token: ${{ secrets.GITHUB_TOKEN }}

Input Parameters

Parameter

Description

Default

source-dir

The source directory used to generate time-traces. Relative paths in the report will be relative to this directory.

.

build-dir

The directory with the time-traces. This should usually be your build directory.

.

output-path

The path where the combined traces will be stored.

If this is a relative path, it will be made relative to the build-dir.

combined-traces.json

report-path

The path where the report will be stored.

If this is a relative path, it will be made relative to the build-dir.

time-trace-report.md

generate-svg

Generate SVG file with the output.

true

generate-report

Generate a small report with ClangBuildAnalyzer.

true

update-summary

Update action summary with the SVG file.

true

github_token

An imgur client ID to upload the SVG flamegraph.

See https://api.imgur.com/.

upload-artifact

Upload combined traces as artifact.

true

trace-commands

Trace commands executed by the workflow.

false

Outputs

Output

Description

traces-path

The absolute path to combined traces.

svg-path

The absolute path to svg file.