From: Jiri Olsa <jolsa@redhat.com>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Ingo Molnar <mingo@kernel.org>, Paul Mackerras <paulus@samba.org>,
Namhyung Kim <namhyung.kim@lge.com>,
LKML <linux-kernel@vger.kernel.org>,
Tom Zanussi <tzanussi@gmail.com>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Subject: Re: [PATCH] perf script/python: Print array argument as string
Date: Tue, 3 Jun 2014 20:55:05 +0200 [thread overview]
Message-ID: <20140603185505.GB4213@krava.brq.redhat.com> (raw)
In-Reply-To: <1401338695-18837-1-git-send-email-namhyung@kernel.org>
On Thu, May 29, 2014 at 01:44:55PM +0900, Namhyung Kim wrote:
> 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.
>
> Cc: Tom Zanussi <tzanussi@gmail.com>
> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
ack/test anyone? ;-)
thanks,
jirka
> ---
> 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 40a815a5360b..a22ab53788bf 100644
> --- a/tools/perf/util/scripting-engines/trace-event-python.c
> +++ b/tools/perf/util/scripting-engines/trace-event-python.c
> @@ -649,6 +649,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 ||
> f->flags & FIELD_IS_SYMBOLIC)
> fprintf(ofp, "%%s");
> else if (f->flags & FIELD_IS_SIGNED)
> --
> 1.9.2
>
next prev parent reply other threads:[~2014-06-03 18:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-27 16:14 [PATCH 1/2] perf script: move the number processing into its own function Sebastian Andrzej Siewior
2014-05-27 16:14 ` [PATCH 2/2] perf script: handle the num array type in python properly Sebastian Andrzej Siewior
2014-05-29 4:43 ` Namhyung Kim
2014-05-30 9:39 ` Sebastian Andrzej Siewior
2014-05-29 4:44 ` [PATCH] perf script/python: Print array argument as string Namhyung Kim
2014-06-03 18:55 ` Jiri Olsa [this message]
2014-06-12 12:01 ` [tip:perf/core] " tip-bot for Namhyung Kim
2014-06-26 15:37 ` Sebastian Andrzej Siewior
2014-06-26 19:22 ` Jiri Olsa
2014-05-29 4:39 ` [PATCH 1/2] perf script: move the number processing into its own function Namhyung Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140603185505.GB4213@krava.brq.redhat.com \
--to=jolsa@redhat.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@kernel.org \
--cc=bigeasy@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung.kim@lge.com \
--cc=namhyung@kernel.org \
--cc=paulus@samba.org \
--cc=tzanussi@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®