From: Tomi Ollila <tomi.ollila@iki.fi>
To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org
Subject: Re: [PATCH] perf-test: add option to run perf
Date: Sun, 25 Apr 2021 18:55:12 +0300 [thread overview]
Message-ID: <m2wnsqmk9r.fsf@guru.guru-group.fi> (raw)
In-Reply-To: <20210425152816.2501198-1-david@tethera.net>
On Sun, Apr 25 2021, David Bremner wrote:
> Although the generation of perf data is not as slow as valgrind, it
> seems simplest to re-use the machinery already there to save the logs
> in a timestamped subdirectory.
> ---
>
> I'm not sure about the use of --call-graph=lbr here. On the one hand,
> the documentation mentions it depends on recent intel hardware. On the
> other hand, fp does not work for me (just gives 00000000000) and dwarf
> yields giant data files that take painfully long to run "perf report"
> on.
>
>
> performance-test/perf-test-lib.sh | 27 +++++++++++++++++++++++----
> 1 file changed, 23 insertions(+), 4 deletions(-)
>
> diff --git a/performance-test/perf-test-lib.sh b/performance-test/perf-test-lib.sh
> index b70288cc..216d1824 100644
> --- a/performance-test/perf-test-lib.sh
> +++ b/performance-test/perf-test-lib.sh
> @@ -2,6 +2,7 @@
>
> corpus_size=large
>
> +use_perf=0
> while test "$#" -ne 0
In above, newline consistency (perhaps all vars in "block", then
newline). Now that this is added perhaps debug also (or is it
supposed that debug=t from environment has effect ;)
> do
> case "$1" in
> @@ -9,6 +10,10 @@ do
> debug=t;
> shift
> ;;
> + -p|--perf)
> + use_perf=1;
> + shift
> + ;;
> -s|--small)
> corpus_size=small;
> shift
> @@ -127,10 +132,20 @@ notmuch_new_with_cache ()
> fi
> }
>
> +make_log_dir () {
> + local timestamp=$(date +%Y%m%dT%H%M%S)
> + log_dir="${TEST_DIRECTORY}/log.$(basename $0)-$corpus_size-${timestamp}"
> + mkdir -p ${log_dir}
This is copy from deleted code -- just that quoting is just as "wrong" as
it can be >;) -- var=val does not need quotes, OTOH "val" in command
argument does need quotes (in order to escape $IFS splitting) -- if that
mattered.
> +}
> +
> time_start ()
> {
> add_email_corpus
>
> + if [[ "X$use_perf" = "X1" ]]; then
Consistently w/ [[ "$corpus_size" != "large" ]] just if [[ "$use_perf" = 1 ]]
> + make_log_dir
> + fi
> +
> print_header
>
> notmuch_new_with_cache time_run
> @@ -140,9 +155,7 @@ memory_start ()
> {
> add_email_corpus
>
> - local timestamp=$(date +%Y%m%dT%H%M%S)
> - log_dir="${TEST_DIRECTORY}/log.$(basename $0)-$corpus_size-${timestamp}"
> - mkdir -p ${log_dir}
> + make_log_dir
>
> notmuch_new_with_cache memory_run
> }
> @@ -193,7 +206,13 @@ time_run ()
> printf " %-22s" "$1"
> test_count=$(($test_count+1))
> if test "$verbose" != "t"; then exec 4>test.output 3>&4; fi
> - if ! eval >&3 "/usr/bin/time -f '%e\t%U\t%S\t%M\t%I/%O' $2" ; then
> + if [[ "X$use_perf" = "X1" ]]; then
ditto
> + command_str="perf record --call-graph=lbr -o ${log_dir}/${test_count}.perf $2"
> + else
> + command_str="/usr/bin/time -f '%e\t%U\t%S\t%M\t%I/%O' $2"
> + fi
> +
> + if ! eval >&3 "$command_str" ; then
> test_failure=$(($test_failure + 1))
> return 1
> fi
> --
> 2.30.2
next prev parent reply other threads:[~2021-04-25 15:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-25 15:28 [PATCH] perf-test: add option to run perf David Bremner
2021-04-25 15:55 ` Tomi Ollila [this message]
2021-04-28 12:06 ` David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2wnsqmk9r.fsf@guru.guru-group.fi \
--to=tomi.ollila@iki.fi \
--cc=david@tethera.net \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).