Re: [tip:perf/core] perf script/python: Print array argument as string

From: Sebastian Andrzej Siewior
Date: Thu Jun 26 2014 - 11:37:39 EST


On 06/12/2014 02:01 PM, tip-bot for Namhyung Kim wrote:

> Commit-ID: e646fe730a324098a718f1c9b2f349efb99d5457
> Gitweb: http://git.kernel.org/tip/e646fe730a324098a718f1c9b2f349efb99d5457
> Author: Namhyung Kim <namhyung@xxxxxxxxxx>
> AuthorDate: Thu, 29 May 2014 13:44:55 +0900
> Committer: Jiri Olsa <jolsa@xxxxxxxxxx>
> 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:

This patch got merged. It fixes something that was introduced by
"perf script: move the number processing into its own function" [0]
"perf script: handle the num array type in python properly" [1]

which was not yet merged.

[0] lkml.kernel.org/r/1401207274-8170-1-git-send-email-bigeasy@xxxxxxxxxxxxx
[1] lkml.kernel.org/r/1401207274-8170-2-git-send-email-bigeasy@xxxxxxxxxxxxx

> $ 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.

Sebastian
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/