Wednesday, October 11, 2006

Valgrind for profiling

Valgrind is amazing. Not only it does memcheck, it also does code profiling without need to recompile everything. Use it with kcachegrind, and you can see a very nice visualization of the profiling data.

http://valgrind.org/docs/manual/cl-manual.html

4 comments:

rfabbri said...

A simple usage for the daily grind:

valgrind --tool=callgrind program

kcachegrind

rfabbri said...

For memory check, here is a transcription of valgrind's quickstart guide:


If you normally run your program like this:

myprog arg1 arg2

Use this command line:

valgrind --leak-check=yes myprog arg1 arg2

Memcheck is the default tool. The --leak-check option turns on the detailed memory leak detector.

Your program will run much slower (eg. 20 to 30 times) than normal, and use a lot more memory. Memcheck will issue messages about memory errors and leaks that it detects.


More info at:

http://valgrind.org/docs/manual/quick-start.html#quick-start.mcrun

Anonymous said...

Nice brief and this mail helped me alot in my college assignement. Thanks you for your information.

Anonymous said...

Sorry for my bad english. Thank you so much for your good post. Your post helped me in my college assignment, If you can provide me more details please email me.