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: <6f91b752-6e00-b595-62d4-e19b2e724eb3@linux.intel.com>
Date:   Tue, 9 Feb 2021 08:53:40 +0800
From:   "Jin, Yao" <yao.jin@...ux.intel.com>
To:     Arnaldo Carvalho de Melo <acme@...nel.org>,
        kan.liang@...ux.intel.com
Cc:     peterz@...radead.org, mingo@...nel.org,
        linux-kernel@...r.kernel.org, tglx@...utronix.de, bp@...en8.de,
        namhyung@...nel.org, jolsa@...hat.com, ak@...ux.intel.com,
        alexander.shishkin@...ux.intel.com, adrian.hunter@...el.com,
        "Jin, Yao" <yao.jin@...el.com>
Subject: Re: [PATCH 46/49] perf stat: Filter out unmatched aggregation for
 hybrid event

Hi Arnaldo,

On 2/9/2021 3:16 AM, Arnaldo Carvalho de Melo wrote:
> Em Mon, Feb 08, 2021 at 07:25:43AM -0800, kan.liang@...ux.intel.com escreveu:
>> From: Jin Yao <yao.jin@...ux.intel.com>
>>
>> perf-stat has supported some aggregation modes, such as --per-core,
>> --per-socket and etc. While for hybrid event, it may only available
>> on part of cpus. So for --per-core, we need to filter out the
>> unavailable cores, for --per-socket, filter out the unavailable
>> sockets, and so on.
>>
>> Before:
>>
>> root@...pl-adl-s-2:~# ./perf stat --per-core -e cpu_core/cycles/ -a -- sleep 1
>>
>>   Performance counter stats for 'system wide':
>>
>> S0-D0-C0           2            311,114      cycles [cpu_core]
> 
> Why not use the pmu style event name, i.e.:
> 
> S0-D0-C0           2            311,114        cpu_core/cycles/
> 
> ?
> 

For "cycles [cpu_core]" style, it's very easy. We just need to set 'stat_config.no_merge = true', 
and no more coding work.

Please let me think about a easy way for pmu style event name.

Thanks
Jin Yao

>> S0-D0-C4           2             59,784      cycles [cpu_core]
>> S0-D0-C8           2            121,287      cycles [cpu_core]
>> S0-D0-C12          2          2,690,245      cycles [cpu_core]
>> S0-D0-C16          2          2,060,545      cycles [cpu_core]
>> S0-D0-C20          2          3,632,251      cycles [cpu_core]
>> S0-D0-C24          2            775,736      cycles [cpu_core]
>> S0-D0-C28          2            742,020      cycles [cpu_core]
>> S0-D0-C32          0      <not counted>      cycles [cpu_core]
>> S0-D0-C33          0      <not counted>      cycles [cpu_core]
>> S0-D0-C34          0      <not counted>      cycles [cpu_core]
>> S0-D0-C35          0      <not counted>      cycles [cpu_core]
>> S0-D0-C36          0      <not counted>      cycles [cpu_core]
>> S0-D0-C37          0      <not counted>      cycles [cpu_core]
>> S0-D0-C38          0      <not counted>      cycles [cpu_core]
>> S0-D0-C39          0      <not counted>      cycles [cpu_core]
>>
>>         1.001779842 seconds time elapsed
>>
>> After:
>>
>> root@...pl-adl-s-2:~# ./perf stat --per-core -e cpu_core/cycles/ -a -- sleep 1
>>
>>   Performance counter stats for 'system wide':
>>
>> S0-D0-C0           2          1,088,230      cycles [cpu_core]
>> S0-D0-C4           2             57,228      cycles [cpu_core]
>> S0-D0-C8           2             98,327      cycles [cpu_core]
>> S0-D0-C12          2          2,741,955      cycles [cpu_core]
>> S0-D0-C16          2          2,090,432      cycles [cpu_core]
>> S0-D0-C20          2          3,192,108      cycles [cpu_core]
>> S0-D0-C24          2          2,910,752      cycles [cpu_core]
>> S0-D0-C28          2            388,696      cycles [cpu_core]
>>
>> Reviewed-by: Andi Kleen <ak@...ux.intel.com>
>> Signed-off-by: Jin Yao <yao.jin@...ux.intel.com>
>> ---
>>   tools/perf/util/stat-display.c | 20 ++++++++++++++++++++
>>   1 file changed, 20 insertions(+)
>>
>> diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c
>> index 21a3f80..fa11572 100644
>> --- a/tools/perf/util/stat-display.c
>> +++ b/tools/perf/util/stat-display.c
>> @@ -630,6 +630,20 @@ static void aggr_cb(struct perf_stat_config *config,
>>   	}
>>   }
>>   
>> +static bool aggr_id_hybrid_matched(struct perf_stat_config *config,
>> +				   struct evsel *counter, struct aggr_cpu_id id)
>> +{
>> +	struct aggr_cpu_id s;
>> +
>> +	for (int i = 0; i < evsel__nr_cpus(counter); i++) {
>> +		s = config->aggr_get_id(config, evsel__cpus(counter), i);
>> +		if (cpu_map__compare_aggr_cpu_id(s, id))
>> +			return true;
>> +	}
>> +
>> +	return false;
>> +}
>> +
>>   static void print_counter_aggrdata(struct perf_stat_config *config,
>>   				   struct evsel *counter, int s,
>>   				   char *prefix, bool metric_only,
>> @@ -643,6 +657,12 @@ static void print_counter_aggrdata(struct perf_stat_config *config,
>>   	double uval;
>>   
>>   	ad.id = id = config->aggr_map->map[s];
>> +
>> +	if (perf_pmu__hybrid_exist() &&
>> +	    !aggr_id_hybrid_matched(config, counter, id)) {
>> +		return;
>> +	}
>> +
>>   	ad.val = ad.ena = ad.run = 0;
>>   	ad.nr = 0;
>>   	if (!collect_data(config, counter, aggr_cb, &ad))
>> -- 
>> 2.7.4
>>
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ