flamegraph
flamegraph copied to clipboard
Generates binary output that messes up the console
➜ cargo flamegraph --example api_bench_example --features smoltcp,devourer/capsule -- \
-a ../configs/accounts/private.yaml -s ../configs/dpdk1-aliyun.yaml -d ../configs/database.yaml -w 10 > out.txt
du -sh out.txt
61M out.txt
➜ dd if=out.txt of=out.part.txt bs=1K count=1
1+0 records in
1+0 records out
1024 bytes (1.0 kB, 1.0 KiB) copied, 6.8763e-05 s, 14.9 MB/s
➜ cat out.part.txt
PERFILE2@xoa ijklmnopqrstuvwxyz{|}~PT@[email protected][email protected]_5.x86_64PT@x86_64P P@Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHzPT @GenuineIntel,6,85,4P
PT
@/usr/bin/perf#
cargo flamegraph does not usually produce any binary output at all, so I'm not sure what's going on here. Given that your issue lacks any kind of context and does not seem to be reproducible for me, I think you'll have to do some further investigation on what's going on yourself.
The system I use is Aliyun Centos Stream. I wonder if there are some strange configurations that makes perf put profiling data directly into stdout
That seems somewhat unlikely... In any case, cargo flamegraph is really a fairly straightforward wrapper around calling perf
or dtrace
and then feeding their output into the inferno crate for graphing, so it seems unlikely to me that this is an issue in (cargo) flamegraph itself.
I've run into the same problem on Amazon Linux. In some cases (I think relating to whether stdout
is a TTY or not), it will write the perf data to stdout. I've found that passing -o perf.data
to the perf record
command seems to resolve the problem. (Even though -o perf.data
should, in theory, be the default.)
Both Amazon Linux and Centos Stream are Red Hat-based distros, which is already strange from other distros. Can anyone test out on Centos 7, 8, and RHEL? Maybe Fedora?
@qiujiangkun I have run cargo flamegraph
on a Fedora 35 system and did not see the issue you are seeing. Don't think the RHEL based distros are strange, since we use them quite a lot (and have been for many years).
Some system info:
$ cat /etc/redhat-release
Fedora release 35 (Thirty Five)
$ perf --version
perf version 5.16.5
Hope that helps.
I'm also having this issue in Docker on the rust:1.60.0 (Debian). It's quite strange:
