Skip to contentSkip to conversation

perf test: Restrict uniquifying test to machines with uncore_imc

PATCH In review Chun-Tse Shao 2 participants 3 messages May 21, 2025 – Jun 4, 2025 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf test: Restrict uniquifying test to machines with uncore_imc

The test would fail if target machine does not have uncore_imc devices. Since event uniquifying behavior is similar among different architectures, we are restricting the test to only run on machines with uncore_imc devices.

---
 tools/perf/tests/shell/stat+event_uniquifying.sh | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
tools/perf/tests/shell/stat+event_uniquifying.sh +9 -2
index 5ec35c52b7d9..5a51fbaa13bb 100755
@@ -9,7 +9,8 @@ perf_tool=perf
 err=0
 
 test_event_uniquifying() {
-  # We use `clockticks` to verify the uniquify behavior.
+  # We use `clockticks` in `uncore_imc` to verify the uniquify behavior.
+  pmu="uncore_imc"
   event="clockticks"
 
   # If the `-A` option is added, the event should be uniquified.
@@ -43,11 +44,17 @@ test_event_uniquifying() {
   echo "stat event uniquifying test"
   uniquified_event_array=()
 
+  # Skip if the machine does not have `uncore_imc` device.
+  if ! ${perf_tool} list pmu | grep -q ${pmu}; then
+    echo "Target does not support pmu ${pmu} [Skipped]"
+    return
+  fi
+
   # Check how many uniquified events.
   while IFS= read -r line; do
     uniquified_event=$(echo "$line" | awk '{print $1}')
     uniquified_event_array+=("${uniquified_event}")
-  done < <(${perf_tool} list -v ${event} | grep "\[Kernel PMU event\]")
+  done < <(${perf_tool} list -v ${event} | grep ${pmu})
 
   perf_command="${perf_tool} stat -e $event -A -o ${stat_output} -- true"
   $perf_command

--
2.49.0.1143.g0be31eac6b-goog

#1 lore raw

Ping.

Thanks,
CT

Quoted 48 lines · Chun-Tse Shao

The test would fail if target machine does not have uncore_imc devices. Since event uniquifying behavior is similar among different architectures, we are restricting the test to only run on machines with uncore_imc devices.

---
 tools/perf/tests/shell/stat+event_uniquifying.sh | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
tools/perf/tests/shell/stat+event_uniquifying.sh +9 -3
index 5ec35c52b7d9..5a51fbaa13bb 100755
@@ -9,7 +9,8 @@ perf_tool=perf
 err=0
 
 test_event_uniquifying() {
-  # We use `clockticks` to verify the uniquify behavior.
+  # We use `clockticks` in `uncore_imc` to verify the uniquify behavior.
+  pmu="uncore_imc"
   event="clockticks"
 
   # If the `-A` option is added, the event should be uniquified.
@@ -43,11 +44,17 @@ test_event_uniquifying() {
   echo "stat event uniquifying test"
   uniquified_event_array=()
 
+  # Skip if the machine does not have `uncore_imc` device.
+  if ! ${perf_tool} list pmu | grep -q ${pmu}; then
+    echo "Target does not support pmu ${pmu} [Skipped]"
+    return
+  fi
+
   # Check how many uniquified events.
   while IFS= read -r line; do
     uniquified_event=$(echo "$line" | awk '{print $1}')
     uniquified_event_array+=("${uniquified_event}")
-  done < <(${perf_tool} list -v ${event} | grep "\[Kernel PMU event\]")
+  done < <(${perf_tool} list -v ${event} | grep ${pmu})
 
   perf_command="${perf_tool} stat -e $event -A -o ${stat_output} -- true"
   $perf_command
--

2.49.0.1143.g0be31eac6b-goog

reviewer
#2 lore raw
Quoted 26 lines · Chun-Tse Shao

Ping.

Thanks,
CT

Quoted 19 lines · Chun-Tse Shao

The test would fail if target machine does not have uncore_imc devices. Since event uniquifying behavior is similar among different architectures, we are restricting the test to only run on machines with uncore_imc devices.

---
 tools/perf/tests/shell/stat+event_uniquifying.sh | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
tools/perf/tests/shell/stat+event_uniquifying.sh +0 -0
index 5ec35c52b7d9..5a51fbaa13bb 100755
@@ -9,7 +9,8 @@ perf_tool=perf
 err=0
 
Quoted 5 lines

tools/perf/tests/shell/stat+event_uniquifying.sh perf_tool=perf · line 14

Quoted 5 lines
tools/perf/tests/shell/stat+event_uniquifying.sh +2 -1
 test_event_uniquifying() {
-  # We use `clockticks` to verify the uniquify behavior.
+  # We use `clockticks` in `uncore_imc` to verify the uniquify behavior.
+  pmu="uncore_imc"
   event="clockticks"

I'm a little concerned the test will only run on Intel server CPUs. Another event that is on a lot of PMUs and needs uniquify is "temp1" by way of the hwmon PMUs. Essentially the first temperature event on a hwmon PMU will always have a temp1 name.

```
$ perf list temp1

List of pre-defined events (to be used in -e or -M):


hwmon:
 temp1
      [Temperature in unit acpitz named temp1. Unit: hwmon_acpitz]
 temp_core_12 OR temp14
      [Temperature in unit coretemp named Core 12. crit=100'C,max=80'C
crit_alarm=0'C. Unit:
       hwmon_coretemp]
 temp_core_16 OR temp18
      [Temperature in unit coretemp named Core 16. crit=100'C,max=80'C
crit_alarm=0'C. Unit:
       hwmon_coretemp]
 temp_core_8 OR temp10
      [Temperature in unit coretemp named Core 8. crit=100'C,max=80'C
crit_alarm=0'C. Unit:
       hwmon_coretemp]
 temp_package_id_0 OR temp1
      [Temperature in unit coretemp named Package id 0.
crit=100'C,max=80'C crit_alarm=0'C. Unit:
       hwmon_coretemp]
 temp1
      [Temperature in unit iwlwifi_1 named temp1. Unit: hwmon_iwlwifi_1]
 temp_composite OR temp1
      [Temperature in unit nvme named Composite.
alarm=0'C,crit=84.85'C,max=80.85'C,
       min=-273.15'C. Unit: hwmon_nvme]
 temp1
      [Temperature in unit spd5118 named temp1.
crit=85'C,enable=0.001'C,lcrit=0'C,max=55'C,
       min=0'C crit_alarm=0'C,lcrit_alarm=0'C,min_alarm=0'C. Unit:
hwmon_spd5118]
$ perf stat -e temp1 true

Performance counter stats for 'true':

18,446,744,073,709,284.00 'C   hwmon_acpitz/temp1/

            40.00 'C   hwmon_coretemp/temp1/
            30.00 'C   hwmon_iwlwifi_1/temp1/
            38.85 'C   hwmon_nvme/temp1/
            43.75 'C   hwmon_spd5118/temp1/

      0.001488897 seconds time elapsed

      0.000000000 seconds user
      0.001568000 seconds sys
```

Thanks,
Ian

Quoted 24 lines
Quoted 24 lines
tools/perf/tests/shell/stat+event_uniquifying.sh +7 -2
   # If the `-A` option is added, the event should be uniquified.
@@ -43,11 +44,17 @@ test_event_uniquifying() {
   echo "stat event uniquifying test"
   uniquified_event_array=()
 
+  # Skip if the machine does not have `uncore_imc` device.
+  if ! ${perf_tool} list pmu | grep -q ${pmu}; then
+    echo "Target does not support pmu ${pmu} [Skipped]"
+    return
+  fi
+
   # Check how many uniquified events.
   while IFS= read -r line; do
     uniquified_event=$(echo "$line" | awk '{print $1}')
     uniquified_event_array+=("${uniquified_event}")
-  done < <(${perf_tool} list -v ${event} | grep "\[Kernel PMU event\]")
+  done < <(${perf_tool} list -v ${event} | grep ${pmu})
 
   perf_command="${perf_tool} stat -e $event -A -o ${stat_output} -- true"
   $perf_command
--

2.49.0.1143.g0be31eac6b-goog