[lkml]   [2014]   [Jun]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[tip:perf/core] perf script/python: Print array argument as string
Commit-ID:  e646fe730a324098a718f1c9b2f349efb99d5457
Author: Namhyung Kim <>
AuthorDate: Thu, 29 May 2014 13:44:55 +0900
Committer: Jiri Olsa <>
CommitDate: Mon, 9 Jun 2014 12:21:03 +0200

perf script/python: Print array argument as string

With the Sebastian's change of handling num array argument (of raw
syscall enter), the script still failed to work like this:

$ perf record -e raw_syscalls:* sleep 1
$ perf script -g python
$ perf script -s
Traceback (most recent call last):
File "", line 42, in raw_syscalls__sys_enter
(id, args),
TypeError: %u format: a number is required, not list
Fatal Python error: problem in Python trace event handler
Aborted (core dumped)

This is because the generated script tries to print the array arg as
unsigned integer (%u). Since the python seems to convert arguments to
strings by default, just using %s solved the problem for me.

Signed-off-by: Namhyung Kim <>
Cc: Tom Zanussi <>
Cc: Sebastian Andrzej Siewior <>
Signed-off-by: Jiri Olsa <>
tools/perf/util/scripting-engines/trace-event-python.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
index c3de097..1c41932 100644
--- a/tools/perf/util/scripting-engines/trace-event-python.c
+++ b/tools/perf/util/scripting-engines/trace-event-python.c
@@ -623,6 +623,7 @@ static int python_generate_script(struct pevent *pevent, const char *outfile)
fprintf(ofp, "%s=", f->name);
if (f->flags & FIELD_IS_STRING ||
f->flags & FIELD_IS_FLAG ||
+ f->flags & FIELD_IS_ARRAY ||
fprintf(ofp, "%%s");
else if (f->flags & FIELD_IS_SIGNED)

 \ /
  Last update: 2014-06-12 14:21    [W:0.070 / U:2.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site