From: Nicholas Nethercote Date: Wed, 5 Aug 2009 06:57:45 +0000 (+0000) Subject: - Rejigged Lackey's manual X-Git-Tag: svn/VALGRIND_3_5_0~133 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=109043c349a3797b73652b5a8f9698b4ddba142c;p=thirdparty%2Fvalgrind.git - Rejigged Lackey's manual - Made it count calls to main() by default, since _dl_runtime_resolve() no longer appears to exist. - A couple of other minor Lackey things. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10717 --- diff --git a/lackey/docs/lk-manual.xml b/lackey/docs/lk-manual.xml index 633668b455..e497eeebb5 100644 --- a/lackey/docs/lk-manual.xml +++ b/lackey/docs/lk-manual.xml @@ -14,108 +14,11 @@ command line. Overview -Lackey is a simple valgrind tool that does some 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. - -It measures and reports various things. - - - - - When command line option - is specified, - it prints the following statistics and information about the execution of - the client program: - - - - - The number of calls to - _dl_runtime_resolve(), the - function in glibc's dynamic linker that resolves function - references to shared objects. - You can change the name of the function tracked with command line - option . - - - - The number of conditional branches encountered and the - number and proportion of those taken. - - - - 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. - - - - 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. - - - - - Ratios between some of these counts. - - - - The exit code of the client program. - - - - - - - When command line option - is - specified, a table is printed with counts of loads, stores and ALU - operations for various types of operands. - - The types are identified by their IR name ("I1" ... "I128", - "F32", "F64", and "V128"). - - - - When command line option - is - specified, it prints out the size and address of almost every load and - store 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. - - - - - When command line option - is - specified, it prints out the address of every superblock - (extended basic block) 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 Lackey runs quite slowly, especially when - is specified. -It could be made to run a lot faster by doing a slightly more -sophisticated job of the instrumentation, but that would undermine -its role as a simple example tool. Hence we have chosen not to do -so. - -Note also that -and create -immense amounts of output. If you are saving the output in a file, -you can eat up tens of gigabytes of disk space very quickly. -As a result of printing out so much stuff, they also cause the program -to run absolutely utterly unbelievably slowly. +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. @@ -133,7 +36,47 @@ to run absolutely utterly unbelievably slowly. - Count basic events, as described above. + When enabled, Lackey prints the following statistics and + information about the execution of the client program: + + + + + The number of calls to the function specified by the + option (the default is + main). + If the program has had its symbols stripped, the count will always + be zero. + + + + The number of conditional branches encountered and the + number and proportion of those taken. + + + + 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. + + + + 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. + + + + + Ratios between some of these counts. + + + + The exit code of the client program. + + + + @@ -142,38 +85,49 @@ to run absolutely utterly unbelievably slowly. - Count loads, stores and alu ops, differentiated by their - IR types. + 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"). - + - + - Count calls to the function <name>. + 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. - + - + - Produce a log of all memory references, as described - above. + 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. - + - + - Print a line of text giving the address of each superblock - (single entry, multiple exit chunk of code) executed - by the program. + Changes the function for which calls are counted when + is specified. diff --git a/lackey/lk_main.c b/lackey/lk_main.c index 65e8885dd2..d2110b6e23 100644 --- a/lackey/lk_main.c +++ b/lackey/lk_main.c @@ -132,7 +132,7 @@ // want to analyse locality of memory accesses -- but is not good if // absolute addresses are important. // -// Despite all these warnings, Dullard's results should be good enough for a +// Despite all these warnings, Lackey's results should be good enough for a // wide range of purposes. For example, Cachegrind shares all the above // shortcomings and it is still useful. // @@ -192,7 +192,7 @@ static Bool clo_trace_sbs = False; /* The name of the function of which the number of calls (under * --basic-counts=yes) is to be counted, with default. Override with command * line option --fnname. */ -static Char* clo_fnname = "_dl_runtime_resolve"; +static Char* clo_fnname = "main"; static Bool lk_process_cmd_line_option(Char* arg) { @@ -212,12 +212,12 @@ static Bool lk_process_cmd_line_option(Char* arg) static void lk_print_usage(void) { VG_(printf)( -" --basic-counts=no|yes count instructions, jumps, etc. [no]\n" +" --basic-counts=no|yes count instructions, jumps, etc. [yes]\n" " --detailed-counts=no|yes count loads, stores and alu ops [no]\n" " --trace-mem=no|yes trace all loads and stores [no]\n" " --trace-superblocks=no|yes trace all superblock entries [no]\n" " --fnname= count calls to (only used if\n" -" --basic-count=yes) [_dl_runtime_resolve]\n" +" --basic-count=yes) [main]\n" ); } @@ -883,7 +883,8 @@ static void lk_fini(Int exitcode) ULong total_Jccs = n_Jccs + n_IJccs; ULong taken_Jccs = (n_Jccs - n_Jccs_untaken) + n_IJccs_untaken; - VG_(umsg)("Counted %'llu calls to %s()\n", n_func_calls, clo_fnname); + VG_(umsg)("Counted %'llu call%s to %s()\n", + n_func_calls, ( n_func_calls==1 ? "" : "s" ), clo_fnname); VG_(umsg)("\n"); VG_(umsg)("Jccs:\n");