Discrepancy between Inferno and flamegraph.pl CPI/IPC Output
- Dominant language
- Rust
- Stars
- 2.2k
- Forks
- 160
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
When generating a CPI/IPC flame graph using inferno, the output appears to be mismatch compared to the results from using Brendan Gregg's original flamegraph.pl script (https://www.brendangregg.com/blog/2014-10-31/cpi-flame-graphs.html), despite using the same input parameters.
This is output from Brendan's flamegraph.pl:
And this is from inferno's output:
**Re-creation steps:**
- using Brendan's flamegraph package:
However, with the same parameters, inferno appears giving incorrect results.
```
CONTROL_GROUP=$(systemctl show -p ControlGroup --value "${TARGET}" 2>/dev/null)
ARGS="-e cpu-cycles,instructions --call-graph dwarf,64000 -a -G $CONTROL_GROUP -- sleep $DURATION"
perf record -o "${PERF_DATA}" -z --debuginfod="${DEBUGINFOD}" ${ARGS}
perf script -i "${PERF_DATA}" 2>/dev/null > "${PERF_SCRIPT}"
/usr/local/flamegraph/stackcollapse-perf.pl --event-filter=instructions "${PERF_SCRIPT}" > "${PERF_STACKS_INSTR}"
/usr/local/flamegraph/stackcollapse-perf.pl --event-filter=cpu-cycles "${PERF_SCRIPT}" > "${PERF_STACKS_CYCLES}"
/usr/local/flamegraph/difffolded.pl "${PERF_STACKS_INSTR}" "${PERF_STACKS_CYCLES}" \
| /usr/local/flamegraph/flamegraph.pl --countname cycles \
--title "IPC Differential Flame Graph" \
--subtitle "Red: IPC < 1; White: IPC = 1; Blue: IPC > 1; color gradient show level; % scaled to TOTAL cycles" \
> "${FLAMEGRAPH_IPC_OUT}"
```
- using inferno package:
```
CONTROL_GROUP=$(systemctl show -p ControlGroup --value "${TARGET}" 2>/dev/null)
ARGS="-e cpu-cycles,instructions --call-graph dwarf,64000 -a -G $CONTROL_GROUP -- sleep $DURATION"
perf record -o "${PERF_DATA}" -z --debuginfod="${DEBUGINFOD}" ${ARGS}
perf script -i "${PERF_DATA}" 2>/dev/null > "${PERF_SCRIPT}"
/usr/bin/inferno-collapse-perf --event-filter=instructions "${PERF_SCRIPT}" > "${PERF_STACKS_INSTR}"
/usr/bin/inferno-collapse-perf --event-filter=cpu-cycles "${PERF_SCRIPT}" > "${PERF_STACKS_CYCLES}"
/usr/bin/inferno-diff-folded "${PERF_STACKS_INSTR}" "${PERF_STACKS_CYCLES}" \
| /usr/bin/inferno-flamegraph --countname cycles \
--title "IPC Differential Flame Graph" \
--subtitle "Red: IPC < 1; White: IPC = 1; Blue: IPC > 1; color gradient show level; % scaled to TOTAL cycles" \
> "${FLAMEGRAPH_IPC_OUT}"
```
inferno version: 0.12.1
flamgraph version: 2020.4.0
kernel: 6.12
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the supplied perf record and perf script commands, then compare inferno-collapse-perf and inferno-diff-folded with stackcollapse-perf.pl and difffolded.pl on the same input. Trace the first stage where outputs diverge; done means the discrepancy is identified and the inferno result matches the reference or the difference is explained.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux, rust
- Domain
- cli, performance, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100