Commit cf26e043 authored by Athira Rajeev's avatar Athira Rajeev Committed by Arnaldo Carvalho de Melo

perf vendor events power10: Add JSON metric events to present CPI stall cycles in powerpc

Power10 Performance Monitoring Unit (PMU) provides events to understand
stall cycles of different pipeline stages.  These events along with
completed instructions provides useful metrics for application tuning.

Patch implements the JSON changes to collect counter statistics to
present the high level CPI stall breakdown metrics. New metric group is
named as "CPI_STALL_RATIO" and this new metric group presents these
stall metrics:

- DISPATCHED_CPI ( Dispatch stall cycles per insn )
- ISSUE_STALL_CPI ( Issue stall cycles per insn )
- EXECUTION_STALL_CPI ( Execution stall cycles per insn )
- COMPLETION_STALL_CPI ( Completition stall cycles per insn )

To avoid multipling of events, PM_RUN_INST_CMPL event has been modified
to use PMC5(performance monitoring counter5) instead of PMC4. This
change is needed, since completion stall event is using PMC4.

Usage example:

 ./perf stat --metric-no-group -M CPI_STALL_RATIO <workload>

 Performance counter stats for 'workload':

    63,056,817,982      PM_CMPL_STALL                    #     0.28 COMPLETION_STALL_CPI
 1,743,988,038,896      PM_ISSUE_STALL                   #     7.73 ISSUE_STALL_CPI
   225,597,495,030      PM_RUN_INST_CMPL                 #     6.18 DISPATCHED_CPI
                                                  #    37.48 EXECUTION_STALL_CPI
 1,393,916,546,654      PM_DISP_STALL_CYC
 8,455,376,836,463      PM_EXEC_STALL

"--metric-no-group" is used for forcing PM_RUN_INST_CMPL to be scheduled
in all group for more accuracy.
Signed-off-by: default avatarAthira Rajeev <atrajeev@linux.vnet.ibm.com>
Acked-by: default avatarIan Rogers <irogers@google.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Disha Goel <disgoel@linux.ibm.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kajol Jain <kjain@linux.ibm.com>
Cc: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nageswara R Sastry <rnsastry@linux.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/r/20230216061240.18067-1-atrajeev@linux.vnet.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 7e55b956
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
{ {
"BriefDescription": "Average cycles per completed instruction when dispatch was stalled for any reason", "BriefDescription": "Average cycles per completed instruction when dispatch was stalled for any reason",
"MetricExpr": "PM_DISP_STALL_CYC / PM_RUN_INST_CMPL", "MetricExpr": "PM_DISP_STALL_CYC / PM_RUN_INST_CMPL",
"MetricGroup": "CPI", "MetricGroup": "CPI;CPI_STALL_RATIO",
"MetricName": "DISPATCHED_CPI" "MetricName": "DISPATCHED_CPI"
}, },
{ {
...@@ -147,13 +147,13 @@ ...@@ -147,13 +147,13 @@
{ {
"BriefDescription": "Average cycles per completed instruction when the NTC instruction has been dispatched but not issued for any reason", "BriefDescription": "Average cycles per completed instruction when the NTC instruction has been dispatched but not issued for any reason",
"MetricExpr": "PM_ISSUE_STALL / PM_RUN_INST_CMPL", "MetricExpr": "PM_ISSUE_STALL / PM_RUN_INST_CMPL",
"MetricGroup": "CPI", "MetricGroup": "CPI;CPI_STALL_RATIO",
"MetricName": "ISSUE_STALL_CPI" "MetricName": "ISSUE_STALL_CPI"
}, },
{ {
"BriefDescription": "Average cycles per completed instruction when the NTC instruction is waiting to be finished in one of the execution units", "BriefDescription": "Average cycles per completed instruction when the NTC instruction is waiting to be finished in one of the execution units",
"MetricExpr": "PM_EXEC_STALL / PM_RUN_INST_CMPL", "MetricExpr": "PM_EXEC_STALL / PM_RUN_INST_CMPL",
"MetricGroup": "CPI", "MetricGroup": "CPI;CPI_STALL_RATIO",
"MetricName": "EXECUTION_STALL_CPI" "MetricName": "EXECUTION_STALL_CPI"
}, },
{ {
...@@ -309,7 +309,7 @@ ...@@ -309,7 +309,7 @@
{ {
"BriefDescription": "Average cycles per completed instruction when the NTC instruction cannot complete because the thread was blocked", "BriefDescription": "Average cycles per completed instruction when the NTC instruction cannot complete because the thread was blocked",
"MetricExpr": "PM_CMPL_STALL / PM_RUN_INST_CMPL", "MetricExpr": "PM_CMPL_STALL / PM_RUN_INST_CMPL",
"MetricGroup": "CPI", "MetricGroup": "CPI;CPI_STALL_RATIO",
"MetricName": "COMPLETION_STALL_CPI" "MetricName": "COMPLETION_STALL_CPI"
}, },
{ {
......
...@@ -265,7 +265,7 @@ ...@@ -265,7 +265,7 @@
"BriefDescription": "Load Missed L1, counted at finish time." "BriefDescription": "Load Missed L1, counted at finish time."
}, },
{ {
"EventCode": "0x400FA", "EventCode": "0x500FA",
"EventName": "PM_RUN_INST_CMPL", "EventName": "PM_RUN_INST_CMPL",
"BriefDescription": "Completed PowerPC instructions gated by the run latch." "BriefDescription": "Completed PowerPC instructions gated by the run latch."
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment