From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Adrian Hunter <adrian.hunter@intel.com>,
David Ahern <dsahern@gmail.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
Jiri Olsa <jolsa@redhat.com>, Mike Galbraith <efault@gmx.de>,
Paul Mackerras <paulus@samba.org>,
Peter Zijlstra <peterz@infradead.org>,
Stephane Eranian <eranian@google.com>
Subject: [PATCH 10/10] perf trace: Tell arg formatters the arg index
Date: Mon, 2 Sep 2013 17:56:33 -0300 [thread overview]
Message-ID: <1378155393-7993-11-git-send-email-acme@infradead.org> (raw)
In-Reply-To: <1378155393-7993-1-git-send-email-acme@infradead.org>
From: Arnaldo Carvalho de Melo <acme@redhat.com>
... so that it can mask args relative to its position, like the 'mode' arg
that may or not be printed according to the 'flags' (O_CREAT) value.
[root@zoo ~]# perf trace -a -e openat,open_by_handle_at | head -1
469.754 ( 0.034 ms): 1183 openat(dfd: -100, filename: 0x7fbde40014b0, flags: CLOEXEC|DIRECTORY|NONBLOCK) = 23
[root@zoo ~]#
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-bgokqpkufd4sio7ixxknf1ux@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-trace.c | 36 +++++++++++++++++++++++++-----------
1 file changed, 25 insertions(+), 11 deletions(-)
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 5b6b287..b6f0725 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -17,7 +17,9 @@
#include <linux/futex.h>
static size_t syscall_arg__scnprintf_hex(char *bf, size_t size,
- unsigned long arg, u8 *arg_mask __maybe_unused)
+ unsigned long arg,
+ u8 arg_idx __maybe_unused,
+ u8 *arg_mask __maybe_unused)
{
return scnprintf(bf, size, "%#lx", arg);
}
@@ -25,7 +27,9 @@ static size_t syscall_arg__scnprintf_hex(char *bf, size_t size,
#define SCA_HEX syscall_arg__scnprintf_hex
static size_t syscall_arg__scnprintf_whence(char *bf, size_t size,
- unsigned long arg, u8 *arg_mask __maybe_unused)
+ unsigned long arg,
+ u8 arg_idx __maybe_unused,
+ u8 *arg_mask __maybe_unused)
{
int whence = arg;
@@ -50,7 +54,9 @@ static size_t syscall_arg__scnprintf_whence(char *bf, size_t size,
#define SCA_WHENCE syscall_arg__scnprintf_whence
static size_t syscall_arg__scnprintf_mmap_prot(char *bf, size_t size,
- unsigned long arg, u8 *arg_mask __maybe_unused)
+ unsigned long arg,
+ u8 arg_idx __maybe_unused,
+ u8 *arg_mask __maybe_unused)
{
int printed = 0, prot = arg;
@@ -81,7 +87,8 @@ static size_t syscall_arg__scnprintf_mmap_prot(char *bf, size_t size,
#define SCA_MMAP_PROT syscall_arg__scnprintf_mmap_prot
static size_t syscall_arg__scnprintf_mmap_flags(char *bf, size_t size,
- unsigned long arg, u8 *arg_mask __maybe_unused)
+ unsigned long arg, u8 arg_idx __maybe_unused,
+ u8 *arg_mask __maybe_unused)
{
int printed = 0, flags = arg;
@@ -122,7 +129,8 @@ static size_t syscall_arg__scnprintf_mmap_flags(char *bf, size_t size,
#define SCA_MMAP_FLAGS syscall_arg__scnprintf_mmap_flags
static size_t syscall_arg__scnprintf_madvise_behavior(char *bf, size_t size,
- unsigned long arg, u8 *arg_mask __maybe_unused)
+ unsigned long arg, u8 arg_idx __maybe_unused,
+ u8 *arg_mask __maybe_unused)
{
int behavior = arg;
@@ -163,7 +171,8 @@ static size_t syscall_arg__scnprintf_madvise_behavior(char *bf, size_t size,
#define SCA_MADV_BHV syscall_arg__scnprintf_madvise_behavior
-static size_t syscall_arg__scnprintf_futex_op(char *bf, size_t size, unsigned long arg, u8 *arg_mask)
+static size_t syscall_arg__scnprintf_futex_op(char *bf, size_t size, unsigned long arg,
+ u8 arg_idx __maybe_unused, u8 *arg_mask)
{
enum syscall_futex_args {
SCF_UADDR = (1 << 0),
@@ -207,12 +216,13 @@ static size_t syscall_arg__scnprintf_futex_op(char *bf, size_t size, unsigned lo
#define SCA_FUTEX_OP syscall_arg__scnprintf_futex_op
static size_t syscall_arg__scnprintf_open_flags(char *bf, size_t size,
- unsigned long arg, u8 *arg_mask)
+ unsigned long arg,
+ u8 arg_idx, u8 *arg_mask)
{
int printed = 0, flags = arg;
if (!(flags & O_CREAT))
- *arg_mask |= 1 << 2; /* Mask the mode parm */
+ *arg_mask |= 1 << (arg_idx + 1); /* Mask the mode parm */
if (flags == 0)
return scnprintf(bf, size, "RDONLY");
@@ -265,7 +275,7 @@ static size_t syscall_arg__scnprintf_open_flags(char *bf, size_t size,
static struct syscall_fmt {
const char *name;
const char *alias;
- size_t (*arg_scnprintf[6])(char *bf, size_t size, unsigned long arg, u8 *arg_mask);
+ size_t (*arg_scnprintf[6])(char *bf, size_t size, unsigned long arg, u8 arg_idx, u8 *arg_mask);
bool errmsg;
bool timeout;
bool hexret;
@@ -302,6 +312,10 @@ static struct syscall_fmt {
.arg_scnprintf = { [0] = SCA_HEX, /* addr */ }, },
{ .name = "open", .errmsg = true,
.arg_scnprintf = { [1] = SCA_OPEN_FLAGS, /* flags */ }, },
+ { .name = "open_by_handle_at", .errmsg = true,
+ .arg_scnprintf = { [2] = SCA_OPEN_FLAGS, /* flags */ }, },
+ { .name = "openat", .errmsg = true,
+ .arg_scnprintf = { [2] = SCA_OPEN_FLAGS, /* flags */ }, },
{ .name = "poll", .errmsg = true, .timeout = true, },
{ .name = "ppoll", .errmsg = true, .timeout = true, },
{ .name = "pread", .errmsg = true, .alias = "pread64", },
@@ -332,7 +346,7 @@ struct syscall {
bool filtered;
struct syscall_fmt *fmt;
size_t (**arg_scnprintf)(char *bf, size_t size,
- unsigned long arg, u8 *args_mask);
+ unsigned long arg, u8 arg_idx, u8 *args_mask);
};
static size_t fprintf_duration(unsigned long t, FILE *fp)
@@ -589,7 +603,7 @@ static size_t syscall__scnprintf_args(struct syscall *sc, char *bf, size_t size,
if (sc->arg_scnprintf && sc->arg_scnprintf[i]) {
printed += sc->arg_scnprintf[i](bf + printed, size - printed,
- args[i], &mask);
+ args[i], i, &mask);
} else {
printed += scnprintf(bf + printed, size - printed,
"%ld", args[i]);
--
1.8.1.4
next prev parent reply other threads:[~2013-09-02 20:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-02 20:56 [GIT PULL 00/10] perf/core improvements and fixes Arnaldo Carvalho de Melo
2013-09-02 20:56 ` [PATCH 01/10] perf trace: Allow syscall arg formatters to mask args Arnaldo Carvalho de Melo
2013-09-02 20:56 ` [PATCH 02/10] perf trace: Add beautifier for futex 'operation' parm Arnaldo Carvalho de Melo
2013-09-02 20:56 ` [PATCH 03/10] perf: Add a dummy software event to keep tracking Arnaldo Carvalho de Melo
2013-09-02 20:56 ` [PATCH 04/10] perf tools: Add support for PERF_COUNT_SW_DUMMY Arnaldo Carvalho de Melo
2013-09-02 20:56 ` [PATCH 05/10] perf tests: Add 'keep tracking' test Arnaldo Carvalho de Melo
2013-09-02 20:56 ` [PATCH 06/10] perf list: Skip unsupported events Arnaldo Carvalho de Melo
2013-09-02 20:56 ` [PATCH 07/10] perf tools: Fix symbol offset computation for some dsos Arnaldo Carvalho de Melo
2013-09-02 20:56 ` [PATCH 08/10] perf trace: Add beautifier for lseek's whence arg Arnaldo Carvalho de Melo
2013-09-02 20:56 ` [PATCH 09/10] perf trace: Add beautifier for open's flags arg Arnaldo Carvalho de Melo
2013-09-02 20:56 ` Arnaldo Carvalho de Melo [this message]
2013-09-03 5:49 ` [GIT PULL 00/10] perf/core improvements and fixes Ingo Molnar
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=1378155393-7993-11-git-send-email-acme@infradead.org \
--to=acme@infradead.org \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=dsahern@gmail.com \
--cc=efault@gmx.de \
--cc=eranian@google.com \
--cc=fweisbec@gmail.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=paulus@samba.org \
--cc=peterz@infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).