]> Pileus Git - ~andy/linux/blobdiff - kernel/trace/trace_clock.c
tracing: Add "uptime" trace clock that uses jiffies
[~andy/linux] / kernel / trace / trace_clock.c
index 394783531cbb76d9f7d9ab34ae0b6963d5d14dff..26dc348332b798eeb43a77cf2d89357512d9e8c0 100644 (file)
@@ -21,8 +21,6 @@
 #include <linux/ktime.h>
 #include <linux/trace_clock.h>
 
-#include "trace.h"
-
 /*
  * trace_clock_local(): the simplest and least coherent tracing clock.
  *
@@ -44,6 +42,7 @@ u64 notrace trace_clock_local(void)
 
        return clock;
 }
+EXPORT_SYMBOL_GPL(trace_clock_local);
 
 /*
  * trace_clock(): 'between' trace clock. Not completely serialized,
@@ -58,6 +57,16 @@ u64 notrace trace_clock(void)
        return local_clock();
 }
 
+/*
+ * trace_jiffy_clock(): Simply use jiffies as a clock counter.
+ */
+u64 notrace trace_clock_jiffies(void)
+{
+       u64 jiffy = jiffies - INITIAL_JIFFIES;
+
+       /* Return nsecs */
+       return (u64)jiffies_to_usecs(jiffy) * 1000ULL;
+}
 
 /*
  * trace_clock_global(): special globally coherent trace clock
@@ -86,7 +95,7 @@ u64 notrace trace_clock_global(void)
        local_irq_save(flags);
 
        this_cpu = raw_smp_processor_id();
-       now = cpu_clock(this_cpu);
+       now = sched_clock_cpu(this_cpu);
        /*
         * If in an NMI context then dont risk lockups and return the
         * cpu_clock() time: