Skip to content

Conversation

@vitorenesduarte
Copy link
Contributor

Previously, if argument -o was set in the custom command, flamegraph would fail to compute perf's output since it would look for the default perf.data file.

Now, we detect if the user sets perf's output file with -o and build the flamegraph from that file instead.

With this change, the following command now seems to work:

flamegraph -c "record -F 997 --call-graph dwarf -g -o my_perf.data" date
Fri Jul 31 12:02:05 CEST 2020
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.075 MB my_perf.data (7 samples) ]
writing flamegraph to "flamegraph.svg"

Without this change, this is the error we get:

flamegraph -c "record -F 997 --call-graph dwarf -g -o my_perf.data" date
Fri Jul 31 12:03:08 CEST 2020
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.075 MB my_perf.data (7 samples) ]
writing flamegraph to "flamegraph.svg"
thread 'main' panicked at 'unable to generate a flamegraph from the collapsed stack data: Io(Custom { kind: InvalidData, error: "No stack counts found" })', /home/vitor.enes/.cargo/registry/src/github.com-1ecc6299db9ec823/flamegraph-0.3.1/src/lib.rs:273:6
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Previously, if argument '-o' was set in the custom command, flamegraph
would fail to compute perf's output since it would look for the default
file 'perf.data'.

Now, we detect if the user sets perf's output file with '-o' and build
the flamegraph from that file instead.
@spacejam
Copy link
Contributor

spacejam commented Dec 7, 2020

Thanks for this fix! I'll be merging this into a new release in the next few minutes if bors is happy.

bors r+

@bors
Copy link
Contributor

bors bot commented Dec 7, 2020

@bors bors bot merged commit c5783ad into flamegraph-rs:master Dec 7, 2020
@vitorenesduarte vitorenesduarte deleted the perf.data branch December 7, 2020 13:59
@spacejam
Copy link
Contributor

spacejam commented Dec 7, 2020

Version 0.4 has been released which includes these changes. Thank you :)

@vitorenesduarte
Copy link
Contributor Author

Awesome, thanks!

vitorenesduarte added a commit to vitorenesduarte/fantoch that referenced this pull request Dec 26, 2020
flamegraph-rs/flamegraph#95 has landed and
there's a new version with it released.
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

Successfully merging this pull request may close these issues.

2 participants