![]() | Using KCachegrind |
Prev | Next |
First, one wants to generate performance data by measuring aspects of the runtime characteristics of an application, using a profiling tool. KCachegrind 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. Despite 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 is available from http://kcachegrind.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
At program termination, a file callgrind.out.pid will be generated which can be loaded into KCachegrind.callgrind myprogram myargs
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
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 being produced. By loading this file into KCachegrind, all others are loaded too, and can be seen in the Parts Overview and Parts list.callgrind --dump-before=KonqMainWindow::slotReload konqueror
OProfile is available from http://oprofile.sf.net. Follow the installation instructions on the web site. But before, 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 KCachegrind, do in an empty directory:
This will produce a lot of files, one for every program which was running on the system. Each one can be loaded into KCachegrind on its own.opreport -gdf | op2callgrind
Prev | Home | Next |
Visualization | Up | User Interface Basics |