On Fri, 2010-08-20 at 13:37 -1000, Zachary Amsden wrote:
On 08/20/2010 08:39 AM, john stultz wrote:I can understand wanting that, way back I was pushing for s64 ns
On Thu, 2010-08-19 at 22:07 -1000, Zachary Amsden wrote:The new interface was suggested several times, so I'm proposing it. I'm
Add a kernel call to get the number of nanoseconds since boot. ThisFew comments here.
is generally useful enough to make it a generic call.
Signed-off-by: Zachary Amsden<zamsden@xxxxxxxxxx>So instead of converting the timespec from getboottime, why did you add
---
include/linux/time.h | 1 +
kernel/time/timekeeping.c | 27 +++++++++++++++++++++++++++
2 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/include/linux/time.h b/include/linux/time.h
index ea3559f..5d04108 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -145,6 +145,7 @@ extern void getnstimeofday(struct timespec *tv);
extern void getrawmonotonic(struct timespec *ts);
extern void getboottime(struct timespec *ts);
extern void monotonic_to_bootbased(struct timespec *ts);
+extern s64 getnsboottime(void);
a new interface? Also if not a timespec, why did you pick a s64 instead
of a ktime_t?
indifferent to putting it the kernel API or making it internal to KVM.
KVM doesn't want to deal with conversions to / from ktime_t; this code
uses a lot (too much) math, and it's easy to get wrong when splitting
sec / nsec fields. So s64 seems a natural type for ns values. I
realize it's not entirely consistent with the kernel API, but s64
representation for ns seems to be creeping in.
representations for most time values, but the ktime_t was considered a
reasonable compromise to avoid costly 64bit divides to split (sec,nsec)
on 32bit arches.