{C++ etc.}

Latest Posts
 
Home | C++ Posts | Linux Posts | Programming Posts | Issue Tracking Posts

Monday, March 22, 2010

Basic Performance Profiling and Tuning of C++ Programs in Linux

I've just highlighted the basic things you need to get started on profiling. Hopefully it would serve to help developers to refine their methods and go for more complex profiling strategies.


The required tools:
1. Run the tool called callgrind (which is part of the valgrind suite):
valgrind --tool=callgrind [parameters]
2. This would create a file of the format:callgrind.out. You could go through this file using an editor but it's hard to do a proper analysis using only your wits. This is where KCacheGrind comes in.

3. Run KCacheGrind and load the callgrind output file in to it.


Now you would have a visual representation of the calls made by each method displayed as a percentage of the total call count via a rectangular area diagram.

4.

  • If you have a method which you would like to optimize, change the grouping to "Class" and search for the method in order find it quickly.
  • Otherwise, look for the methods which are called the most and optimize them.

5.Also try to lower the call count to these methods by modifying the callers to re-use values

Also Refer:

No comments: