Profiling multithreaded C ++ applications

Do you use any profiling tool like Intel Vtune analyzer?

What are your recommendations for a multi-threaded C ++ application for Linux and Windows? My primary interests are cache flaws, memory usage, memory leaks, and CPU usage.

I use valgrind (UNIX only), but mainly for finding memory errors and leaks.

+7
c ++ performance multithreading profiling
source share
7 answers

Below are some good tools for multi-threaded applications. You can try a trial copy.

  • Runtime Health Checker
    • Thread Checker - Intel Thread checker / VTune, here
  • Memory compatibility checkers (memory usage, memory leaks) - The memory validator, here
  • Performance analysis. (CPU Usage) - AQTime, here

EDIT : Intel thread checking can be used to diagnose data races, deadlocks, stopped threads, abandoned locks, etc. You will have a lot of patience when analyzing the results, as it is easy to get confused.

A few tips:

  • Disable functions that are not required. (If deadlocks are detected, the data race may be disabled and vice versa).
  • Use a tooling level based on your needs. Levels, such as "All functions" and "Full image", are used to calculate data, where you can use the "Import API" to "detect deadlocks").
  • often use the context-sensitive menu "Diagnostic Help".
+8
source share

On Linux, try oprofile . It supports various performance counters.

Windows has AMD CodeAnalyst (free, unlike VTune). It only supports event profiling on AMD hardware, though (on Intel processors it's just a convenient timer-based profiler).

Recently, a colleague tried Intel Parallel Studio (beta) and rated it positively (he found some interesting parallelism related problems in some code).

+5
source share

VTune gives you a lot of details about what the processor does, and sometimes it’s hard for me to see a tree for trees. VTune will not report a memory leak. You will need to clear the plus for this, or if you can run on a Linux server, valgrind is good for memory leaks at a great price.

VTune shows two views, one useful for spreadsheets, the other, I think, just for sellers to impress people, but not so useful.

For a quick and cheap option, I would go with valgrind. Valgrind also has a cache buffing part, but I have not used it, but I suspect it is also very good.

amuses, Martin.

+3
source share

I will put another valgrind answer, especially the callgrind part with the user interface. It can handle multiple threads by profiling each thread for cache skips, etc. They also have a multithreaded error checking mechanism called helgrind, but I have never used it and I don't know how good it is.

+2
source share

You can try the AMD CodeXL profiler. It is free and available for both Windows and Linux.

The AMD CodeXL CPU profiler replaces the no longer supported CodeAnalyst tool (which was mentioned in the answer above given in time).

For more information and download links, see the AMD CodeXL Web Page .

+2
source share

Rational PurifyPlus includes both a proven leak detector and a good profiler. I'm not sure if it reaches the cache miss rate, you might need VTune to do this.

PurifyPlus is available on different Unices and on Windows, so it should meet your requirements, but unfortunately, unlike Valgrind, it is not free.

+1
source share

For simple profiling, gprof is pretty good ..

+1
source share

All Articles