jonhoo / inferno

A Rust port of FlameGraph

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`from_lines` most often fails but sometimes works

Nevsden opened this issue · comments

So I am running the cargo flamegraph command together with the example and root flag.
The curious thing is, sometimes the command works, but most often it does not and fails with this error message:

[ perf record: Woken up 148 times to write data ]
[ perf record: Captured and wrote 38.667 MB perf.data (4775 samples) ]
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

Diving directly into the responsible portion of code from the inferno crate, it seems as when using the from_lines command, the accumulated time equals zero. I am unfortunately not yet able to fully understand what this means.
Any suggestions?

I cannot attach the file from perf as Github does not support .data.

As a workaround, I run the inferno command set to generate a flamegraph without using the flamegraph-rs crate.
It went smoothly for every try so far.

I used the commands that are provided in infernos README.md.

That sounds like your program may be running for too short a time for cargo-flamegraph to actually gather any profiling samples. Which inferno then rightly complains about. You may want to try a longer-running benchmark, or increasing the sampling frequency. In either case, this doesn't seem like a bug in inferno from what you've described thus far.

I am currently experiencing the same issue

[ perf record: Woken up 13314 times to write data ]
Warning:
Processed 438792 events and lost 40 chunks!

Check IO/CPU overload!

[ perf record: Captured and wrote 3341.115 MB perf.data (415068 samples) ]

I tried using the described workaround, but the stacks.folded file is totally empty.

I'm not sure if this is helpful or the same issue, but in my case the issue seems to have been caused by the permissions on the "perf.data" file - they were set as -rw------- and so flamegraph was unable to read it. Running sudo +r perf.data and then flamegraph --perfdata perf.data fixed it.

Fixed my issue by using

$ echo 0 | sudo tee /proc/sys/kernel/perf_event_paranoid

as described in the README under Obtaining profiling data

Fixed my issue by using

$ echo 0 | sudo tee /proc/sys/kernel/perf_event_paranoid

as described in the README under Obtaining profiling data

I think this issue is caused particularly by using the --root flag instead of having to do that - using that command to set the kernel options does work for me, though I prefer to use --root.