Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is there a good thread tracer for C/C++ like Haskell's Threadscope?

Is there a free and open source tool like Threadscope (and newer than NPTL Trace tool) to analyze CPU utilization/threading errors?

like image 391
Dervin Thunk Avatar asked Jul 24 '11 15:07

Dervin Thunk


1 Answers

The CPU utilization analysis and threading error checker can be not in the same tool. To find threading errors, huge analysis of memory accesses is needed. I can name valngrind's helgrind http://valgrind.org/docs/manual/hg-manual.html and google threadSanitizer, tsan (based on helgrind) http://code.google.com/p/data-race-test/wiki/ThreadSanitizer. Both tools do a run-time instrumentation of code via valgrind's libVEX dynamic code modification framework. This leads to huge slowdown, e.g. for Helgrind (from hg-manual):

Performance can be very poor. Slowdowns on the order of 100:1 are not unusual. There is limited scope for performance improvements.

For CPU utilization, you should use the profiler, which does affect performance of the application only a little (up to 5-10 %), e.g. oprofile or linux's perf https://perf.wiki.kernel.org/index.php/Main_Page

If threads in your application are added by using OpenMP, there are solutions to analyze OMP thread balancing, e.g. Intel's openMP implementation can record some information like shown here .gvs (GuideView openmp statistics) file format

like image 137
osgx Avatar answered Sep 22 '22 15:09

osgx