[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5845e1fb-57ed-0883-b477-7f3d4a521d31@arm.com>
Date: Fri, 23 Oct 2020 18:10:18 +0100
From: André Przywara <andre.przywara@....com>
To: Leo Yan <leo.yan@...aro.org>,
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>,
Wei Li <liwei391@...wei.com>,
James Clark <james.clark@....com>, Al Grant <Al.Grant@....com>,
Dave Martin <Dave.Martin@....com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 11/20] perf arm-spe: Add new function
arm_spe_pkt_desc_counter()
On 22/10/2020 15:58, Leo Yan wrote:
> 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 <leo.yan@...aro.org>
Confirmed by diff'ing '-' vs. '+' to not introduce an actual change.
Reviewed-by: Andre Przywara <andre.przywara@....com>
Cheers,
Andre
> ---
> .../arm-spe-decoder/arm-spe-pkt-decoder.c | 64 +++++++++++--------
> 1 file changed, 37 insertions(+), 27 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 1fc07c693640..023bcc9be3cc 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
> @@ -293,6 +293,42 @@ static int arm_spe_pkt_desc_addr(const struct arm_spe_pkt *packet,
> }
> }
>
> +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);
> + size_t blen = buf_len;
> + int ret;
> +
> + ret = arm_spe_pkt_snprintf(&buf, &blen, "%s %d ", name,
> + (unsigned short)payload);
> + if (ret < 0)
> + return ret;
> +
> + switch (packet->index) {
> + case 0:
> + ret = arm_spe_pkt_snprintf(&buf, &blen, "TOT");
> + if (ret < 0)
> + return ret;
> + break;
> + case 1:
> + ret = arm_spe_pkt_snprintf(&buf, &blen, "ISSUE");
> + if (ret < 0)
> + return ret;
> + break;
> + case 2:
> + ret = arm_spe_pkt_snprintf(&buf, &blen, "XLAT");
> + if (ret < 0)
> + return ret;
> + break;
> + default:
> + break;
> + }
> +
> + return buf_len - blen;
> +}
> +
> int arm_spe_pkt_desc(const struct arm_spe_pkt *packet, char *buf,
> size_t buf_len)
> {
> @@ -435,33 +471,7 @@ int arm_spe_pkt_desc(const struct arm_spe_pkt *packet, char *buf,
> return arm_spe_pkt_snprintf(&buf, &blen, "%s 0x%lx el%d",
> name, (unsigned long)payload, idx + 1);
> case ARM_SPE_COUNTER:
> - ret = arm_spe_pkt_snprintf(&buf, &blen, "%s %d ", name,
> - (unsigned short)payload);
> - if (ret < 0)
> - return ret;
> -
> - switch (idx) {
> - case 0:
> - ret = arm_spe_pkt_snprintf(&buf, &blen, "TOT");
> - if (ret < 0)
> - return ret;
> - break;
> - case 1:
> - ret = arm_spe_pkt_snprintf(&buf, &blen, "ISSUE");
> - if (ret < 0)
> - return ret;
> - break;
> - case 2:
> - ret = arm_spe_pkt_snprintf(&buf, &blen, "XLAT");
> - if (ret < 0)
> - return ret;
> - break;
> - default:
> - break;
> - }
> -
> - return buf_len - blen;
> -
> + return arm_spe_pkt_desc_counter(packet, buf, buf_len);
> default:
> break;
> }
>
Powered by blists - more mailing lists