lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 13 Nov 2021 09:18:22 -0300
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Sohaib Mohamed <sohaib.amhmd@...il.com>
Cc:     rickyman7@...il.com, irogers@...gle.com,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...hat.com>,
        Namhyung Kim <namhyung@...nel.org>,
        Yury Norov <yury.norov@...il.com>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] perf bench: flush stats when pipe it to a file or to tee

Em Sat, Nov 13, 2021 at 09:16:42AM -0300, Arnaldo Carvalho de Melo escreveu:
> 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,

Humm, take that back, when I almost did it for 'perf test' I used
setvbuf(), take a look at it so that you don't have to go sprinkling
fflush() calls and missing some places.

- Arnaldo
 
> - 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@...il.com>
> > Signed-off-by: Sohaib Mohamed <sohaib.amhmd@...il.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

-- 

- Arnaldo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ