aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeo Yan <[email protected]>2020-11-19 23:24:32 +0800
committerArnaldo Carvalho de Melo <[email protected]>2020-11-26 09:31:42 -0300
commitc52cfe9872132407eef6d734014d6fd7790146f5 (patch)
tree4d142adcab0b7ee261cdb7edae286fb055f70d91
parent6550149e801a32b1533ed86509af76319cb75eba (diff)
perf arm-spe: Add new function arm_spe_pkt_desc_counter()
This patch moves out the counter packet parsing code from arm_spe_pkt_desc() to the new function arm_spe_pkt_desc_counter(). Signed-off-by: Leo Yan <[email protected]> Reviewed-by: Andre Przywara <[email protected]> Acked-by: Will Deacon <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Al Grant <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Dave Martin <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: James Clark <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: John Garry <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Mathieu Poirier <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Wei Li <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
-rw-r--r--tools/perf/util/arm-spe-decoder/arm-spe-pkt-decoder.c43
1 files changed, 28 insertions, 15 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 978f5551b82c..397ade5ffdeb 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
@@ -322,6 +322,33 @@ static int arm_spe_pkt_desc_addr(const struct arm_spe_pkt *packet,
return err;
}
+static int arm_spe_pkt_desc_counter(const struct arm_spe_pkt *packet,
+ char *buf, size_t buf_len)
+{
+ u64 payload = packet->payload;
+ const char *name = arm_spe_pkt_name(packet->type);
+ int err = 0;
+
+ arm_spe_pkt_out_string(&err, &buf, &buf_len, "%s %d ", name,
+ (unsigned short)payload);
+
+ switch (packet->index) {
+ case 0:
+ arm_spe_pkt_out_string(&err, &buf, &buf_len, "TOT");
+ break;
+ case 1:
+ arm_spe_pkt_out_string(&err, &buf, &buf_len, "ISSUE");
+ break;
+ case 2:
+ arm_spe_pkt_out_string(&err, &buf, &buf_len, "XLAT");
+ break;
+ default:
+ break;
+ }
+
+ return err;
+}
+
int arm_spe_pkt_desc(const struct arm_spe_pkt *packet, char *buf,
size_t buf_len)
{
@@ -414,21 +441,7 @@ int arm_spe_pkt_desc(const struct arm_spe_pkt *packet, char *buf,
name, (unsigned long)payload, idx + 1);
break;
case ARM_SPE_COUNTER:
- arm_spe_pkt_out_string(&err, &buf, &blen, "%s %d ", name,
- (unsigned short)payload);
- switch (idx) {
- case 0:
- arm_spe_pkt_out_string(&err, &buf, &blen, "TOT");
- break;
- case 1:
- arm_spe_pkt_out_string(&err, &buf, &blen, "ISSUE");
- break;
- case 2:
- arm_spe_pkt_out_string(&err, &buf, &blen, "XLAT");
- break;
- default:
- break;
- }
+ err = arm_spe_pkt_desc_counter(packet, buf, buf_len);
break;
default:
/* Unknown packet type */