aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorBjoern Brandenburg <bbb@swan.cs.unc.edu>2007-02-20 12:05:38 -0500
committerBjoern Brandenburg <bbb@swan.cs.unc.edu>2007-02-20 12:05:38 -0500
commit7b27859f5c93b477182a92602a43779b69818763 (patch)
treea632b07ae2603b1644b56ecdc785506995ec0744 /kernel
parentaab9254bb83d68824e5cb3f8e82cf2c6aad8acf4 (diff)
parent0df772d53bf0242e14b22ae18a8c04e50388c22a (diff)
Merge with git+ssh://cvs.cs.unc.edu/cvs/proj/litmus/repo/litmus
Pulled in john's quantum alignment updates
Diffstat (limited to 'kernel')
-rw-r--r--kernel/timer.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/kernel/timer.c b/kernel/timer.c
index c2a8ccfc28..532fdde9ba 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -737,6 +737,29 @@ static inline s64 __get_nsec_offset(void)
737 return ns_offset; 737 return ns_offset;
738} 738}
739 739
740/*
741 * Public, non-inline version of the above function, used within
742 * local timer interrupt handler to get an idea of the current
743 * timestamp without locking. (We can't lock and are only reading,
744 * so it can only hurt us, not others.)
745 */
746s64 get_nsec_offset(void)
747{
748 cycle_t cycle_now, cycle_delta;
749 s64 ns_offset;
750
751 /* read clocksource: */
752 cycle_now = clocksource_read(clock);
753
754 /* calculate the delta since the last update_wall_time: */
755 cycle_delta = (cycle_now - clock->cycle_last) & clock->mask;
756
757 /* convert to nanoseconds: */
758 ns_offset = cyc2ns(clock, cycle_delta);
759
760 return ns_offset;
761}
762
740/** 763/**
741 * __get_realtime_clock_ts - Returns the time of day in a timespec 764 * __get_realtime_clock_ts - Returns the time of day in a timespec
742 * @ts: pointer to the timespec to be set 765 * @ts: pointer to the timespec to be set