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] [day] [month] [year] [list]
Message-Id: <20230721234811.a17eea2982501a7dce8e6152@kernel.org>
Date:   Fri, 21 Jul 2023 23:48:11 +0900
From:   Masami Hiramatsu (Google) <mhiramat@...nel.org>
To:     Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:     Namhyung Kim <namhyung@...nel.org>, Ingo Molnar <mingo@...nel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Jiri Olsa <jolsa@...nel.org>, Ian Rogers <irogers@...gle.com>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Clark Williams <williams@...hat.com>,
        Kate Carcia <kcarcia@...hat.com>, linux-kernel@...r.kernel.org,
        linux-perf-users@...r.kernel.org,
        Arnaldo Carvalho de Melo <acme@...hat.com>,
        Andre Fredette <anfredet@...hat.com>,
        Dave Tucker <datucker@...hat.com>,
        Derek Barbosa <debarbos@...hat.com>,
        Masami Hiramatsu <mhiramat@...nel.org>
Subject: Re: [PATCH 3/5] perf bench uprobe: Show diff to previous

On Wed, 19 Jul 2023 17:49:08 -0300
Arnaldo Carvalho de Melo <acme@...nel.org> wrote:

> From: Arnaldo Carvalho de Melo <acme@...hat.com>
> 
> Will be useful to show the incremental overhead as we do more stuff in
> the BPF program attached to the uprobes.

Looks good to me. 

Reviewed-by: Masami Hiramatsu (Google) <mhiramat@...nel.org>

BTW, bench_uprobe_format__default_fprintf() looks like generic for micro benchmarks.
Can it be shared with other benchmarks?

Thank you,

> 
> Cc: Adrian Hunter <adrian.hunter@...el.com>
> Cc: Andre Fredette <anfredet@...hat.com>
> Cc: Clark Williams <williams@...hat.com>
> Cc: Dave Tucker <datucker@...hat.com>
> Cc: Derek Barbosa <debarbos@...hat.com>
> Cc: Ian Rogers <irogers@...gle.com>
> Cc: Jiri Olsa <jolsa@...nel.org>
> Cc: Masami Hiramatsu (Google) <mhiramat@...nel.org>
> Cc: Namhyung Kim <namhyung@...nel.org>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
> ---
>  tools/perf/bench/uprobe.c | 21 ++++++++++++++++-----
>  1 file changed, 16 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/perf/bench/uprobe.c b/tools/perf/bench/uprobe.c
> index 60e7c43298d8cf56..a90e09f791c540a9 100644
> --- a/tools/perf/bench/uprobe.c
> +++ b/tools/perf/bench/uprobe.c
> @@ -36,24 +36,35 @@ static const char * const bench_uprobe_usage[] = {
>  
>  static int bench_uprobe_format__default_fprintf(const char *name, const char *unit, u64 diff, FILE *fp)
>  {
> -	static u64 baseline;
> -	s64 diff_to_baseline = diff - baseline;
> +	static u64 baseline, previous;
> +	s64 diff_to_baseline = diff - baseline,
> +	    diff_to_previous = diff - previous;
>  	int printed = fprintf(fp, "# Executed %'d %s calls\n", loops, name);
>  
>  	printed += fprintf(fp, " %14s: %'" PRIu64 " %ss", "Total time", diff, unit);
>  
> -	if (baseline)
> +	if (baseline) {
>  		printed += fprintf(fp, " %s%'" PRId64 " to baseline", diff_to_baseline > 0 ? "+" : "", diff_to_baseline);
>  
> +		if (previous != baseline)
> +			fprintf(stdout, " %s%'" PRId64 " to previous", diff_to_previous > 0 ? "+" : "", diff_to_previous);
> +	}
> +
>  	printed += fprintf(fp, "\n\n %'.3f %ss/op", (double)diff / (double)loops, unit);
>  
> -	if (baseline)
> +	if (baseline) {
>  		printed += fprintf(fp, " %'.3f %ss/op to baseline", (double)diff_to_baseline / (double)loops, unit);
> -	else
> +
> +		if (previous != baseline)
> +			printed += fprintf(fp, " %'.3f %ss/op to previous", (double)diff_to_previous / (double)loops, unit);
> +	} else {
>  		baseline = diff;
> +	}
>  
>  	fputc('\n', fp);
>  
> +	previous = diff;
> +
>  	return printed + 1;
>  }
>  
> -- 
> 2.41.0
> 


-- 
Masami Hiramatsu (Google) <mhiramat@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ