[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201029071927.9308-15-leo.yan@linaro.org>
Date: Thu, 29 Oct 2020 15:19:20 +0800
From: Leo Yan <leo.yan@...aro.org>
To: Arnaldo Carvalho de Melo <acme@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
Andre Przywara <andre.przywara@....com>,
Dave Martin <Dave.Martin@....com>,
Wei Li <liwei391@...wei.com>,
James Clark <james.clark@....com>, Al Grant <Al.Grant@....com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Cc: Leo Yan <leo.yan@...aro.org>
Subject: [PATCH v5 14/21] perf arm-spe: Add new function arm_spe_pkt_desc_event()
This patch moves out the event packet parsing from arm_spe_pkt_desc()
to the new function arm_spe_pkt_desc_event().
Signed-off-by: Leo Yan <leo.yan@...aro.org>
Reviewed-by: Andre Przywara <andre.przywara@....com>
---
.../arm-spe-decoder/arm-spe-pkt-decoder.c | 66 +++++++++++--------
1 file changed, 38 insertions(+), 28 deletions(-)
diff --git a/tools/perf/util/arm-spe-decoder/arm-spe-pkt-decoder.c b/tools/perf/util/arm-spe-decoder/arm-spe-pkt-decoder.c
index bc4b5a5a528b..6e4896327e56 100644
--- a/tools/perf/util/arm-spe-decoder/arm-spe-pkt-decoder.c
+++ b/tools/perf/util/arm-spe-decoder/arm-spe-pkt-decoder.c
@@ -269,6 +269,43 @@ static int arm_spe_pkt_snprintf(int *err, char **buf_p, size_t *blen,
return ret;
}
+static int arm_spe_pkt_desc_event(const struct arm_spe_pkt *packet,
+ char *buf, size_t buf_len)
+{
+ u64 payload = packet->payload;
+ size_t blen = buf_len;
+ int err = 0;
+
+ arm_spe_pkt_snprintf(&err, &buf, &blen, "EV");
+
+ if (payload & 0x1)
+ arm_spe_pkt_snprintf(&err, &buf, &blen, " EXCEPTION-GEN");
+ if (payload & 0x2)
+ arm_spe_pkt_snprintf(&err, &buf, &blen, " RETIRED");
+ if (payload & 0x4)
+ arm_spe_pkt_snprintf(&err, &buf, &blen, " L1D-ACCESS");
+ if (payload & 0x8)
+ arm_spe_pkt_snprintf(&err, &buf, &blen, " L1D-REFILL");
+ if (payload & 0x10)
+ arm_spe_pkt_snprintf(&err, &buf, &blen, " TLB-ACCESS");
+ if (payload & 0x20)
+ arm_spe_pkt_snprintf(&err, &buf, &blen, " TLB-REFILL");
+ if (payload & 0x40)
+ arm_spe_pkt_snprintf(&err, &buf, &blen, " NOT-TAKEN");
+ if (payload & 0x80)
+ arm_spe_pkt_snprintf(&err, &buf, &blen, " MISPRED");
+ if (packet->index > 1) {
+ if (payload & 0x100)
+ arm_spe_pkt_snprintf(&err, &buf, &blen, " LLC-ACCESS");
+ if (payload & 0x200)
+ arm_spe_pkt_snprintf(&err, &buf, &blen, " LLC-REFILL");
+ if (payload & 0x400)
+ arm_spe_pkt_snprintf(&err, &buf, &blen, " REMOTE-ACCESS");
+ }
+
+ return err ?: (int)(buf_len - blen);
+}
+
static int arm_spe_pkt_desc_addr(const struct arm_spe_pkt *packet,
char *buf, size_t buf_len)
{
@@ -341,34 +378,7 @@ int arm_spe_pkt_desc(const struct arm_spe_pkt *packet, char *buf,
case ARM_SPE_END:
return arm_spe_pkt_snprintf(&err, &buf, &blen, "%s", name);
case ARM_SPE_EVENTS:
- arm_spe_pkt_snprintf(&err, &buf, &blen, "EV");
-
- if (payload & 0x1)
- arm_spe_pkt_snprintf(&err, &buf, &blen, " EXCEPTION-GEN");
- if (payload & 0x2)
- arm_spe_pkt_snprintf(&err, &buf, &blen, " RETIRED");
- if (payload & 0x4)
- arm_spe_pkt_snprintf(&err, &buf, &blen, " L1D-ACCESS");
- if (payload & 0x8)
- arm_spe_pkt_snprintf(&err, &buf, &blen, " L1D-REFILL");
- if (payload & 0x10)
- arm_spe_pkt_snprintf(&err, &buf, &blen, " TLB-ACCESS");
- if (payload & 0x20)
- arm_spe_pkt_snprintf(&err, &buf, &blen, " TLB-REFILL");
- if (payload & 0x40)
- arm_spe_pkt_snprintf(&err, &buf, &blen, " NOT-TAKEN");
- if (payload & 0x80)
- arm_spe_pkt_snprintf(&err, &buf, &blen, " MISPRED");
- if (idx > 1) {
- if (payload & 0x100)
- arm_spe_pkt_snprintf(&err, &buf, &blen, " LLC-ACCESS");
- if (payload & 0x200)
- arm_spe_pkt_snprintf(&err, &buf, &blen, " LLC-REFILL");
- if (payload & 0x400)
- arm_spe_pkt_snprintf(&err, &buf, &blen, " REMOTE-ACCESS");
- }
- return err ?: (int)(buf_len - blen);
-
+ return arm_spe_pkt_desc_event(packet, buf, buf_len);
case ARM_SPE_OP_TYPE:
switch (idx) {
case 0:
--
2.17.1
Powered by blists - more mailing lists