I need a good profiler for both Windows and Linux (they don't have to be the same one; separate recommendations for each OS are fine) that can attach to an already running process that was not compiled in any "special" way and give me statistics on what functions the process is spending most of its time in. I have some long running scientific code and I want to get snapshots of where it's spending most of its time at various stages of execution, and be able to get the results without having to run the whole program start to finish.
The compiler I'm using (Digital Mars D) comes with an instrumenting profiler. It's way too slow for the jobs I'm running. Since I'm only interested in identifying major bottlenecks, I want something fast and easy to use, even if it's only roughly accurate. Ideally it should also be able to profile all threads simultaneously and give me an aggregate report.
On Linux, I've been using GDB as a poor man's sampling profiler (pausing my app a few times and seeing what function it's in). Basically, a more automated version of this is what I'm looking for.
One last requirement: On Linux it has to be easy to install without root privileges, since I'm going to be running it on a server that I don't have root access to.
Edit: While the code was written in D, D's compilation model, etc. is similar enough to C's that tools written for C should work fine.
If you have a fairly recent kernel you can use perf
:
perf record -p <pid> -g
...then perf report
once you've gathered enough samples.
You're looking for oprofile:
http://oprofile.sourceforge.net/
For Linux, try Zoom. ALso, for rough work, lsstack
is useful for finding bottlenecks.
I haven't tried it, but xProf was written specifically for D. It's a statistical profiler.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With