lkml.org 
[lkml]   [2021]   [Nov]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] perf: add missing cpu entry in json output
Date
After converting perf.data with 'perf covert data --to-json' the
resulting json file missing cpu entries:

{
"timestamp": 5716840788599,
"pid": 79661,
"tid": 79661,
"comm": "python3",
"callchain": [
{
"ip": "0xffffffffafd05fc0"
}
]
},

Seems addr_location::thread::cpu is never assigned during
machine__resolve() call. This patch uses addr_location::cpu to store it
in json file.

Signed-off-by: Oleg Latin <oleglatin@yandex-team.ru>
---
tools/perf/util/data-convert-json.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/data-convert-json.c b/tools/perf/util/data-convert-json.c
index f1ab6edba446..b0e3d69c6835 100644
--- a/tools/perf/util/data-convert-json.c
+++ b/tools/perf/util/data-convert-json.c
@@ -168,8 +168,8 @@ 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 (al.thread->cpu >= 0)
- output_json_key_format(out, true, 3, "cpu", "%i", al.thread->cpu);
+ if (al.cpu >= 0)
+ output_json_key_format(out, true, 3, "cpu", "%i", al.cpu);

output_json_key_string(out, true, 3, "comm", thread__comm_str(al.thread));

--
2.25.1
\
 
 \ /
  Last update: 2021-11-12 12:59    [W:0.031 / U:0.668 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site