Using TDECachegrind
Prev
Next

Chapter 2. Using TDECachegrind

Generate Data to Visualize

First, one wants to generate performance data by measuring aspects of the runtime characteristics of an application, using a profiling tool. TDECachegrind itself does not include any profiling tool, but is good in being used together with Callgrind, and by using a converter, also can be used to visualize data produced with OProfile. Although the scope of this manual is not to document profiling with these tools, the next section provides short quickstart tutorials to get you started.

Callgrind

Callgrind is available from http://tdecachegrind.sf.net. Note that it previously was called Calltree, but that name was misleading.

Most common use is to prefix the command line to start your application with callgrind, like in

callgrind myprogram myargs

At program termination, a file callgrind.out.pid will be generated which can be loaded into TDECachegrind.

More advanced use is to dump out profile data whenever a given function of your application is called. E.g. for konqueror, to see profile data only for rendering a web page, you could decide to dump the data whenever you select the menu item View/Reload. This corresponds to a call to KonqMainWindow::slotReload. Use

callgrind --dump-before=KonqMainWindow::slotReload konqueror

This will produce multiple profile data files with an additional sequential number at the end of the filename. A file without such an number at the end (only ending in the process PID) will also be produced; by loading this file into TDECachegrind, all others are loaded too, and can be seen in the Parts Overview and Parts list.

OProfile

OProfile is available from http://oprofile.sf.net. Follow the installation instructions on the web site; but, before you do, check if your distribution does not already provide it as package (like SuSE).

System-wide profiling is only permitted to the root user, as all actions on the system can be observed; therefore, the following has to be done as root. First, configure the profiling process, using the GUI oprof_start or the command-line tool opcontrol. Standard configuration should be timer mode (TBS, see introduction). To start the measurement, run opcontrol -s. Then run the application you are interested in and, afterwards, do a opcontrol -d. This will write out the measurement results into files under directory /var/lib/oprofile/samples/. To be able to visualize the data in TDECachegrind, do in an empty directory:

opreport -gdf | op2callgrind

This will produce a lot of files, one for every program which was running on the system. Each one can be loaded into TDECachegrind on its own.

Prev
Next
Home


Would you like to comment or contribute an update to this page?
Send feedback to the TDE Development Team