From 67ef1e15c3cdd86abe3f28d66a85a722d6559649 Mon Sep 17 00:00:00 2001 From: Julian Seward Date: Wed, 5 Oct 2016 04:32:44 +0000 Subject: [PATCH] DHAT currently has "max-bytes-live", "max-blocks-live", and "tot-bytes-allocd" orderings. This adds "tot-blocks-allocd", which completes the 2x2 matrix and is useful too. n-i-bz. From n.nethercote@gmail.com. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16006 --- exp-dhat/dh_main.c | 11 ++++++++++- exp-dhat/docs/dh-manual.xml | 17 +++++++++-------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/exp-dhat/dh_main.c b/exp-dhat/dh_main.c index 3476cd9b36..1589fee758 100644 --- a/exp-dhat/dh_main.c +++ b/exp-dhat/dh_main.c @@ -1065,8 +1065,9 @@ static void dh_print_usage(void) " sort the allocation points by the metric\n" " defined by , thusly:\n" " max-bytes-live maximum live bytes [default]\n" -" tot-bytes-allocd total allocation (turnover)\n" +" tot-bytes-allocd bytes allocated in total (turnover)\n" " max-blocks-live maximum live blocks\n" +" tot-blocks-allocd blocks allocated in total (turnover)\n" ); } @@ -1175,6 +1176,9 @@ static ULong get_metric__tot_bytes ( APInfo* api ) { static ULong get_metric__max_blocks_live ( APInfo* api ) { return api->max_blocks_live; } +static ULong get_metric__tot_blocks ( APInfo* api ) { + return api->tot_blocks; +} /* Given a string, return the metric-access function and also a Bool indicating whether we want increasing or decreasing values of the @@ -1200,6 +1204,11 @@ static Bool identify_metric ( /*OUT*/ULong(**get_metricP)(APInfo*), *increasingP = False; return True; } + if (0 == VG_(strcmp)(metric_name, "tot-blocks-allocd")) { + *get_metricP = get_metric__tot_blocks; + *increasingP = False; + return True; + } return False; } diff --git a/exp-dhat/docs/dh-manual.xml b/exp-dhat/docs/dh-manual.xml index 49df7a6b78..4836c398db 100644 --- a/exp-dhat/docs/dh-manual.xml +++ b/exp-dhat/docs/dh-manual.xml @@ -372,16 +372,17 @@ to be the case, but it could happen. allocation points according to some metric, and shows the highest scoring entries. --sort-by selects the metric used for sorting: - max-bytes-live maximum live bytes [default] - tot-bytes-allocd total allocation (turnover) - max-blocks-live maximum live blocks + max-bytes-live maximum live bytes [default] + tot-bytes-allocd bytes allocates in total (turnover) + max-blocks-live maximum live blocks + tot-blocks-allocd blocks allocated in total (turnover) This controls the order in which allocation points are displayed. You can choose to look at allocation points with - the highest maximum liveness, or the highest total turnover, or - by the highest number of live blocks. These give usefully - different pictures of program behaviour. For example, sorting - by maximum live blocks tends to show up allocation points - creating large numbers of small objects. + the highest number of live bytes, or the highest total byte turnover, or + by the highest number of live blocks, or the highest total block + turnover. These give usefully different pictures of program behaviour. + For example, sorting by maximum live blocks tends to show up allocation + points creating large numbers of small objects. -- 2.47.2