All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jin, Yao" <yao.jin@linux.intel.com>
To: Jiri Olsa <jolsa@redhat.com>
Cc: acme@kernel.org, jolsa@kernel.org, peterz@infradead.org,
	mingo@redhat.com, alexander.shishkin@linux.intel.com,
	Linux-kernel@vger.kernel.org, ak@linux.intel.com,
	kan.liang@intel.com, yao.jin@intel.com
Subject: Re: [PATCH v2 2/2] perf stat: Report summary for interval mode
Date: Wed, 6 May 2020 18:52:45 +0800	[thread overview]
Message-ID: <e386585b-6208-63a1-82ad-a42c7d61ac72@linux.intel.com> (raw)
In-Reply-To: <20200504234159.GF1916255@krava>

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
> 

      reply	other threads:[~2020-05-06 10:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-02  2:07 [PATCH v2 0/2] perf stat: Support overall statistics for interval mode Jin Yao
2020-05-02  2:07 ` [PATCH v2 1/2] perf evsel: Create counts for collecting summary data Jin Yao
2020-05-04 23:50   ` Jiri Olsa
2020-05-06  8:19     ` Jin, Yao
2020-05-02  2:07 ` [PATCH v2 2/2] perf stat: Report summary for interval mode Jin Yao
2020-05-04 23:41   ` Jiri Olsa
2020-05-06 10:52     ` Jin, Yao [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e386585b-6208-63a1-82ad-a42c7d61ac72@linux.intel.com \
    --to=yao.jin@linux.intel.com \
    --cc=Linux-kernel@vger.kernel.org \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=jolsa@redhat.com \
    --cc=kan.liang@intel.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=yao.jin@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.