From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Nicholas Fraser <nfraser@codeweavers.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
Ian Rogers <irogers@google.com>,
Changbin Du <changbin.du@intel.com>,
Kan Liang <kan.liang@linux.intel.com>,
Tan Xiaojun <tanxiaojun@huawei.com>,
Jin Yao <yao.jin@linux.intel.com>,
linux-kernel@vger.kernel.org,
Ulrich Czekalla <uczekalla@codeweavers.com>
Subject: Re: [PATCH v2] perf data: Add JSON export
Date: Tue, 27 Apr 2021 09:53:55 -0300 [thread overview]
Message-ID: <YIgJY5jejgvTWqmR@kernel.org> (raw)
In-Reply-To: <YIcvjFr/hN2Syybc@kernel.org>
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);
prev parent reply other threads:[~2021-04-27 12:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-26 14:47 [PATCH v2] perf data: Add JSON export Nicholas Fraser
2021-04-26 20:25 ` Arnaldo Carvalho de Melo
2021-04-26 21:24 ` Arnaldo Carvalho de Melo
2021-04-27 12:53 ` Arnaldo Carvalho de Melo [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YIgJY5jejgvTWqmR@kernel.org \
--to=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=changbin.du@intel.com \
--cc=irogers@google.com \
--cc=jolsa@redhat.com \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=nfraser@codeweavers.com \
--cc=peterz@infradead.org \
--cc=tanxiaojun@huawei.com \
--cc=uczekalla@codeweavers.com \
--cc=yao.jin@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox