From 6b054f132c43a60be3181d6199574d53e7d4f32c Mon Sep 17 00:00:00 2001 From: Julian Seward Date: Thu, 4 Apr 2019 12:08:26 +0200 Subject: [PATCH] DHAT: when the run ends, print a how-to-view-the-profile hint message. n-i-bz. The aim is to make it zero-effort for users to view the profile after a run. The printed message is as follows: To view the resulting profile, open file:///path/to/valgrind/installation/lib/valgrind/dh_view.html in a web browser, click on "Load..." and then select the file /path/to/dhat.out.12345 Scroll to the end the displayed page to see a short explanation of some of the abbreviations used in the page. This patch adds printing of the message, then filters it out in dhat/tests/filter_stderr, and updates the .stderr.exp files to remove blank lines. --- dhat/dh_main.c | 10 ++++++++++ dhat/tests/acc.stderr.exp | 2 -- dhat/tests/basic.stderr.exp | 2 -- dhat/tests/big.stderr.exp | 2 -- dhat/tests/empty.stderr.exp | 2 -- dhat/tests/filter_stderr | 23 +++++++++++++++++++++-- dhat/tests/sig.stderr.exp | 2 -- dhat/tests/single.stderr.exp | 2 -- 8 files changed, 31 insertions(+), 14 deletions(-) diff --git a/dhat/dh_main.c b/dhat/dh_main.c index ffcf874619..ece2eed771 100644 --- a/dhat/dh_main.c +++ b/dhat/dh_main.c @@ -1441,6 +1441,16 @@ static void dh_fini(Int exit_status) g_curr_bytes, g_curr_blocks); VG_(umsg)("Reads: %'llu bytes\n", g_reads_bytes); VG_(umsg)("Writes: %'llu bytes\n", g_writes_bytes); + + // Print a how-to-view-the-profile hint. + VG_(umsg)("\n"); + VG_(umsg)("To view the resulting profile, open\n"); + VG_(umsg)(" file://%s/%s\n", VG_(libdir), "dh_view.html"); + VG_(umsg)("in a web browser, click on \"Load...\" " + "and then select the file\n"); + VG_(umsg)(" %s\n", dhat_out_file); + VG_(umsg)("Scroll to the end the displayed page to see a short\n"); + VG_(umsg)("explanation of some of the abbreviations used in the page.\n"); } //------------------------------------------------------------// diff --git a/dhat/tests/acc.stderr.exp b/dhat/tests/acc.stderr.exp index 7732270733..e48b16efc0 100644 --- a/dhat/tests/acc.stderr.exp +++ b/dhat/tests/acc.stderr.exp @@ -1,5 +1,3 @@ - - Total: 2,534 bytes in 9 blocks At t-gmax: 1,025 bytes in 1 blocks At t-end: 0 bytes in 0 blocks diff --git a/dhat/tests/basic.stderr.exp b/dhat/tests/basic.stderr.exp index bcdec65409..cc714443dd 100644 --- a/dhat/tests/basic.stderr.exp +++ b/dhat/tests/basic.stderr.exp @@ -1,5 +1,3 @@ - - Total: 6,000 bytes in 3 blocks At t-gmax: 5,000 bytes in 2 blocks At t-end: 3,000 bytes in 1 blocks diff --git a/dhat/tests/big.stderr.exp b/dhat/tests/big.stderr.exp index 57339767ed..04092b6060 100644 --- a/dhat/tests/big.stderr.exp +++ b/dhat/tests/big.stderr.exp @@ -1,5 +1,3 @@ - - Total: 1,000 bytes in 19 blocks At t-gmax: 706 bytes in 1 blocks At t-end: 294 bytes in 18 blocks diff --git a/dhat/tests/empty.stderr.exp b/dhat/tests/empty.stderr.exp index 6b189fd673..e5adf9120b 100644 --- a/dhat/tests/empty.stderr.exp +++ b/dhat/tests/empty.stderr.exp @@ -1,5 +1,3 @@ - - Total: 0 bytes in 0 blocks At t-gmax: 0 bytes in 0 blocks At t-end: 0 bytes in 0 blocks diff --git a/dhat/tests/filter_stderr b/dhat/tests/filter_stderr index 6b4058be9d..e02ecc8448 100755 --- a/dhat/tests/filter_stderr +++ b/dhat/tests/filter_stderr @@ -4,6 +4,25 @@ dir=`dirname $0` $dir/../../tests/filter_stderr_basic | -# Remove "Massif, ..." line and the following copyright line. -sed "/^DHAT, a dynamic heap analysis tool/ , /./ d" +# Remove the "DHAT, ..." line and the following copyright line. +sed "/^DHAT, a dynamic heap analysis tool/ , /./ d" | +# Remove the six hint-lines, which look like this: +# +# To view the resulting profile, open +# file:///path/to/valgrind/installation/lib/valgrind/dh_view.html +# in a web browser, click on "Load..." and then select the file +# /path/to/dhat.out.12345 +# Scroll to the end the displayed page to see a short +# explanation of some of the abbreviations used in the page. +# +sed "/^To view the resulting profile/ d" | +sed "/^ file:\/\/\// d" | +sed "/^in a web browser/ d" | +sed "/^ \// d" | # This is pretty feeble, but I don't see + # how to do better +sed "/^Scroll to the end/ d" | +sed "/^explanation of some/ d" | + +# and remove any blank lines in the output +sed "/^[[:space:]]*$/d" diff --git a/dhat/tests/sig.stderr.exp b/dhat/tests/sig.stderr.exp index d5a50cf2b0..fc0af355a6 100644 --- a/dhat/tests/sig.stderr.exp +++ b/dhat/tests/sig.stderr.exp @@ -1,5 +1,3 @@ - - Total: 102 bytes in 16 blocks At t-gmax: 102 bytes in 16 blocks At t-end: 102 bytes in 16 blocks diff --git a/dhat/tests/single.stderr.exp b/dhat/tests/single.stderr.exp index 87e818599d..ba8c41605e 100644 --- a/dhat/tests/single.stderr.exp +++ b/dhat/tests/single.stderr.exp @@ -1,5 +1,3 @@ - - Total: 16 bytes in 1 blocks At t-gmax: 16 bytes in 1 blocks At t-end: 16 bytes in 1 blocks -- 2.47.2