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:   Tue, 28 Jul 2020 09:36:29 -0300
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Jiri Olsa <jolsa@...nel.org>
Cc:     lkml <linux-kernel@...r.kernel.org>,
        Ingo Molnar <mingo@...nel.org>,
        Namhyung Kim <namhyung@...nel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Peter Zijlstra <a.p.zijlstra@...llo.nl>,
        Michael Petlan <mpetlan@...hat.com>,
        Andi Kleen <ak@...ux.intel.com>,
        Kajol Jain <kjain@...ux.ibm.com>,
        John Garry <john.garry@...wei.com>,
        "Paul A. Clarke" <pc@...ibm.com>,
        Stephane Eranian <eranian@...gle.com>,
        Ian Rogers <irogers@...gle.com>
Subject: Re: [PATCH 16/19] perf metric: Make compute_single function more
 precise

Em Sun, Jul 19, 2020 at 08:13:17PM +0200, Jiri Olsa escreveu:
> So far compute_single function relies on the fact, that
> there's only single metric defined within evlist in all
> tests. In following patch we will add test for metric
> group, so we need to be able to compute metric by given
> name.
> 
> Adding the name argument to compute_single and iterating
> evlist and evsel's expression to find the given metric.

Applied, thanks.

Ian, Kajol, I didn't notice your Acked-by or Reviewed-by, like for the
other patches, can you check?

- Arnaldo
 
> Signed-off-by: Jiri Olsa <jolsa@...nel.org>
> ---
>  tools/perf/tests/parse-metric.c | 22 +++++++++++++---------
>  1 file changed, 13 insertions(+), 9 deletions(-)
> 
> diff --git a/tools/perf/tests/parse-metric.c b/tools/perf/tests/parse-metric.c
> index 01370ccb9ed9..5ac32f80f8ea 100644
> --- a/tools/perf/tests/parse-metric.c
> +++ b/tools/perf/tests/parse-metric.c
> @@ -108,17 +108,21 @@ static void load_runtime_stat(struct runtime_stat *st, struct evlist *evlist,
>  }
>  
>  static double compute_single(struct rblist *metric_events, struct evlist *evlist,
> -			     struct runtime_stat *st)
> +			     struct runtime_stat *st, const char *name)
>  {
> -	struct evsel *evsel = evlist__first(evlist);
> +	struct metric_expr *mexp;
>  	struct metric_event *me;
> +	struct evsel *evsel;
>  
> -	me = metricgroup__lookup(metric_events, evsel, false);
> -	if (me != NULL) {
> -		struct metric_expr *mexp;
> -
> -		mexp = list_first_entry(&me->head, struct metric_expr, nd);
> -		return test_generic_metric(mexp, 0, st);
> +	evlist__for_each_entry(evlist, evsel) {
> +		me = metricgroup__lookup(metric_events, evsel, false);
> +		if (me != NULL) {
> +			list_for_each_entry (mexp, &me->head, nd) {
> +				if (strcmp(mexp->metric_name, name))
> +					continue;
> +				return test_generic_metric(mexp, 0, st);
> +			}
> +		}
>  	}
>  	return 0.;
>  }
> @@ -162,7 +166,7 @@ static int compute_metric(const char *name, struct value *vals, double *ratio)
>  	load_runtime_stat(&st, evlist, vals);
>  
>  	/* And execute the metric */
> -	*ratio = compute_single(&metric_events, evlist, &st);
> +	*ratio = compute_single(&metric_events, evlist, &st, name);
>  
>  	/* ... clenup. */
>  	metricgroup__rblist_exit(&metric_events);
> -- 
> 2.25.4
> 

-- 

- Arnaldo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ