|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
RRP £12.95 ($19.95)
6.4 Merging profiles with cg_merge
cg_merge is a simple program which reads multiple profile files, as created by cachegrind, merges them together, and writes the results into another file in the same format. You can then examine the merged results using ‘cg_annotate <filename>’, as described above. The merging functionality might be useful if you want to aggregate costs over multiple runs of the same program, or from a single parallel run with multiple instances of the same program.
cg_merge is invoked as follows:
cg_merge -o outputfile file1 file2 file3 ...
It reads and checks ‘file1’, then read and checks ‘file2’ and merges it into the running totals, then the same with ‘file3’, etc. The final results are written to ‘outputfile’, or to standard out if no output file is specified.
Costs are summed on a per-function, per-line and per-instruction basis. Because of this, the order in which the input files does not matter, although you should take care to only mention each file once, since any file mentioned twice will be added in twice.
cg_merge does not attempt to check that the input files come from runs of the same executable. It will happily merge together profile files from completely unrelated programs. It does however check that the ‘Events:’ lines of all the inputs are identical, so as to ensure that the addition of costs makes sense. For example, it would be nonsensical for it to add a number indicating D1 read references to a number from a different file indicating L2 write misses.
A number of other syntax and sanity checks are done whilst reading the inputs. cg_merge will stop and attempt to print a helpful error message if any of the input files fail these checks.
|ISBN 0954612051||Valgrind 3.3 - Advanced Debugging and Profiling for GNU/Linux applications||See the print edition|