From: tip-bot for Namhyung Kim <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org,
jolsa@kernel.org, tzanussi@gmail.com, namhyung@kernel.org,
tglx@linutronix.de, bigeasy@linutronix.de
Subject: [tip:perf/core] perf script/python: Print array argument as string
Date: Thu, 12 Jun 2014 05:01:54 -0700 [thread overview]
Message-ID: <tip-e646fe730a324098a718f1c9b2f349efb99d5457@git.kernel.org> (raw)
In-Reply-To: <1401338695-18837-1-git-send-email-namhyung@kernel.org>
Commit-ID: e646fe730a324098a718f1c9b2f349efb99d5457
Gitweb: http://git.kernel.org/tip/e646fe730a324098a718f1c9b2f349efb99d5457
Author: Namhyung Kim <namhyung@kernel.org>
AuthorDate: Thu, 29 May 2014 13:44:55 +0900
Committer: Jiri Olsa <jolsa@kernel.org>
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 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 | 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 ||
f->flags & FIELD_IS_SYMBOLIC)
fprintf(ofp, "%%s");
else if (f->flags & FIELD_IS_SIGNED)
next prev parent reply other threads:[~2014-06-12 12:02 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
2014-06-12 12:01 ` tip-bot for Namhyung Kim [this message]
2014-06-26 15:37 ` [tip:perf/core] " 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=tip-e646fe730a324098a718f1c9b2f349efb99d5457@git.kernel.org \
--to=tipbot@zytor.com \
--cc=bigeasy@linutronix.de \
--cc=hpa@zytor.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=tglx@linutronix.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.