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

No perf.data generated within Docker container #342

Open
mateusfigmelo opened this issue Nov 4, 2024 · 3 comments
Open

No perf.data generated within Docker container #342

mateusfigmelo opened this issue Nov 4, 2024 · 3 comments

Comments

@mateusfigmelo
Copy link

I run the my rust app with cargo flamegraph in my local environment.
At that time, I could see the perf.data as temp file in my working dir.
And when the CTRL+C, I could also see the flamegraph.svg
Question 1: How to see the flamegraph.svg in real time without CTRL+C

And then I needed to run the cargo flamegraph with docker compose.
So I wrote the docker compose including cargo flamegraph.
After running docker, all processes were running correctly, but I couldn't see the perf.data in working dir of docker container.
Instead of generating perf.data, I could see too long logs of docker containter (docker logs -f xxx) including known unicode letters.
Maybe it seems like the contents of perf.data.
I am not sure why perf.data is not generated within docker container.
But I tried to run the command cargo flamegraph within docker container.
At that time, perf.data was generated within working dir of docker container.
Question 2:
Why the results of run the command as entrypoint of docker compose and as direct run within docker container are different?

@djc
Copy link
Contributor

djc commented Nov 4, 2024

From a quick look at the source code, I don't see any reason for a difference in behavior between running natively in a Linux (terminal) vs running in a Docker container. However, flamegraph is a fairly thin wrapper over perf (at least on Linux) and the inferno crate, so it's possible that perf behaves differently in your environment.

Beyond, I probably won't be able to troubleshoot your issue much more on a volunteer basis. If you want to discuss commercial support, feel free to send me an email.

@djc djc changed the title The use of cargo flamegraph with docker compose No perf.data generated within Docker container Nov 4, 2024
@mateusfigmelo
Copy link
Author

mateusfigmelo commented Nov 4, 2024

Thanks for your response.
Anyways, I took out the part to check the performance from docker compose for now.
In the future, I will need to check the performance within docker container.
If you find relevant datas with it, plz lmk.
🙏

@RealJoL
Copy link

RealJoL commented Nov 11, 2024

I have encountered this problem before (including binary/Unicode on std output). Have you verified that the container has the required capabilities (at least PERFMON or even privileged) to use perf in your compose deployment?

In the past, manually starting the flame graph via docker exec or wrapping the binary call into a .sh file also worked for me, but your mileage may vary.

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

3 participants