lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1378319865-55695-3-git-send-email-dsahern@gmail.com>
Date:	Wed,  4 Sep 2013 12:37:45 -0600
From:	David Ahern <dsahern@...il.com>
To:	acme@...stprotocols.net, linux-kernel@...r.kernel.org
Cc:	David Ahern <dsahern@...il.com>,
	Adrian Hunter <adrian.hunter@...el.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Jiri Olsa <jolsa@...hat.com>, Mike Galbraith <efault@....de>,
	Paul Mackerras <paulus@...ba.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Stephane Eranian <eranian@...gle.com>
Subject: [PATCH 3/3] perf trace: Add beautifier for clock_gettime's clk_id argument

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@...il.com>
Cc: Adrian Hunter <adrian.hunter@...el.com>
Cc: Frederic Weisbecker <fweisbec@...il.com>
Cc: Jiri Olsa <jolsa@...hat.com>
Cc: Mike Galbraith <efault@....de>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Stephane Eranian <eranian@...gle.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 majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ