- publishing free software manuals
Valgrind 3.3 - Advanced Debugging and Profiling for GNU/Linux applications
by J. Seward, N. Nethercote, J. Weidendorfer and the Valgrind Development Team
Paperback (6"x9"), 164 pages
ISBN 0954612051
RRP £12.95 ($19.95)

Get a printed copy>>>

6.2 Profiling programs

To gather cache profiling information about the program ‘ls -l’, invoke Cachegrind like this:

valgrind --tool=cachegrind ls -l

The program will execute (slowly). Upon completion, summary statistics that look like this will be printed:

==31751== I   refs:      27,742,716
==31751== I1  misses:           276
==31751== L2  misses:           275
==31751== I1  miss rate:        0.0%
==31751== L2i miss rate:        0.0%
==31751== 
==31751== D   refs:      15,430,290  (10,955,517 rd +
                                       4,474,773 wr)
==31751== D1  misses:        41,185  (    21,905 rd +
                                          19,280 wr)
==31751== L2  misses:        23,085  (     3,987 rd +
                                          19,098 wr)
==31751== D1  miss rate:        0.2% (       0.1%   +
                                             0.4%)
==31751== L2d miss rate:        0.1% (       0.0%   +
                                             0.4%)
==31751== 
==31751== L2 misses:         23,360  (     4,262 rd +
                                          19,098 wr)
==31751== L2 miss rate:         0.0% (       0.0%   +
                                             0.4%)

Cache accesses for instruction fetches are summarised first, giving the number of fetches made (this is the number of instructions executed, which can be useful to know in its own right), the number of I1 misses, and the number of L2 instruction (‘L2i’) misses.

Cache accesses for data follow. The information is similar to that of the instruction fetches, except that the values are also shown split between reads and writes (note each row's ‘rd’ and ‘wr’ values add up to the row's total).

Combined instruction and data figures for the L2 cache follow that.

ISBN 0954612051Valgrind 3.3 - Advanced Debugging and Profiling for GNU/Linux applicationsSee the print edition