Unclear error "unable to generate a flamegraph from the collapsed stack data"
adambratschikaye opened this issue · comments
When flamegraph
doesn't have permission to read a perf.data
file, it exits with an unrelated error message "unable to generate a flamegraph from the collapsed stack data".
Steps to reproduce:
# generate a perf file under `sudo`:
$ sudo perf record stress --cpu 1
stress: info: [1453939] dispatching hogs: 1 cpu, 0 io, 0 vm, 0 hdd
^C[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.235 MB perf.data (5648 samples) ]
# check perf.data file is only readable by root
$ ls -l perf.data
-rw------- 1 root root 282544 Sep 15 14:39 perf.data
# run flamegraph on the data
$ flamegraph --perfdata perf.data
writing flamegraph to "flamegraph.svg"
Error: unable to generate a flamegraph from the collapsed stack data
Caused by:
0: I/O error: No stack counts found
1: No stack counts found
I'm putting together a PR which should give a more helpful error.
With #227 we get a clearer error:
Error: unable to run 'perf script': (exit status: 255) failed to open perf.data: Permission denied