Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

from_lines most often fails but sometimes works #226

Open
Nevsden opened this issue Dec 21, 2021 · 6 comments
Open

from_lines most often fails but sometimes works #226

Nevsden opened this issue Dec 21, 2021 · 6 comments

Comments

@Nevsden
Copy link

Nevsden commented Dec 21, 2021

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.

@Nevsden
Copy link
Author

Nevsden commented Dec 21, 2021

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.

@jonhoo
Copy link
Owner

jonhoo commented Dec 31, 2021

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.

@mkutscherauer
Copy link

mkutscherauer commented Jan 9, 2022

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.

@19wintersp
Copy link

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.

@mkutscherauer
Copy link

Fixed my issue by using

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

as described in the README under Obtaining profiling data

@19wintersp
Copy link

19wintersp commented Jan 15, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants