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]
Message-ID: <8ea36c95-3b38-a31e-b05a-41c9ccbada51@linux.intel.com>
Date:   Mon, 18 May 2020 22:44:59 +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 v5 4/5] perf stat: Save aggr value to first member of
 prev_raw_counts



On 5/18/2020 8:48 PM, Jiri Olsa wrote:
> On Thu, May 14, 2020 at 01:36:37PM +0800, Jin Yao wrote:
>> To collect the overall statistics for interval mode, we copy the
>> counts from evsel->prev_raw_counts to evsel->counts.
>>
>> For AGGR_GLOBAL mode, because the perf_stat_process_counter creates
>> aggr values from per cpu values, but the per cpu values are 0,
>> so the calculated aggr values will be always 0.
>>
>> This patch uses a trick that saves the previous aggr value to
>> the first member of perf_counts, then aggr calculation in
>> process_counter_values can work correctly for AGGR_GLOBAL.
>>
>> Signed-off-by: Jin Yao <yao.jin@...ux.intel.com>
>> ---
>>   tools/perf/util/stat.c | 10 ++++++++++
>>   tools/perf/util/stat.h |  1 +
>>   2 files changed, 11 insertions(+)
>>
>> diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c
>> index aadc723ce871..fbabdd5b9b62 100644
>> --- a/tools/perf/util/stat.c
>> +++ b/tools/perf/util/stat.c
>> @@ -249,6 +249,16 @@ void perf_evlist__copy_prev_raw_counts(struct evlist *evlist)
>>   		perf_evsel__copy_prev_raw_counts(evsel);
>>   }
>>   
> 
> much better, please put some comments in here explaning wha
> is this for, because it's not obvious ;-)
> 
> thanks,
> jirka
> 

Thanks, I will put some comments in v6.

Thanks
Jin Yao

>> +void perf_evlist__save_aggr_prev_raw_counts(struct evlist *evlist)
>> +{
>> +	struct evsel *evsel;
>> +
>> +	evlist__for_each_entry(evlist, evsel) {
>> +		*perf_counts(evsel->prev_raw_counts, 0, 0) =
>> +			evsel->prev_raw_counts->aggr;
>> +	}
>> +}
>> +
>>   static void zero_per_pkg(struct evsel *counter)
>>   {
>>   	if (counter->per_pkg_mask)
>> diff --git a/tools/perf/util/stat.h b/tools/perf/util/stat.h
>> index 62cf72c71869..18ead55756cc 100644
>> --- a/tools/perf/util/stat.h
>> +++ b/tools/perf/util/stat.h
>> @@ -199,6 +199,7 @@ void perf_evlist__free_stats(struct evlist *evlist);
>>   void perf_evlist__reset_stats(struct evlist *evlist);
>>   void perf_evlist__reset_prev_raw_counts(struct evlist *evlist);
>>   void perf_evlist__copy_prev_raw_counts(struct evlist *evlist);
>> +void perf_evlist__save_aggr_prev_raw_counts(struct evlist *evlist);
>>   
>>   int perf_stat_process_counter(struct perf_stat_config *config,
>>   			      struct evsel *counter);
>> -- 
>> 2.17.1
>>
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ