Search code examples
cmultithreadinggprof

Does gprof support multithreaded applications?


We're developing a multithreaded project. My colleague said that gprof works perfectly with no work around with multithreaded programs. I read otherwise some time ago.

http://sam.zoy.org/writings/programming/gprof.html

http://lists.gnu.org/archive/html/bug-binutils/2010-05/msg00029.html

I also read this:

How to profile multi-threaded C++ application on Linux?

So I'm guessing the workaround is no longer needed? If so, since when is it not needed?


Solution

  • Unless you change the processing the gprof would work fine.

    Changing the processing means using co-processor or gpus as computing units. In the worst case you have to manually call the setitimer function for every thread. But as per latest version, (2013-14) it's not needed.

    In certain cases it behaves mischievously. So I advice to use the VTUNE from Intel which would give more accurate and more detailed information.