aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace
diff options
context:
space:
mode:
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>2013-03-14 13:13:45 -0400
committerSteven Rostedt <rostedt@goodmis.org>2013-03-15 00:36:09 -0400
commit8aacf017b065a805d27467843490c976835eb4a5 (patch)
tree3e3ee23502cf2cc6d02baa1f7625b1ef16611eda /kernel/trace
parent328df4759c03e2c3e7429cc6cb0e180c38f32063 (diff)
tracing: Add "uptime" trace clock that uses jiffies
Add a simple trace clock called "uptime" for those that are interested in the uptime of the trace. It uses jiffies as that's the safest method, as other uptime clocks grab seq locks, which could cause a deadlock if taken from an event or function tracer. Requested-by: Mauro Carvalho Chehab <mchehab@redhat.com> Cc: Thomas Gleixner <tglx@linutronix.de Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Frederic Weisbecker <fweisbec@gmail.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/trace.c1
-rw-r--r--kernel/trace/trace_clock.c10
2 files changed, 11 insertions, 0 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index f90ca16afcf2..8eabfbb8003e 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -647,6 +647,7 @@ static struct {
647 { trace_clock_local, "local", 1 }, 647 { trace_clock_local, "local", 1 },
648 { trace_clock_global, "global", 1 }, 648 { trace_clock_global, "global", 1 },
649 { trace_clock_counter, "counter", 0 }, 649 { trace_clock_counter, "counter", 0 },
650 { trace_clock_jiffies, "uptime", 1 },
650 ARCH_TRACE_CLOCKS 651 ARCH_TRACE_CLOCKS
651}; 652};
652 653
diff --git a/kernel/trace/trace_clock.c b/kernel/trace/trace_clock.c
index aa8f5f48dae6..26dc348332b7 100644
--- a/kernel/trace/trace_clock.c
+++ b/kernel/trace/trace_clock.c
@@ -57,6 +57,16 @@ u64 notrace trace_clock(void)
57 return local_clock(); 57 return local_clock();
58} 58}
59 59
60/*
61 * trace_jiffy_clock(): Simply use jiffies as a clock counter.
62 */
63u64 notrace trace_clock_jiffies(void)
64{
65 u64 jiffy = jiffies - INITIAL_JIFFIES;
66
67 /* Return nsecs */
68 return (u64)jiffies_to_usecs(jiffy) * 1000ULL;
69}
60 70
61/* 71/*
62 * trace_clock_global(): special globally coherent trace clock 72 * trace_clock_global(): special globally coherent trace clock