[PATCH v1 0/4] perf: Fix uncore metric issue

From: Jin Yao
Date: Wed Aug 28 2019 - 02:00:26 EST


Some uncore metrics don't work as expected. For example, on cascadelakex,

root@lkp-csl-2sp2:~# perf stat -M UNC_M_PMM_BANDWIDTH.TOTAL -a -- sleep 1

Performance counter stats for 'system wide':

1841092 unc_m_pmm_rpq_inserts
3680816 unc_m_pmm_wpq_inserts

1.001775055 seconds time elapsed

root@lkp-csl-2sp2:~# perf stat -M UNC_M_PMM_READ_LATENCY -a -- sleep 1

Performance counter stats for 'system wide':

860649746 unc_m_pmm_rpq_occupancy.all
1840557 unc_m_pmm_rpq_inserts
12790627455 unc_m_clockticks

1.001773348 seconds time elapsed

No metrics 'UNC_M_PMM_BANDWIDTH.TOTAL' or 'UNC_M_PMM_READ_LATENCY' are
reported.

The issue is, the case of an alias expanding to mulitple events is
not supported, typically the uncore events.
(see comments in find_evsel_group()). For detail, please check the
description in patch 'perf util: Support multiple events for metricgroup'.

With this patch set,

root@lkp-csl-2sp2:~# perf stat -M UNC_M_PMM_BANDWIDTH.TOTAL -a -- sleep 1

Performance counter stats for 'system wide':

1842108 unc_m_pmm_rpq_inserts # 337.2 MB/sec UNC_M_PMM_BANDWIDTH.TOTAL
3682209 unc_m_pmm_wpq_inserts

1.001819706 seconds time elapsed

root@lkp-csl-2sp2:~# perf stat -M UNC_M_PMM_READ_LATENCY -a -- sleep 1

Performance counter stats for 'system wide':

861970685 unc_m_pmm_rpq_occupancy.all # 219.4 ns UNC_M_PMM_READ_LATENCY
1842772 unc_m_pmm_rpq_inserts
12790196356 unc_m_clockticks

1.001749103 seconds time elapsed

Now we can see the correct metrics 'UNC_M_PMM_BANDWIDTH.TOTAL' and
'UNC_M_PMM_READ_LATENCY'.

Haiyan Song (1):
perf vendor events intel: Update cascadelakex uncore events to v1.04

Jin Yao (3):
perf util: Change convert_scale from static to global
perf util: Scale the metric result
perf util: Support multiple events for metricgroup

.../arch/x86/cascadelakex/uncore-memory.json | 191 ++
.../arch/x86/cascadelakex/uncore-other.json | 1809 ++++++++++++++++-
tools/perf/util/evsel.h | 1 +
tools/perf/util/metricgroup.c | 87 +-
tools/perf/util/metricgroup.h | 1 +
tools/perf/util/pmu.c | 6 +-
tools/perf/util/pmu.h | 2 +
tools/perf/util/stat-shadow.c | 65 +-
8 files changed, 2075 insertions(+), 87 deletions(-)

--
2.17.1