Commit 8aacf017b065a805d27467843490c976835eb4a5
Committed by
Steven Rostedt
1 parent
328df4759c
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
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>
Showing 3 changed files with 12 additions and 0 deletions Side-by-side Diff
include/linux/trace_clock.h
kernel/trace/trace.c
kernel/trace/trace_clock.c
... | ... | @@ -57,6 +57,16 @@ |
57 | 57 | return local_clock(); |
58 | 58 | } |
59 | 59 | |
60 | +/* | |
61 | + * trace_jiffy_clock(): Simply use jiffies as a clock counter. | |
62 | + */ | |
63 | +u64 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 | 72 | * trace_clock_global(): special globally coherent trace clock |