tikv / pprof-rs

A Rust CPU profiler implemented with the help of backtrace-rs
Apache License 2.0
1.3k stars 99 forks source link

profiler: Fix pthread_getname_np not available on musl #110

Closed Xuanwo closed 2 years ago

Xuanwo commented 2 years ago

Signed-off-by: Xuanwo github@xuanwo.io

Fix https://github.com/tikv/pprof-rs/issues/41

This PR will make pprof-rs compilable on x86_64-unknown-linux-musl

:( PKG_CONFIG_ALLOW_CROSS=1 cargo build --target x86_64-unknown-linux-musl
    Finished dev [unoptimized + debuginfo] target(s) in 0.02s

Only tested on linux platform, please correct me if something is wrong.

YangKeao commented 2 years ago

BTW, does it work (correctly)? The last time I tried to work on the musl support: https://github.com/tikv/pprof-rs/pull/32, it turns out that it cannot get a meaningful backtrace. @Xuanwo

But anyway, I think it's fine to just fix the compile error for musl, so I will merge this PR.

Xuanwo commented 2 years ago

The last time I tried to work on the musl support: #32, it turns out that it cannot get a meaningful backtrace. @Xuanwo

It's more important for us to make the whole project compilable on musl and make a static release to end-users who never run pprof. So in our use case, we don't care about the backtrace on musl, and I didn't test the behavior too :crying_cat_face: