mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-22 02:17:36 -04:00
perf stat: Use aggr_nr scaling for Intel uncore miss latency metrics
Update `metric.py` to support the new `aggr_nr` keyword in the python metric generator. Replace the usage of `source_count` with `aggr_nr` in `IntelMissLat` inside `intel_metrics.py` so that uncore latency metrics (like `lpm_miss_lat`) scale correctly on multi-socket and SNC systems when aggregated globally. Additionally, update the validation bypass logic in `CheckEveryEvent()` inside `metric.py` to whitelist 'cha' and 'uncore' events. This prevents validation failures when compiling metrics referencing these PMU-specific uncore events. Assisted-by: Gemini:gemini-3.1-pro-preview Signed-off-by: Chun-Tse Shao <ctshao@google.com> Tested-by: Zide Chen <zide.chen@intel.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Clark <james.clark@linaro.org> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Leo Yan <leo.yan@arm.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Sandipan Das <sandipan.das@amd.com> Cc: Thomas Falcon <thomas.falcon@intel.com> Cc: Yang Li <yang.lee@linux.alibaba.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
committed by
Arnaldo Carvalho de Melo
parent
e565ceb48b
commit
ca156ab12b
@@ -7,7 +7,7 @@ import os
|
||||
import re
|
||||
from typing import Optional
|
||||
from common_metrics import Cycles
|
||||
from metric import (d_ratio, has_event, max, source_count, CheckPmu, Event,
|
||||
from metric import (d_ratio, has_event, max, aggr_nr, CheckPmu, Event,
|
||||
JsonEncodeMetric, JsonEncodeMetricGroupDescriptions,
|
||||
Literal, LoadEvents, Metric, MetricConstraint, MetricGroup,
|
||||
MetricRef, Select)
|
||||
@@ -735,10 +735,10 @@ def IntelMissLat() -> Optional[MetricGroup]:
|
||||
else:
|
||||
assert data_rd_loc_occ.name == "UNC_CHA_TOR_OCCUPANCY.IA_MISS_DRD_LOCAL", data_rd_loc_occ
|
||||
|
||||
ticks_per_cha = ticks / source_count(data_rd_loc_ins)
|
||||
ticks_per_cha = ticks / aggr_nr(data_rd_loc_ins)
|
||||
loc_lat = interval_sec * 1e9 * data_rd_loc_occ / \
|
||||
(ticks_per_cha * data_rd_loc_ins)
|
||||
ticks_per_cha = ticks / source_count(data_rd_rem_ins)
|
||||
ticks_per_cha = ticks / aggr_nr(data_rd_rem_ins)
|
||||
rem_lat = interval_sec * 1e9 * data_rd_rem_occ / \
|
||||
(ticks_per_cha * data_rd_rem_ins)
|
||||
return MetricGroup("lpm_miss_lat", [
|
||||
|
||||
@@ -93,7 +93,7 @@ def CheckEveryEvent(*names: str) -> None:
|
||||
name = name[:name.find(':')]
|
||||
elif '/' in name:
|
||||
name = name[:name.find('/')]
|
||||
if any([name.startswith(x) for x in ['amd', 'arm', 'cpu', 'msr', 'power']]):
|
||||
if any([name.startswith(x) for x in ['amd', 'arm', 'cpu', 'msr', 'power', 'cha', 'uncore']]):
|
||||
continue
|
||||
if name not in all_events_all_models:
|
||||
raise Exception(f"Is {name} a named json event?")
|
||||
@@ -576,6 +576,11 @@ def source_count(event: Event) -> Function:
|
||||
return Function('source_count', event)
|
||||
|
||||
|
||||
def aggr_nr(event: Event) -> Function:
|
||||
# pylint: disable=invalid-name
|
||||
return Function('aggr_nr', event)
|
||||
|
||||
|
||||
def has_event(event: Event) -> Function:
|
||||
# pylint: disable=redefined-builtin
|
||||
# pylint: disable=invalid-name
|
||||
@@ -762,7 +767,7 @@ def ParsePerfJson(orig: str) -> Expression:
|
||||
# Convert accidentally converted scientific notation constants back
|
||||
py = re.sub(r'([0-9]+)Event\(r"(e[0-9]*)"\)', r'\1\2', py)
|
||||
# Convert all the known keywords back from events to just the keyword
|
||||
keywords = ['if', 'else', 'min', 'max', 'd_ratio', 'source_count', 'has_event', 'strcmp_cpuid_str']
|
||||
keywords = ['if', 'else', 'min', 'max', 'd_ratio', 'source_count', 'aggr_nr', 'has_event', 'strcmp_cpuid_str']
|
||||
for kw in keywords:
|
||||
py = re.sub(rf'Event\(r"{kw}"\)', kw, py)
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user