Skip to contentSkip to conversation

perf test: Stat std output match 2 metrics for stalled-cycles-backend

PATCH In review Ian Rogers 2 participants 4 messages Apr 2 – Apr 7 perf events

lore
Share & tools
lore

Ian Rogers

author reviewer
#0 lore raw

PATCH 1/1 perf test: Stat std output match 2 metrics for stalled-cycles-backend

Seen on ARM, the stalled-cycles-backend event can be given as the event for both backend_cycles_idle and stalled_cycles_per_instruction metrics. Make the metric match sufficiently generic to allow this.

---
 tools/perf/tests/shell/stat+std_output.sh | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
tools/perf/tests/shell/stat+std_output.sh +5 -2
index 9c4b92ecf448..5a6bda436dd4 100755
@@ -11,9 +11,12 @@ set -e
 
 stat_output=$(mktemp /tmp/__perf_test.stat_output.std.XXXXX)
 
+# For event_name[i] expect to see event_metric[i]. 'stalled-cycles-backend' may
+# match both 'backend_cycles_idle' and 'stalled_cycles_per_instruction', hence
+# matching "_cycles_".
 event_name=(cpu-clock task-clock context-switches cpu-migrations page-faults stalled-cycles-frontend stalled-cycles-backend cycles instructions branches branch-misses)
-event_metric=("CPUs_utilized" "CPUs_utilized" "cs/sec" "migrations/sec" "faults/sec" "frontend_cycles_idle" "backend_cycles_idle" "GHz" "insn_per_cycle" "/sec" "branch_miss_rate")
-skip_metric=("tma_" "TopdownL1")
+event_metric=("CPUs_utilized" "CPUs_utilized" "cs/sec" "migrations/sec" "faults/sec" "frontend_cycles_idle" "_cycles_" "GHz" "insn_per_cycle" "/sec" "branch_miss_rate")
+skip_metric=("tma_" "TopdownL1" "percent of slots")
 
 cleanup() {
   rm -f "${stat_output}"
Signature · 1 line
2.53.0.1213.gd9a14994de-goog
maintainer
#1 lore raw
Quoted 14 lines · Ian Rogers

Seen on ARM, the stalled-cycles-backend event can be given as the event for both backend_cycles_idle and stalled_cycles_per_instruction metrics. Make the metric match sufficiently generic to allow this.

---
 tools/perf/tests/shell/stat+std_output.sh | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
tools/perf/tests/shell/stat+std_output.sh +0 -0
index 9c4b92ecf448..5a6bda436dd4 100755

tools/perf/tests/shell/stat+std_output.sh set -e · line 18

Quoted 10 lines
tools/perf/tests/shell/stat+std_output.sh +4 -2
@@ -11,9 +11,12 @@ set -e
 
 stat_output=$(mktemp /tmp/__perf_test.stat_output.std.XXXXX)
 
+# For event_name[i] expect to see event_metric[i]. 'stalled-cycles-backend' may
+# match both 'backend_cycles_idle' and 'stalled_cycles_per_instruction', hence
+# matching "_cycles_".
 event_name=(cpu-clock task-clock context-switches cpu-migrations page-faults stalled-cycles-frontend stalled-cycles-backend cycles instructions branches branch-misses)
-event_metric=("CPUs_utilized" "CPUs_utilized" "cs/sec" "migrations/sec" "faults/sec" "frontend_cycles_idle" "backend_cycles_idle" "GHz" "insn_per_cycle" "/sec" "branch_miss_rate")
-skip_metric=("tma_" "TopdownL1")
+event_metric=("CPUs_utilized" "CPUs_utilized" "cs/sec" "migrations/sec" "faults/sec" "frontend_cycles_idle" "_cycles_" "GHz" "insn_per_cycle" "/sec" "branch_miss_rate")

Is this used for partial string match?

Then I guess "frontend_cycles_idle" can be covered by "_cycles_" too? Also as we have "/sec", can "cs/sec" and "migrations/sec" be removed?

tools/perf/tests/shell/stat+std_output.sh set -e · line 19

Quoted 1 line
tools/perf/tests/shell/stat+std_output.sh +1 -0
+skip_metric=("tma_" "TopdownL1" "percent of slots")

Why is "percent of slots" added as well?

Thanks,
Namhyung

Quoted 6 lines
tools/perf/tests/shell/stat+std_output.sh +0 -0
 cleanup() {
   rm -f "${stat_output}"
Signature · 1 line
2.53.0.1213.gd9a14994de-goog
author reviewer
#2 lore raw
Quoted 29 lines · Namhyung Kim
Quoted 14 lines · Ian Rogers

Seen on ARM, the stalled-cycles-backend event can be given as the event for both backend_cycles_idle and stalled_cycles_per_instruction metrics. Make the metric match sufficiently generic to allow this.

---
 tools/perf/tests/shell/stat+std_output.sh | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
tools/perf/tests/shell/stat+std_output.sh +0 -0
index 9c4b92ecf448..5a6bda436dd4 100755

tools/perf/tests/shell/stat+std_output.sh set -e · line 18

Quoted 10 lines
tools/perf/tests/shell/stat+std_output.sh +4 -2
@@ -11,9 +11,12 @@ set -e
 
 stat_output=$(mktemp /tmp/__perf_test.stat_output.std.XXXXX)
 
+# For event_name[i] expect to see event_metric[i]. 'stalled-cycles-backend' may
+# match both 'backend_cycles_idle' and 'stalled_cycles_per_instruction', hence
+# matching "_cycles_".
 event_name=(cpu-clock task-clock context-switches cpu-migrations page-faults stalled-cycles-frontend stalled-cycles-backend cycles instructions branches branch-misses)
-event_metric=("CPUs_utilized" "CPUs_utilized" "cs/sec" "migrations/sec" "faults/sec" "frontend_cycles_idle" "backend_cycles_idle" "GHz" "insn_per_cycle" "/sec" "branch_miss_rate")
-skip_metric=("tma_" "TopdownL1")
+event_metric=("CPUs_utilized" "CPUs_utilized" "cs/sec" "migrations/sec" "faults/sec" "frontend_cycles_idle" "_cycles_" "GHz" "insn_per_cycle" "/sec" "branch_miss_rate")

Is this used for partial string match?

Quoted 2 lines

Then I guess "frontend_cycles_idle" can be covered by "_cycles_" too? Also as we have "/sec", can "cs/sec" and "migrations/sec" be removed?

When we see the event at index 'i' in the event_name array, we check the corresponding metric at index 'i' in the event_metric array. So "cs/sec" matches the event "context-switches" while "/sec" matches "branches". We could weaken the "context-switches" event to match just "/sec" as a metric, but it seems better to leave it as "cs/sec".

Quoted 3 lines

tools/perf/tests/shell/stat+std_output.sh set -e · line 19

Quoted 1 line
tools/perf/tests/shell/stat+std_output.sh +1 -0
+skip_metric=("tma_" "TopdownL1" "percent of slots")

Why is "percent of slots" added as well?

Seen on ARM, the metric names lack an easily catchable prefix like tma_. Its part of the fixing this test for ARM, but could be called out more in the commit message.

Thanks,
Ian

Quoted 9 lines

Thanks,
Namhyung

Quoted 6 lines
tools/perf/tests/shell/stat+std_output.sh +0 -1
 cleanup() {
   rm -f "${stat_output}"
--

2.53.0.1213.gd9a14994de-goog

maintainer
#3 lore raw
Quoted 30 lines · Ian Rogers
Quoted 29 lines · Namhyung Kim
Quoted 14 lines · Ian Rogers

Seen on ARM, the stalled-cycles-backend event can be given as the event for both backend_cycles_idle and stalled_cycles_per_instruction metrics. Make the metric match sufficiently generic to allow this.

---
 tools/perf/tests/shell/stat+std_output.sh | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
tools/perf/tests/shell/stat+std_output.sh +0 -0
index 9c4b92ecf448..5a6bda436dd4 100755

tools/perf/tests/shell/stat+std_output.sh set -e · line 18

Quoted 10 lines
tools/perf/tests/shell/stat+std_output.sh +4 -2
@@ -11,9 +11,12 @@ set -e
 
 stat_output=$(mktemp /tmp/__perf_test.stat_output.std.XXXXX)
 
+# For event_name[i] expect to see event_metric[i]. 'stalled-cycles-backend' may
+# match both 'backend_cycles_idle' and 'stalled_cycles_per_instruction', hence
+# matching "_cycles_".
 event_name=(cpu-clock task-clock context-switches cpu-migrations page-faults stalled-cycles-frontend stalled-cycles-backend cycles instructions branches branch-misses)
-event_metric=("CPUs_utilized" "CPUs_utilized" "cs/sec" "migrations/sec" "faults/sec" "frontend_cycles_idle" "backend_cycles_idle" "GHz" "insn_per_cycle" "/sec" "branch_miss_rate")
-skip_metric=("tma_" "TopdownL1")
+event_metric=("CPUs_utilized" "CPUs_utilized" "cs/sec" "migrations/sec" "faults/sec" "frontend_cycles_idle" "_cycles_" "GHz" "insn_per_cycle" "/sec" "branch_miss_rate")

Is this used for partial string match?

Quoted 8 lines
Quoted 2 lines

Then I guess "frontend_cycles_idle" can be covered by "_cycles_" too? Also as we have "/sec", can "cs/sec" and "migrations/sec" be removed?

When we see the event at index 'i' in the event_name array, we check the corresponding metric at index 'i' in the event_metric array. So "cs/sec" matches the event "context-switches" while "/sec" matches "branches". We could weaken the "context-switches" event to match just "/sec" as a metric, but it seems better to leave it as "cs/sec".

I see. So it's index-based and the metric names are different on x86 and ARM.

Quoted 8 lines
Quoted 4 lines

tools/perf/tests/shell/stat+std_output.sh set -e · line 19

Quoted 2 lines
tools/perf/tests/shell/stat+std_output.sh +1 -0
+skip_metric=("tma_" "TopdownL1" "percent of slots")

Why is "percent of slots" added as well?

Seen on ARM, the metric names lack an easily catchable prefix like tma_. Its part of the fixing this test for ARM, but could be called out more in the commit message.

Right, it'd be great if you could explain the problem clearly with an example. Feel free to consider me knows nothing..

Thanks,
Namhyung