[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAP-5=fVP8+U8P9j-ex_7YPDT-1funFnLAF0g5NhB9zJh7AK9fA@mail.gmail.com>
Date: Tue, 2 Dec 2025 15:03:25 -0800
From: Ian Rogers <irogers@...gle.com>
To: Namhyung Kim <namhyung@...nel.org>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>, James Clark <james.clark@...aro.org>,
Jiri Olsa <jolsa@...nel.org>, Adrian Hunter <adrian.hunter@...el.com>,
Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...nel.org>,
LKML <linux-kernel@...r.kernel.org>, linux-perf-users@...r.kernel.org
Subject: Re: [PATCH] perf tools: Remove a trailing newline in the event terms
On Tue, Dec 2, 2025 at 3:01 PM Namhyung Kim <namhyung@...nel.org> wrote:
>
> So that it can show the correct encoding info in the JSON output.
>
> $ perf list -j hw
> [
> {
> "Unit": "cpu",
> "Topic": "legacy hardware",
> "EventName": "branch-instructions",
> "EventType": "Kernel PMU event",
> "BriefDescription": "Retired branch instructions [This event is an alias of branches]",
> "Encoding": "cpu/event=0xc4/"
> },
> ...
>
> Suggested-by: Ian Rogers <irogers@...gle.com>
> Signed-off-by: Namhyung Kim <namhyung@...nel.org>
Reviewed-by: Ian Rogers <irogers@...gle.com>
Thanks!
Ian
> ---
> tools/perf/util/pmu.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
> index 1b7c712d8f9902bb..956ea273c2c7805c 100644
> --- a/tools/perf/util/pmu.c
> +++ b/tools/perf/util/pmu.c
> @@ -645,6 +645,8 @@ static int perf_pmu__new_alias(struct perf_pmu *pmu, const char *name,
> pr_err("Failed to read alias %s\n", name);
> return ret;
> }
> + if (line_len >= 1 && alias->terms[line_len - 1] == '\n')
> + alias->terms[line_len - 1] = '\0';
> }
> alias->name = strdup(name);
> alias->desc = desc ? strdup(desc) : NULL;
> --
> 2.52.0.158.g65b55ccf14-goog
>
Powered by blists - more mailing lists