mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-31 06:14:39 +01:00
perf data: Add tracepoint fields when converting to JSON
When converting recorded data into JSON format, perf data omits probe
variables. Add them to the output in the format "field name": "field value"
using tep_print_field:
$ perf data convert --to-json output.json
// output.json
{
"linux-perf-json-version": 1,
"headers": { ... },
"samples": [
{
"timestamp": 29182079082999,
"pid": 309194,
[...]
"__probe_ip": "0x93ee35",
"query_string_string": "select 2;",
"nxids": "0"
}
]
}
Signed-off-by: Dmitrii Dolgov <[email protected]>
Acked-by: Ian Rogers <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Jiri Olsa <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
This commit is contained in:
1 parent
30b331d2e3
commit
9d895e4684
1 file changed
+20
@@ -217,6 +217,26 @@ static int process_sample_event(struct perf_tool *tool,
|
||||
}
|
||||
output_json_format(out, false, 3, "]");
|
||||
|
||||
if (sample->raw_data) {
|
||||
int i;
|
||||
struct tep_format_field **fields;
|
||||
|
||||
fields = tep_event_fields(evsel->tp_format);
|
||||
if (fields) {
|
||||
i = 0;
|
||||
while (fields[i]) {
|
||||
struct trace_seq s;
|
||||
|
||||
trace_seq_init(&s);
|
||||
tep_print_field(&s, sample->raw_data, fields[i]);
|
||||
output_json_key_string(out, true, 3, fields[i]->name, s.buffer);
|
||||
|
||||
i++;
|
||||
}
|
||||
free(fields);
|
||||
}
|
||||
}
|
||||
|
||||
output_json_format(out, false, 2, "}");
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user