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 <dsah...@gmail.com>
Cc: Adrian Hunter <adrian.hun...@intel.com>
Cc: Frederic Weisbecker <fweis...@gmail.com>
Cc: Jiri Olsa <jo...@redhat.com>
Cc: Mike Galbraith <efa...@gmx.de>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Peter Zijlstra <pet...@infradead.org>
Cc: Stephane Eranian <eran...@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

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

Reply via email to