[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v3 4/7] add nspin_sleep function to time manager
From: Paul Semel <phentex@xxxxxxxxx> this function spin sleeps for t nanoseconds Signed-off-by: Paul Semel <phentex@xxxxxxxxx> --- common/time.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/common/time.c b/common/time.c index d0c9ed2..4770b9a 100644 --- a/common/time.c +++ b/common/time.c @@ -139,6 +139,18 @@ int gettimeofday(struct timeval *tp, void *restrict tzp) return 0; } +static inline void nspin_sleep(uint64_t t) +{ + uint64_t curr = since_boot_time(); + uint64_t end = curr + t; + + if ( end < curr ) + panic("end value overflows counter\n"); + + while ( since_boot_time() < end ) + asm volatile ("pause"); +} + /* * Local variables: * mode: C -- 2.16.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |