Messages in this thread Patch in this message | | | Date | Tue, 27 Apr 2021 09:53:55 -0300 | From | Arnaldo Carvalho de Melo <> | 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);
| |