Skip to contentSkip to conversation

perf test event_uniquifying: Skip test on platforms without 'clockticks' events

PATCH In review Arnaldo Carvalho de Melo 3 participants 6 messages Jun 5, 2025 – Jun 9, 2025 perf events

lore
Share & tools
lore

Arnaldo Carvalho de Melo

author maintainer
#0 lore raw

PATCH 1/1 perf test event_uniquifying: Skip test on platforms without 'clockticks' events

I'll add this to perf-tools for v6.16, please check.

- Arnaldo

---

This test assumes the 'clockticks' event is generally available, which isn't the case, for instance, on AMD systems such as:

  root@number:~# grep -m1 "model name" /proc/cpuinfo
  model name	: AMD Ryzen 9 9950X3D 16-Core Processor
  root@number:~# perf list clockticks

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

root@number:~#

So skip this test when 'clockticks' isn't available.

This should be improved to find other events that are available in multiple PMUs so that the intent of the test is achieved in more platforms.

Fixes cb422594d62066a5 ("perf test: Add stat uniquifying test")
Cc Adrian Hunter <[email protected]>
Cc Alexander Shishkin <[email protected]>
Cc Andi Kleen <[email protected]>
Cc Chun-Tse Shao <[email protected]>
Cc Dr. David Alan Gilbert <[email protected]>
Cc Howard Chu <[email protected]>
Cc Ian Rogers <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc James Clark <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Kan Liang <[email protected]>
Cc Levi Yun <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Weilin Wang <[email protected]>
---
 tools/perf/tests/shell/stat+event_uniquifying.sh | 6 ++++++
 1 file changed, 6 insertions(+)
tools/perf/tests/shell/stat+event_uniquifying.sh +6 -0
index 5ec35c52b7d9651e..20498b6eadb57702 100755
@@ -49,6 +49,12 @@ test_event_uniquifying() {
     uniquified_event_array+=("${uniquified_event}")
   done < <(${perf_tool} list -v ${event} | grep "\[Kernel PMU event\]")
 
+  if [ ${#uniquified_event_array[@]} -eq 0 ]; then
+    echo "'clocktick' event not available on this machine"
+    err=2
+    return
+  fi
+
   perf_command="${perf_tool} stat -e $event -A -o ${stat_output} -- true"
   $perf_command
 
Signature · 1 line
2.49.0
maintainer
#1 lore raw
Quoted 1 line · Arnaldo Carvalho de Melo

I'll add this to perf-tools for v6.16, please check.

Plesae see

https://lore.kernel.org/linux-perf-users/[email protected]/

Thanks,
Namhyung

Quoted 61 lines

---

This test assumes the 'clockticks' event is generally available, which isn't the case, for instance, on AMD systems such as:

  root@number:~# grep -m1 "model name" /proc/cpuinfo
  model name	: AMD Ryzen 9 9950X3D 16-Core Processor
  root@number:~# perf list clockticks

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

root@number:~#

So skip this test when 'clockticks' isn't available.

This should be improved to find other events that are available in multiple PMUs so that the intent of the test is achieved in more platforms.

Fixes cb422594d62066a5 ("perf test: Add stat uniquifying test")
Cc Adrian Hunter <[email protected]>
Cc Alexander Shishkin <[email protected]>
Cc Andi Kleen <[email protected]>
Cc Chun-Tse Shao <[email protected]>
Cc Dr. David Alan Gilbert <[email protected]>
Cc Howard Chu <[email protected]>
Cc Ian Rogers <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc James Clark <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Kan Liang <[email protected]>
Cc Levi Yun <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Weilin Wang <[email protected]>
---
 tools/perf/tests/shell/stat+event_uniquifying.sh | 6 ++++++
 1 file changed, 6 insertions(+)
tools/perf/tests/shell/stat+event_uniquifying.sh +6 -0
index 5ec35c52b7d9651e..20498b6eadb57702 100755
@@ -49,6 +49,12 @@ test_event_uniquifying() {
     uniquified_event_array+=("${uniquified_event}")
   done < <(${perf_tool} list -v ${event} | grep "\[Kernel PMU event\]")
 
+  if [ ${#uniquified_event_array[@]} -eq 0 ]; then
+    echo "'clocktick' event not available on this machine"
+    err=2
+    return
+  fi
+
   perf_command="${perf_tool} stat -e $event -A -o ${stat_output} -- true"
   $perf_command
 
Signature · 1 line
2.49.0
author maintainer
#2 lore raw
Quoted 6 lines · Namhyung Kim
Quoted 1 line · Arnaldo Carvalho de Melo

I'll add this to perf-tools for v6.16, please check.

Plesae see

https://lore.kernel.org/linux-perf-users/[email protected]/

Oh, great, I'll drop my fix and get that one instead.

- Arnaldo

Quoted 64 lines

Thanks,
Namhyung

Quoted 61 lines

---

This test assumes the 'clockticks' event is generally available, which isn't the case, for instance, on AMD systems such as:

  root@number:~# grep -m1 "model name" /proc/cpuinfo
  model name	: AMD Ryzen 9 9950X3D 16-Core Processor
  root@number:~# perf list clockticks

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

root@number:~#

So skip this test when 'clockticks' isn't available.

This should be improved to find other events that are available in multiple PMUs so that the intent of the test is achieved in more platforms.

Fixes cb422594d62066a5 ("perf test: Add stat uniquifying test")
Cc Adrian Hunter <[email protected]>
Cc Alexander Shishkin <[email protected]>
Cc Andi Kleen <[email protected]>
Cc Chun-Tse Shao <[email protected]>
Cc Dr. David Alan Gilbert <[email protected]>
Cc Howard Chu <[email protected]>
Cc Ian Rogers <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc James Clark <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Kan Liang <[email protected]>
Cc Levi Yun <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Weilin Wang <[email protected]>
---
 tools/perf/tests/shell/stat+event_uniquifying.sh | 6 ++++++
 1 file changed, 6 insertions(+)
tools/perf/tests/shell/stat+event_uniquifying.sh +6 -0
index 5ec35c52b7d9651e..20498b6eadb57702 100755
@@ -49,6 +49,12 @@ test_event_uniquifying() {
     uniquified_event_array+=("${uniquified_event}")
   done < <(${perf_tool} list -v ${event} | grep "\[Kernel PMU event\]")
 
+  if [ ${#uniquified_event_array[@]} -eq 0 ]; then
+    echo "'clocktick' event not available on this machine"
+    err=2
+    return
+  fi
+
   perf_command="${perf_tool} stat -e $event -A -o ${stat_output} -- true"
   $perf_command
 
Signature · 1 line
2.49.0
author maintainer
#3 lore raw
Quoted 9 lines · Arnaldo Carvalho de Melo
Quoted 6 lines · Namhyung Kim
Quoted 1 line · Arnaldo Carvalho de Melo

I'll add this to perf-tools for v6.16, please check.

Plesae see

https://lore.kernel.org/linux-perf-users/[email protected]/

Oh, great, I'll drop my fix and get that one instead.

Nope, that one returns ok if the test can't be performed, it should return 2 so that it is skipped and since we don't have a way to show the reason for skipping a shell test, when using 'perf test -vv' the warning that is there already (the needed PMU not being available) will be shown.

So I'm amending this on top, ok?

tools/perf/tests/shell/stat+event_uniquifying.sh +1 -0
index 5a51fbaa13bb9b3c..c39d77ab4ad95bfc 100755
@@ -47,6 +47,7 @@ test_event_uniquifying() {
   # 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]"
+    err=2
     return
   fi
 

Then we get:

root@number:~# perf test uniqu
 93: perf stat events uniquifying                                    : Skip
root@number:~#

Instead of the misleading:

root@number:~# perf test uniqu
 93: perf stat events uniquifying                                    : Ok
root@number:~# 

With -vv and the fix:

root@number:~# perf test -vv uniqu
 93: perf stat events uniquifying:
--- start ---
test child forked, pid 94671
stat event uniquifying test
Target does not support PMU uncore_imc [Skipped]
---- end(-2) ----
 93: perf stat events uniquifying                                    : Skip
root@number:~#

- Arnaldo

#4 lore raw

Thank you Arnaldo for finding this problem. Please feel free to amend your fix.

-CT

Quoted 56 lines · Arnaldo Carvalho de Melo
Quoted 9 lines · Arnaldo Carvalho de Melo
Quoted 6 lines · Namhyung Kim
Quoted 1 line · Arnaldo Carvalho de Melo

I'll add this to perf-tools for v6.16, please check.

Plesae see

https://lore.kernel.org/linux-perf-users/[email protected]/

Oh, great, I'll drop my fix and get that one instead.

Nope, that one returns ok if the test can't be performed, it should return 2 so that it is skipped and since we don't have a way to show the reason for skipping a shell test, when using 'perf test -vv' the warning that is there already (the needed PMU not being available) will be shown.

So I'm amending this on top, ok?

tools/perf/tests/shell/stat+event_uniquifying.sh +1 -0
index 5a51fbaa13bb9b3c..c39d77ab4ad95bfc 100755
@@ -47,6 +47,7 @@ test_event_uniquifying() {
   # 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]"
+    err=2
     return
   fi
 

Then we get:

root@number:~# perf test uniqu
 93: perf stat events uniquifying                                    : Skip
root@number:~#

Instead of the misleading:

root@number:~# perf test uniqu
 93: perf stat events uniquifying                                    : Ok
root@number:~#

With -vv and the fix:

root@number:~# perf test -vv uniqu
 93: perf stat events uniquifying:
--- start ---
test child forked, pid 94671
stat event uniquifying test
Target does not support PMU uncore_imc [Skipped]
---- end(-2) ----
 93: perf stat events uniquifying                                    : Skip
root@number:~#

- Arnaldo

author maintainer
#5 lore raw
Quoted 1 line · Chun-Tse Shao

Thank you Arnaldo for finding this problem. Please feel free to amend your fix.

Thanks for checking!

- Arnaldo