1

I've have a highly parallelized program I've written in C++, and I'm trying to speed it up. After making the modification that seemed obvious, I'd like to profile the code to see where the time's being spent and where I should concentrate on optimizing. However, I've run into a bit of a problem in that I can't seem to find a good way to profile the code.

Originally, I wanted to make use of OProfile, but it seems that the kernel sources aren't installed on this machine and the kernel is too old and was not built with profiling support. Then I looked into using gprof, but learned that it doesn't deal well with multithreaded code. I finally settled on gperftools, which works well, but since it samples stack frames, only seems to give me function-level information about my code's time usage. I can see that over 50% of my time (or the sampled time, that is) is being spent in one function. However, I'd like to drill down a but further to see what region of that function / instructions are taking the majority of the time. However, I can't seem to figure out how to get gperftools to provide this information, and I'm not aware of other profiling tools that will (that I can use / install without root privileges). Any suggestions would be greatly appreciated.

nomad
  • 1,809
  • 2
  • 18
  • 33
  • Well, there's the [*dirty-but-effective way*](http://stackoverflow.com/a/378024/23771), using GDB. If you interrupt it several times, in half of them, more or less, you will see exactly what's going on. – Mike Dunlavey Jun 17 '13 at 21:09

2 Answers2

2

Allinea MAP would get your answer here, it does line level and function level profiling of C++ multithreaded codes and can be installed and used as a unprivileged user.

David
  • 756
  • 5
  • 10
0

In my opinion in multithreading there is nothing to be compared with Intel Parallel Studio. It is surprisingly free on Linux.The only bad "feature" - it is quite large.

SChepurin
  • 1,814
  • 25
  • 17