]> git.baikalelectronics.ru Git - kernel.git/commit
perf script/python: Print array argument as string
authorNamhyung Kim <namhyung@kernel.org>
Thu, 29 May 2014 04:44:55 +0000 (13:44 +0900)
committerJiri Olsa <jolsa@kernel.org>
Mon, 9 Jun 2014 10:21:03 +0000 (12:21 +0200)
commitbcfc2898eee60b52b4062a3cf0fc9eb70887faf3
tree00f392d988101d5ab0d9f128d76ba51722e26fe1
parent506841a28497655d76ba91e074f6a0136d71f405
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>
tools/perf/util/scripting-engines/trace-event-python.c