13. Lackey: an example tool
To use this tool, you must specify
--tool=lackey
on the Valgrind command line.
13.1. Overview
Lackey is a simple Valgrind tool that does various kinds of basic program measurement. It adds quite a lot of simple
instrumentation to the program’s code.
It is primarily intended to be of use as an example tool, and consequently
emphasises clarity of implementation over performance.
13.2. Lackey Command-line Options
Lackey-specific command-line options are:
--basic-counts=<no|yes> [default:
yes]
When enabled, Lackey prints the following statistics and information about the execution of the client program:
1. The number of calls to the function specified by the
--fnname
option (the default is
main
). If the program has
had its symbols stripped, the count will always be zero.
2. The number of conditional branches encountered and the number and proportion of those taken.
3. The number of superblocks entered and completed by the program.
Note that due to optimisations done by the
JIT, this is not at all an accurate value.
4. The number of guest (x86, amd64, ppc, etc.) instructions and IR statements executed. IR is Valgrind’s RISC-like
intermediate representation via which all instrumentation is done.
5. Ratios between some of these counts.
6. The exit code of the client program.
--detailed-counts=<no|yes> [default:
no]
When enabled, Lackey prints a table containing counts of loads, stores and ALU operations, differentiated by their IR
types. The IR types are identified by their IR name ("I1", "I8", ... "I128", "F32", "F64", and "V128").
--trace-mem=<no|yes> [default:
no]
When enabled, Lackey prints the size and address of almost every memory access made by the program.
See
the comments at the top of the file
lackey/lk_main.c
for details about the output format, how it works, and
inaccuracies in the address trace. Note that this option produces immense amounts of output.
--trace-superblocks=<no|yes> [default:
no]
When enabled, Lackey prints out the address of every superblock (a single entry, multiple exit, linear chunk of code)
executed by the program. This is primarily of interest to Valgrind developers. See the comments at the top of the file
lackey/lk_main.c
for details about the output format. Note that this option produces large amounts of output.
--fnname=<name> [default:
main]
Changes the function for which calls are counted when
--basic-counts=yes
is specified.
162