[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20211115123632.150711-1-oleglatin@yandex-team.ru>
Date: Mon, 15 Nov 2021 15:36:29 +0300
From: Oleg Latin <oleglatin@...dex-team.ru>
To: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
Nicholas Fraser <nfraser@...eweavers.com>,
linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: dmtrmonakhov@...dex-team.ru
Subject: [PATCH] perf: add event name to json output
After converting perf.data to json it missing event name entry.
In perf script output it is clear that events have different types:
$ perf script -F -ip
...
dd 130321 [001] 10282.698083: 117995 cycles:
dd 130321 [001] 10282.698091: 225856 instructions:
...
But json output lack of this information and it hard to distinguish
different event types:
...
{
"timestamp": 10282698083472,
"pid": 130321,
"tid": 130321,
"comm": "dd",
"callchain": [
{
"ip": "0xffffffff901f4cd5",
"symbol": "syscall_exit_to_user_mode",
"dso": "[kernel.kallsyms]"
}
]
},
{
"timestamp": 10282698091328,
"pid": 130321,
"tid": 130321,
"comm": "dd",
"callchain": [
{
"ip": "0x7fb7f0c271e7",
"symbol": "__GI___libc_write",
"dso": "libc-2.31.so"
}
]
},
...
This patch adds event name entry to resulting json.
Signed-off-by: Oleg Latin <oleglatin@...dex-team.ru>
---
tools/perf/util/data-convert-json.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/perf/util/data-convert-json.c b/tools/perf/util/data-convert-json.c
index b0e3d69c6835..72aaf6babc22 100644
--- a/tools/perf/util/data-convert-json.c
+++ b/tools/perf/util/data-convert-json.c
@@ -168,6 +168,9 @@ static int process_sample_event(struct perf_tool *tool,
output_json_key_format(out, true, 3, "pid", "%i", al.thread->pid_);
output_json_key_format(out, true, 3, "tid", "%i", al.thread->tid);
+ if (evsel->name)
+ output_json_key_string(out, true, 3, "event", evsel->name);
+
if (al.cpu >= 0)
output_json_key_format(out, true, 3, "cpu", "%i", al.cpu);
--
2.25.1
Powered by blists - more mailing lists