Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

perf jevents: Add C-State metrics from the PCU PMU for Intel

Use occupancy events fixed in:

https://lore.kernel.org/lkml/20240226201517.3540187-1-irogers@google.com/

Metrics are at the socket level referring to cores, not hyperthreads.

Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: Thomas Falcon <thomas.falcon@intel.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Benjamin Gray <bgray@linux.ibm.com>
Cc: Caleb Biggers <caleb.biggers@intel.com>
Cc: Edward Baker <edward.baker@intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jing Zhang <renyu.zj@linux.alibaba.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Leo Yan <leo.yan@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Perry Taylor <perry.taylor@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sandipan Das <sandipan.das@amd.com>
Cc: Weilin Wang <weilin.wang@intel.com>
Cc: Xu Yang <xu.yang_2@nxp.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Ian Rogers and committed by
Arnaldo Carvalho de Melo
1fee2701 2166b44b

+30
+30
tools/perf/pmu-events/intel_metrics.py
··· 815 815 ], description="Breakdown of load/store instructions") 816 816 817 817 818 + def UncoreCState() -> Optional[MetricGroup]: 819 + try: 820 + pcu_ticks = Event("UNC_P_CLOCKTICKS") 821 + c0 = Event("UNC_P_POWER_STATE_OCCUPANCY.CORES_C0") 822 + c3 = Event("UNC_P_POWER_STATE_OCCUPANCY.CORES_C3") 823 + c6 = Event("UNC_P_POWER_STATE_OCCUPANCY.CORES_C6") 824 + except: 825 + return None 826 + 827 + num_cores = Literal("#num_cores") / Literal("#num_packages") 828 + 829 + max_cycles = pcu_ticks * num_cores 830 + total_cycles = c0 + c3 + c6 831 + 832 + # remove fused-off cores which show up in C6/C7. 833 + c6 = Select(max(c6 - (total_cycles - max_cycles), 0), 834 + total_cycles > max_cycles, 835 + c6) 836 + 837 + return MetricGroup("lpm_cstate", [ 838 + Metric("lpm_cstate_c0", "C-State cores in C0/C1", 839 + d_ratio(c0, pcu_ticks), "cores"), 840 + Metric("lpm_cstate_c3", "C-State cores in C3", 841 + d_ratio(c3, pcu_ticks), "cores"), 842 + Metric("lpm_cstate_c6", "C-State cores in C6/C7", 843 + d_ratio(c6, pcu_ticks), "cores"), 844 + ]) 845 + 846 + 818 847 def UncoreDir() -> Optional[MetricGroup]: 819 848 try: 820 849 m2m_upd = Event("UNC_M2M_DIRECTORY_UPDATE.ANY") ··· 1008 979 IntelMlp(), 1009 980 IntelPorts(), 1010 981 IntelSwpf(), 982 + UncoreCState(), 1011 983 UncoreDir(), 1012 984 UncoreMem(), 1013 985 UncoreMemBw(),