From: David Ahern <dsahern@gmail.com>
To: acme@ghostprotocols.net, linux-kernel@vger.kernel.org
Cc: David Ahern <dsahern@gmail.com>,
Adrian Hunter <adrian.hunter@intel.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 3/3] perf trace: Add beautifier for clock_gettime's clk_id argument
Date: Wed, 4 Sep 2013 12:37:45 -0600 [thread overview]
Message-ID: <1378319865-55695-3-git-send-email-dsahern@gmail.com> (raw)
In-Reply-To: <1378319865-55695-1-git-send-email-dsahern@gmail.com>
Before:
0.030 ( 0.002 ms): 2571 clock_gettime(which_clock: 1, tp: 0x7f3b45729cd0 ) = 0
After:
0.030 ( 0.002 ms): 2571 clock_gettime(which_clock: MONOTONIC, tp: 0x7f3b45729cd0 ) = 0
Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Adrian Hunter <adrian.hunter@intel.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>
---
tools/perf/builtin-trace.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index b245102..f943960 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -428,6 +428,37 @@ static size_t syscall_arg__scnprintf_signum(char *bf, size_t size, struct syscal
#define SCA_SIGNUM syscall_arg__scnprintf_signum
+static size_t
+syscall_arg__scnprintf_clk_gettime(char *bf, size_t size,
+ struct syscall_arg *arg)
+{
+ size_t printed = 0;
+ clockid_t clk_id = arg->val;
+
+ switch (clk_id) {
+#define P_CLOCK_ID(n) case CLOCK_##n: printed = scnprintf(bf, size, #n);
+ P_CLOCK_ID(REALTIME); break;
+#ifdef CLOCK_REALTIME_COARSE
+ P_CLOCK_ID(REALTIME_COARSE); break;
+#endif
+ P_CLOCK_ID(MONOTONIC); break;
+#ifdef CLOCK_MONOTONIC_RAW
+ P_CLOCK_ID(MONOTONIC_RAW); break;
+#endif
+#ifdef CLOCK_MONOTONIC_COARSE
+ P_CLOCK_ID(MONOTONIC_COARSE); break;
+#endif
+ P_CLOCK_ID(PROCESS_CPUTIME_ID); break;
+ P_CLOCK_ID(THREAD_CPUTIME_ID); break;
+#undef P_CLOCK_ID
+ default: printed = scnprintf(bf, size, "%#x", arg); break;
+ }
+
+ return printed;
+}
+
+#define SCA_CLOCK_ID syscall_arg__scnprintf_clk_gettime
+
static struct syscall_fmt {
const char *name;
const char *alias;
@@ -442,6 +473,8 @@ static struct syscall_fmt {
{ .name = "arch_prctl", .errmsg = true, .alias = "prctl", },
{ .name = "brk", .hexret = true,
.arg_scnprintf = { [0] = SCA_HEX, /* brk */ }, },
+ { .name = "clock_gettime", .errmsg = true,
+ .arg_scnprintf = { [0] = SCA_CLOCK_ID, /* clk_id */ }, },
{ .name = "connect", .errmsg = true, },
{ .name = "fcntl", .errmsg = true,
.arg_scnprintf = { [1] = SCA_STRARRAY, /* cmd */ },
--
1.7.10.1
next prev parent reply other threads:[~2013-09-04 18:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-04 18:37 [PATCH 1/3] perf trace: Add option to show full timestamp David Ahern
2013-09-04 18:37 ` [PATCH 2/3] perf trace: Remove duplicate mmap entry in syscall_fmts array David Ahern
2013-10-15 5:21 ` [tip:perf/core] " tip-bot for David Ahern
2013-09-04 18:37 ` David Ahern [this message]
2013-10-15 5:21 ` [tip:perf/core] perf trace: Add option to show full timestamp tip-bot for David Ahern
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=1378319865-55695-3-git-send-email-dsahern@gmail.com \
--to=dsahern@gmail.com \
--cc=acme@ghostprotocols.net \
--cc=adrian.hunter@intel.com \
--cc=efault@gmx.de \
--cc=eranian@google.com \
--cc=fweisbec@gmail.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.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).