From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Sohaib Mohamed <sohaib.amhmd@gmail.com>
Cc: rickyman7@gmail.com, irogers@google.com,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
Yury Norov <yury.norov@gmail.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf bench: flush stats when pipe it to a file or to tee
Date: Sat, 13 Nov 2021 09:16:42 -0300 [thread overview]
Message-ID: <YY+sqrAm1sAFEUQ4@kernel.org> (raw)
In-Reply-To: <20211112215313.108823-1-sohaib.amhmd@gmail.com>
Em Fri, Nov 12, 2021 at 11:53:12PM +0200, Sohaib Mohamed escreveu:
> The output of perf bench gets buffered when I pipe it to a file or to
> tee, in such a way that I can see it only at the end.
Good, now try with 'perf test' :-)
Applying,
- Arnaldo
> E.g.
> $ perf bench internals synthesize -t
> < output comes out fine after each test run >
>
> $ perf bench internals synthesize -t | tee file.txt
> < output comes out only at the end of all tests >
>
> See, also:
> $ perf bench mem all | tee file.txt
> $ perf bench sched all | tee file.txt
> $ perf bench internals all -t | tee file.txt
> $ perf bench internals all | tee file.txt
>
> Suggested-by: Riccardo Mancini <rickyman7@gmail.com>
> Signed-off-by: Sohaib Mohamed <sohaib.amhmd@gmail.com>
> ---
> tools/perf/bench/find-bit-bench.c | 1 +
> tools/perf/bench/synthesize.c | 2 ++
> 2 files changed, 3 insertions(+)
>
> diff --git a/tools/perf/bench/find-bit-bench.c b/tools/perf/bench/find-bit-bench.c
> index 22b5cfe97023..39fb4184fbcb 100644
> --- a/tools/perf/bench/find-bit-bench.c
> +++ b/tools/perf/bench/find-bit-bench.c
> @@ -113,6 +113,7 @@ static int do_for_each_set_bit(unsigned int num_bits)
>
> if (use_of_val == accumulator) /* Try to avoid compiler tricks. */
> printf("\n");
> + fflush(stdout);
> }
> bitmap_free(to_test);
> return 0;
> diff --git a/tools/perf/bench/synthesize.c b/tools/perf/bench/synthesize.c
> index 7401ebbac100..d21d311df61b 100644
> --- a/tools/perf/bench/synthesize.c
> +++ b/tools/perf/bench/synthesize.c
> @@ -92,6 +92,7 @@ static int do_run_single_threaded(struct perf_session *session,
> update_stats(&event_stats, atomic_read(&event_count));
> }
>
> + fflush(stdout);
> time_average = avg_stats(&time_stats);
> time_stddev = stddev_stats(&time_stats);
> printf(" Average %ssynthesis took: %.3f usec (+- %.3f usec)\n",
> @@ -186,6 +187,7 @@ static int do_run_multi_threaded(struct target *target,
> perf_session__delete(session);
> }
>
> + fflush(stdout);
> time_average = avg_stats(&time_stats);
> time_stddev = stddev_stats(&time_stats);
> printf(" Average synthesis took: %.3f usec (+- %.3f usec)\n",
> --
> 2.25.1
--
- Arnaldo
next prev parent reply other threads:[~2021-11-13 12:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-12 21:53 [PATCH] perf bench: flush stats when pipe it to a file or to tee Sohaib Mohamed
2021-11-13 12:16 ` Arnaldo Carvalho de Melo [this message]
2021-11-13 12:18 ` Arnaldo Carvalho de Melo
2021-11-15 22:41 ` Sohaib Mohamed
2021-11-16 13:47 ` Arnaldo Carvalho de Melo
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YY+sqrAm1sAFEUQ4@kernel.org \
--to=acme@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=irogers@google.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=rickyman7@gmail.com \
--cc=sohaib.amhmd@gmail.com \
--cc=yury.norov@gmail.com \
/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.
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 NNTP newsgroup(s).