[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e386585b-6208-63a1-82ad-a42c7d61ac72@linux.intel.com>
Date: Wed, 6 May 2020 18:52:45 +0800
From: "Jin, Yao" <yao.jin@...ux.intel.com>
To: Jiri Olsa <jolsa@...hat.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 v2 2/2] perf stat: Report summary for interval mode
Hi Jiri,
On 5/5/2020 7:41 AM, Jiri Olsa wrote:
> On Sat, May 02, 2020 at 10:07:05AM +0800, Jin Yao wrote:
>
> SNIP
>
>> init_stats(&walltime_nsecs_stats);
>> update_stats(&walltime_nsecs_stats, stat_config.interval * 1000000);
>> print_counters(&rs, 0, NULL);
>> + walltime_nsecs_stats = walltime_nsecs_stats_bak;
>> }
>>
>> static void enable_counters(void)
>> @@ -732,7 +735,14 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx)
>> * avoid arbitrary skew, we must read all counters before closing any
>> * group leaders.
>> */
>> - read_counters(&(struct timespec) { .tv_nsec = t1-t0 });
>> + if (!interval)
>> + read_counters(&(struct timespec) { .tv_nsec = t1-t0 });
>> + else {
>> + stat_config.interval = 0;
>> + stat_config.summary = true;
>> + perf_evlist__copy_summary_counts(evsel_list);
>> + perf_evlist__process_summary_counts(&stat_config, evsel_list);
>
> I think keeping the summary and copying it to evsel->count is ok,
> but when we pretend to have new counts in place, could we process
> it with perf_stat_process_counter function? so we keep just
> 1 processing code?
>
> perhaps have some setup functions for non-interval settings?
>
> SNIP
>
>> +
>> + evsel->prev_raw_counts->aggr = evsel->summary_counts->aggr;
>> +}
>> +
>> +void perf_evlist__copy_summary_counts(struct evlist *evlist)
>> +{
>> + struct evsel *evsel;
>> +
>> + evlist__for_each_entry(evlist, evsel)
>> + perf_evsel__copy_summary_counts(evsel);
>> +}
>> +
>> +static void perf_stat_process_summary_counts(struct perf_stat_config *config,
>> + struct evsel *evsel)
>> +{
>> + struct perf_counts_values *summary = &evsel->summary_counts->aggr;
>
> as I said earlier, why not copy all summary_counts data into 'counts'
> and use the current code the process and display the result?
>
> thanks,
> jirka
>
I'm now working on a much simpler patchset. I will post v3.
Thanks
Jin Yao
>> + struct perf_stat_evsel *ps = evsel->stats;
>> + u64 *count = evsel->summary_counts->aggr.values;
>> + int i;
>> +
>> + if (!config->summary || config->aggr_mode != AGGR_GLOBAL)
>> + return;
>> +
>> + for (i = 0; i < 3; i++)
>> + init_stats(&ps->res_stats[i]);
>> +
>> + perf_counts_values__scale(summary, config->scale,
>> + &evsel->summary_counts->scaled);
>> +
>> + for (i = 0; i < 3; i++)
>
> SNIP
>
Powered by blists - more mailing lists