[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YIgJY5jejgvTWqmR@kernel.org>
Date: Tue, 27 Apr 2021 09:53:55 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Nicholas Fraser <nfraser@...eweavers.com>
Cc: 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>,
Ian Rogers <irogers@...gle.com>,
Changbin Du <changbin.du@...el.com>,
Kan Liang <kan.liang@...ux.intel.com>,
Tan Xiaojun <tanxiaojun@...wei.com>,
Jin Yao <yao.jin@...ux.intel.com>,
linux-kernel@...r.kernel.org,
Ulrich Czekalla <uczekalla@...eweavers.com>
Subject: Re: [PATCH v2] perf data: Add JSON export
Em Mon, Apr 26, 2021 at 06:24:29PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Mon, Apr 26, 2021 at 05:25:58PM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Mon, Apr 26, 2021 at 10:47:16AM -0400, Nicholas Fraser escreveu:
> > > This adds a feature to export perf data to JSON.
> > >
> > > The resolved symbols are exported into the JSON so that external tools
> > > don't need to load the dsos themselves (or even have access to them at
> > > all.) This makes it easy to load and analyze perf data with standalone
> > > tools where direct perf or libbabeltrace integration is impractical.
> > >
> > > The exporter uses a minimal inline JSON encoding without any external
> > > dependencies. Currently it only outputs some headers and sample metadata
> > > but it's easily extensible.
> > >
> > > Use it like this:
> > >
> > > perf data convert --to-json out.json
>
> One more, clang complains:
>
> 7 50.92 alpine:3.10 : FAIL gcc version 8.3.0 (Alpine 8.3.0)
> util/data-convert-json.c:126:32: error: address of array 'al->sym->name' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
> if (al && al->sym && al->sym->name && strlen(al->sym->name) > 0) {
> ~~ ~~~~~~~~~^~~~
> 1 error generated.
> make[3]: *** [/git/perf-5.12.0/tools/build/Makefile.build:139: util] Error 2
So the fix is the one below, applied and tested, thanks.
- Arnaldo
diff --git a/tools/perf/util/data-convert-json.c b/tools/perf/util/data-convert-json.c
index f24593d57f80be1b..355cd1948bdf006a 100644
--- a/tools/perf/util/data-convert-json.c
+++ b/tools/perf/util/data-convert-json.c
@@ -123,7 +123,7 @@ static void output_sample_callchain_entry(struct perf_tool *tool,
output_json_format(out, false, 4, "{");
output_json_key_format(out, false, 5, "ip", "\"0x%" PRIx64 "\"", ip);
- if (al && al->sym && al->sym->name && strlen(al->sym->name) > 0) {
+ if (al && al->sym && al->sym->namelen) {
fputc(',', out);
output_json_key_string(out, false, 5, "symbol", al->sym->name);
Powered by blists - more mailing lists