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

SVG report doesn't contain my Rust functions #330

Open
nricciardi opened this issue Jun 28, 2024 · 3 comments
Open

SVG report doesn't contain my Rust functions #330

nricciardi opened this issue Jun 28, 2024 · 3 comments

Comments

@nricciardi
Copy link

I'm using Flamegraph on Linux Mint 21.3 (kernel 5.15.0-113-generic) to profile my Rust application. When I run

cargo flamegraph -- [my args]

the terminal remains blocked showing:

[ perf record: Woken up 82 times to write data ]
[ perf record: Captured and wrote 22,570 MB perf.data (1421 samples) ]

(SVG file is not produced)

I must interrupt with CTRL + C and then SVG report is produced, but it does not have any profiled function of my Rust application.

If I run flamegraph with the same application, but throwing e.g. todo!(), then terminal exits correctly and flamegraph produces SVG report without CTRL + C.

My Cargo.toml file is the following:

[dependencies]
anyhow = "1.0.75"
base64 = "0.21.5"
build_html = "2.4.0"
clap = "4.4.18"
env_logger = "0.10.1"
image = "0.24.8"
log = "0.4.20"
notify = "6.1.1"
oxipng = { version = "9.1.1", features = ["parallel"]}
rayon = "1.8.0"
regex = "1.10.2"
reqwest = { version = "0.11.24", features = ["blocking"] }
serde = { version = "1.0.195", features = ["derive"] }
serde_json = "1.0.113"
serde_yaml = "0.9.31"
simple_logger = "4.3.3"
thiserror = "1.0.50"
url = "2.5.0"

[profile.release]
debug = true

I have tried also using --root option without results. How can I fix it?

@djc
Copy link
Contributor

djc commented Jun 29, 2024

I don't think there is enough information here for me to diagnose this, and it seems unlikely to be a problem with cargo flamegraph itself. I'm guessing your application hangs. Maybe you can try perf record to record a profile and then process it with flamegraph? Or maybe try the samply profiler instead.

@nricciardi
Copy link
Author

Thank you to answer me.

How can I produce SVG using flamegraph from perf record output?

However, to reproduce my issue, my Rust application is a Markdown compiler (https://github.com/nricciardi/nmd). Running, for example, cargo flamegraph -- compile dossier -i test-resources/nmd-test-dossier-1 --fast-draft

Using a simple main having only one instruction std::process::exit(0); profiling terminates correctly producing SVG. In particular, after [perf record: ...] there is a new line: writing flamegraph to "flamegraph.svg"

I tried to put exit(0) in my code without any results, but sometimes (in a no deterministic way) writing flamegraph to "flamegraph.svg" was displayed.

@djc
Copy link
Contributor

djc commented Jul 1, 2024

Sorry, I don't have time to provide support for flamegraph at this level.

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

2 participants