[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190315133453.GB5200@krava>
Date: Fri, 15 Mar 2019 14:34:53 +0100
From: Jiri Olsa <jolsa@...hat.com>
To: Jin Yao <yao.jin@...ux.intel.com>
Cc: acme@...nel.org, jolsa@...nel.org, peterz@...radead.org,
mingo@...hat.com, alexander.shishkin@...ux.intel.com,
Linux-kernel@...r.kernel.org, ak@...ux.intel.com,
kan.liang@...el.com, yao.jin@...el.com
Subject: Re: [PATCH v1 2/3] perf stat: Support coresum event qualifier
On Sat, Mar 16, 2019 at 12:04:15AM +0800, Jin Yao wrote:
SNIP
> +static void print_counter_aggrdata(struct perf_stat_config *config,
> + struct perf_evsel *counter, int s,
> + char *prefix, bool metric_only,
> + bool *first)
> +{
> + struct aggr_data ad;
> + FILE *output = config->output;
> + u64 ena, run, val;
> + int id, nr;
> + double uval;
> +
> + ad.id = id = config->aggr_map->map[s];
> + ad.val = ad.ena = ad.run = 0;
> + ad.nr = 0;
> + if (!collect_data(config, counter, aggr_cb, &ad))
> + return;
> +
> + nr = ad.nr;
> + ena = ad.ena;
> + run = ad.run;
> + val = ad.val;
> + if (*first && metric_only) {
> + *first = false;
> + aggr_printout(config, counter, id, nr);
> + }
> + if (prefix && !metric_only)
> + fprintf(output, "%s", prefix);
> +
> + uval = val * counter->scale;
> + printout(config, id, nr, counter, uval, prefix,
> + run, ena, 1.0, &rt_stat);
> + if (!metric_only)
> + fputc('\n', output);
> +}
plese put the factoring out of print_counter_aggrdata function
into separate patch
thanks,
jirka
> +
> static void print_aggr(struct perf_stat_config *config,
> struct perf_evlist *evlist,
> char *prefix)
> @@ -606,9 +649,7 @@ static void print_aggr(struct perf_stat_config *config,
> bool metric_only = config->metric_only;
> FILE *output = config->output;
> struct perf_evsel *counter;
> - int s, id, nr;
> - double uval;
> - u64 ena, run, val;
> + int s;
> bool first;
>
> if (!(config->aggr_map || config->aggr_get_id))
> @@ -621,36 +662,16 @@ static void print_aggr(struct perf_stat_config *config,
> * Without each counter has its own line.
> */
> for (s = 0; s < config->aggr_map->nr; s++) {
> - struct aggr_data ad;
> if (prefix && metric_only)
> fprintf(output, "%s", prefix);
>
> - ad.id = id = config->aggr_map->map[s];
> first = true;
> evlist__for_each_entry(evlist, counter) {
> if (is_duration_time(counter))
> continue;
> -
> - ad.val = ad.ena = ad.run = 0;
> - ad.nr = 0;
> - if (!collect_data(config, counter, aggr_cb, &ad))
> - continue;
> - nr = ad.nr;
> - ena = ad.ena;
> - run = ad.run;
> - val = ad.val;
> - if (first && metric_only) {
> - first = false;
> - aggr_printout(config, counter, id, nr);
> - }
> - if (prefix && !metric_only)
> - fprintf(output, "%s", prefix);
> -
> - uval = val * counter->scale;
> - printout(config, id, nr, counter, uval, prefix,
> - run, ena, 1.0, &rt_stat);
> - if (!metric_only)
> - fputc('\n', output);
> + print_counter_aggrdata(config, counter, s,
> + prefix, metric_only,
> + &first);
SNIP
Powered by blists - more mailing lists