lkml.org 
[lkml]   [2021]   [Apr]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v4 15/25] perf stat: Filter out unmatched aggregation for hybrid event
From
Date
Hi Jiri,

On 4/22/2021 2:29 AM, Jiri Olsa wrote:
> On Fri, Apr 16, 2021 at 10:05:07PM +0800, Jin Yao wrote:
>
> SNIP
>
>> diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c
>> index 5255d78b1c30..15eafd249e46 100644
>> --- a/tools/perf/util/stat-display.c
>> +++ b/tools/perf/util/stat-display.c
>> @@ -643,6 +643,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,
>> @@ -656,6 +670,12 @@ static void print_counter_aggrdata(struct perf_stat_config *config,
>> double uval;
>>
>> ad.id = id = config->aggr_map->map[s];
>> +
>> + if (perf_pmu__has_hybrid() &&
>> + !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))
>
> there's same check in aggr_cb, so it seems like we could just make check in here:
>
> if (perf_pmu__has_hybrid() && ad.ena == 0)
> return;
>
> without another extra loop
>
> jirka
>

I guess you recommended the patch like this:

static void print_counter_aggrdata(struct perf_stat_config *config,
struct evsel *counter, int s,
char *prefix, bool metric_only,
@@ -670,17 +656,14 @@ static void print_counter_aggrdata(struct perf_stat_config *config,
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;

+ if (perf_pmu__has_hybrid() && ad.ena == 0)
+ return;
+
nr = ad.nr;
ena = ad.ena;
run = ad.run;

Yes, it works. The test log is,

# perf stat --per-core -e cpu_core/cycles/ -a -- sleep 1

Performance counter stats for 'system wide':

S0-D0-C0 2 2,341,923 cpu_core/cycles/
S0-D0-C4 2 1,707,933 cpu_core/cycles/
S0-D0-C8 2 845,805 cpu_core/cycles/
S0-D0-C12 2 1,001,961 cpu_core/cycles/
S0-D0-C16 2 932,004 cpu_core/cycles/
S0-D0-C20 2 1,778,603 cpu_core/cycles/
S0-D0-C24 2 804,448 cpu_core/cycles/
S0-D0-C28 2 178,360 cpu_core/cycles/

1.002264168 seconds time elapsed

Thanks
Jin Yao

\
 
 \ /
  Last update: 2021-04-22 05:11    [W:0.084 / U:0.584 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site