diff options
| author | Namhyung Kim <namhyung@kernel.org> | 2014-05-29 00:44:55 -0400 |
|---|---|---|
| committer | Jiri Olsa <jolsa@kernel.org> | 2014-06-09 06:21:03 -0400 |
| commit | e646fe730a324098a718f1c9b2f349efb99d5457 (patch) | |
| tree | 00f392d988101d5ab0d9f128d76ba51722e26fe1 /tools/perf/util/scripting-engines | |
| parent | b0815d07ec12959da2104822561e0df26dc4bf3d (diff) | |
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 perf-script.py
...
Traceback (most recent call last):
File "perf-script.py", 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 <namhyung@kernel.org>
Cc: Tom Zanussi <tzanussi@gmail.com>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Link: http://lkml.kernel.org/r/1401338695-18837-1-git-send-email-namhyung@kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Diffstat (limited to 'tools/perf/util/scripting-engines')
| -rw-r--r-- | tools/perf/util/scripting-engines/trace-event-python.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c index c3de0971bfdd..1c419321f707 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) | |||
| 623 | fprintf(ofp, "%s=", f->name); | 623 | fprintf(ofp, "%s=", f->name); |
| 624 | if (f->flags & FIELD_IS_STRING || | 624 | if (f->flags & FIELD_IS_STRING || |
| 625 | f->flags & FIELD_IS_FLAG || | 625 | f->flags & FIELD_IS_FLAG || |
| 626 | f->flags & FIELD_IS_ARRAY || | ||
| 626 | f->flags & FIELD_IS_SYMBOLIC) | 627 | f->flags & FIELD_IS_SYMBOLIC) |
| 627 | fprintf(ofp, "%%s"); | 628 | fprintf(ofp, "%%s"); |
| 628 | else if (f->flags & FIELD_IS_SIGNED) | 629 | else if (f->flags & FIELD_IS_SIGNED) |
