ashish-17 / WaitFreeMemAlloc

Wait free memory allocation in multi threaded environment
2 stars 0 forks source link

Analyse profiling tools for C #1

Closed ashish-17 closed 9 years ago

ashish-17 commented 9 years ago

List down all the available profiling tools for C Short-list the tools based on compiler compatibility and supported features.

architaagarwal commented 9 years ago

Instruments - comes with Xcode - GUI - has a lot of features like detecting memory leaks, time profiling etc, can show per core as well as per thread time information as well.

GProf - comes with gcc - not supported on mac

Shark - used to some with Xcode - discontinued now

DTrace - this is the underlying support of Instruments. Instruments is its GUI.

OpenPAT - can be used to measure hotspots, control flow, data flow and other information. A pdf said (http://www.openpat.org/docs/OpenPAT%20--%20Introduction.pdf) that it is more efficient than Valgrind but i think the pdf is from its inventors. Can't find much on how much is it used.

gperftools - Can check efficiency of multithreaded applications. It works on MacOS 10.9

Valgrind - it's not a profiler but a memory management tool which can very effectively detect memory leaks. It also comes with two tools - cachegrind and callgrind. Both help in analysing time (http://c.learncodethehardway.org/book/ex41.html). KCachegrind built on top of it is a GUI which interprets the outputs from both. For mac i think we have qcachegrind instead of kcachegrind.

RotateRightZoom - supports most compiled languages on ARM and x86 processors. Don't know it it would work on mine. Has a GUI as well. (http://www.rotateright.com/zoom-quick-start/zoom-quick-start.html)

ashish-17 commented 9 years ago

Did u check following profilers?

architaagarwal commented 9 years ago

Poor man's profiler (PMP) - didn't get much whether MAC is supported or not.

Oprofile - It's wiki page says that call graphs are supported by only ARM and x_86 processors. Seems to work on OSX. But it seems obsolete now. (http://stackoverflow.com/questions/7024467/is-oprofile-still-alive-and-well/7024840#7024840)

CodeAnalyst - specifically designed for AMD processors but can be used for other processors as well. It is based on oprofile. Uses oprofile as its backend. Works for both x86 and x86_64 machines. Don't know if it works for Mac

ashish-17 commented 9 years ago
ashish-17 commented 9 years ago

Test code for analysing output of performance tools.

  1. Write a simple hello world C program.
  2. Write a c program that calls malloc 10000 times each time asking random memory. Don't free this memory.
  3. Write another C program that call above routine in 10 different threads.
  4. Write some C program that allocates and then deallocates some memory.
  5. Write a C program that calls this routine in 10 different threads.
architaagarwal commented 9 years ago

Callgrind