brendangregg / FlameGraph

Stack trace visualizer
http://www.brendangregg.com/flamegraphs.html
17.38k stars 1.97k forks source link

Failure on `Hello, world!` with `ERROR No stack counts found` #299

Closed JonathanWoollett-Light closed 1 year ago

JonathanWoollett-Light commented 1 year ago

When attempting to generate a flame graph for the Rust Hello, world! binary an error is output (ERROR No stack counts found).

Test

jonathan@jonathan-pc:~/Projects$ sudo rm -rf FlameGraph
jonathan@jonathan-pc:~/Projects$ git clone https://github.com/brendangregg/FlameGraph
Cloning into 'FlameGraph'...
remote: Enumerating objects: 1217, done.
remote: Counting objects: 100% (81/81), done.
remote: Compressing objects: 100% (49/49), done.
remote: Total 1217 (delta 43), reused 59 (delta 32), pack-reused 1136
Receiving objects: 100% (1217/1217), 1.93 MiB | 1.03 MiB/s, done.
Resolving deltas: 100% (700/700), done.
jonathan@jonathan-pc:~/Projects$ cargo new test-binary
     Created binary (application) `test-binary` package
jonathan@jonathan-pc:~/Projects$ cd test-binary
jonathan@jonathan-pc:~/Projects/test-binary$ cargo build
   Compiling test-binary v0.1.0 (/home/jonathan/Projects/test-binary)
    Finished dev [unoptimized + debuginfo] target(s) in 0.23s
jonathan@jonathan-pc:~/Projects/test-binary$ sudo perf record -F 100000 /home/jonathan/Projects/test-binary/target/debug/test-binary
Hello, world!
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.021 MB perf.data (65 samples) ]
jonathan@jonathan-pc:~/Projects/test-binary$ sudo perf script > out.perf
jonathan@jonathan-pc:~/Projects/test-binary$ sudo /home/jonathan/Projects/FlameGraph/stackcollapse-perf.pl out.perf > out.folded
jonathan@jonathan-pc:~/Projects/test-binary$ sudo /home/jonathan/Projects/FlameGraph/flamegraph.pl out.folded > out.svg
ERROR: No stack counts found
jonathan@jonathan-pc:~/Projects/test-binary$

Environment

jonathan@jonathan-pc:~/Projects/test-binary$ neofetch
            .-/+oossssoo+/-.               jonathan@jonathan-pc 
        `:+ssssssssssssssssss+:`           -------------------- 
      -+ssssssssssssssssssyyssss+-         OS: Ubuntu 22.04.1 LTS x86_64 
    .ossssssssssssssssssdMMMNysssso.       Kernel: 5.15.0-53-generic 
   /ssssssssssshdmmNNmmyNMMMMhssssss/      Uptime: 18 mins 
  +ssssssssshmydMMMMMMMNddddyssssssss+     Packages: 2060 (dpkg), 15 (snap) 
 /sssssssshNMMMyhhyyyyhmNMMMNhssssssss/    Shell: bash 5.1.16 
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Resolution: 2560x1440 
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   DE: Unity 
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   WM: Mutter 
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   WM Theme: Adwaita 
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   Theme: Yaru [GTK2/3] 
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Icons: Yaru [GTK2/3] 
 /sssssssshNMMMyhhyyyyhdNMMMNhssssssss/    Terminal: vscode 
  +sssssssssdmydMMMMMMMMddddyssssssss+     CPU: AMD Ryzen 9 5900X (24) @ 3.700GHz 
   /ssssssssssshdmNNNNmyNMMMMhssssss/      GPU: NVIDIA GeForce RTX 3060 Ti Lite Hash Rate 
    .ossssssssssssssssssdMMMNysssso.       Memory: 4020MiB / 128725MiB 
      -+sssssssssssssssssyyyssss+-
        `:+ssssssssssssssssss+:`                                   
            .-/+oossssoo+/-.                                       

jonathan@jonathan-pc:~/Projects/test-binary$ 
jonathan@jonathan-pc:~/Projects/test-binary$ rustc --version --verbose
rustc 1.67.0-nightly (01fbc5ae7 2022-12-07)
binary: rustc
commit-hash: 01fbc5ae789fc0c7a2da71d3cd908451f175e4eb
commit-date: 2022-12-07
host: x86_64-unknown-linux-gnu
release: 1.67.0-nightly
LLVM version: 15.0.4
jonathan@jonathan-pc:~/Projects/test-binary$ 
JonathanWoollett-Light commented 1 year ago

Was missing -g from perf record options, sudo perf record -F 100000 -g /home/jonathan/Projects/test-binary/target/debug/test-binary fixed it.

Maxine-1520 commented 11 months ago

Thanks for your share. Though the reason for the exception of mine (permission is not satisfied) is not the same as you, your command gives me the insight (add "sudo" to enhance the permission) to solve my problem. Thanks a lot~