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:   Wed, 9 Sep 2020 09:29:10 -0300
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Namhyung Kim <namhyung@...nel.org>
Cc:     Jiri Olsa <jolsa@...hat.com>, Ingo Molnar <mingo@...nel.org>,
        Peter Zijlstra <a.p.zijlstra@...llo.nl>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Stephane Eranian <eranian@...gle.com>,
        LKML <linux-kernel@...r.kernel.org>,
        Ian Rogers <irogers@...gle.com>
Subject: Re: [PATCH 2/3] perf list: Do not print 'Metric Groups:'
 unnecessarily

Em Wed, Sep 09, 2020 at 02:58:48PM +0900, Namhyung Kim escreveu:
> It was printed unconditionally even if nothing is printed.
> Check if the output list empty when filter is given.
> 
> Before:
>   $ ./perf list duration
> 
>   List of pre-defined events (to be used in -e):
> 
>     duration_time                                      [Tool event]
> 
>   Metric Groups:
> 
> After:
>   $ ./perf list duration
> 
>   List of pre-defined events (to be used in -e):
> 
>     duration_time                                      [Tool event]
 
> Signed-off-by: Namhyung Kim <namhyung@...nel.org>

---

Thanks, applied.

- Arnaldo
> 
> diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c
> index 8831b964288f..38464d7d2d63 100644
> --- a/tools/perf/util/metricgroup.c
> +++ b/tools/perf/util/metricgroup.c
> @@ -535,10 +535,12 @@ void metricgroup__print(bool metrics, bool metricgroups, char *filter,
>  		}
>  	}
>  
> -	if (metricgroups && !raw)
> -		printf("\nMetric Groups:\n\n");
> -	else if (metrics && !raw)
> -		printf("\nMetrics:\n\n");
> +	if (!filter || !rblist__empty(&groups)) {
> +		if (metricgroups && !raw)
> +			printf("\nMetric Groups:\n\n");
> +		else if (metrics && !raw)
> +			printf("\nMetrics:\n\n");
> +	}
>  
>  	for (node = rb_first_cached(&groups.entries); node; node = next) {
>  		struct mep *me = container_of(node, struct mep, nd);
> -- 
> 2.28.0.526.ge36021eeef-goog
> 

-- 

- Arnaldo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ