[lttng-dev] [PATCH] fix timestamps on architectures without CONFIG_KTIME_SCALAR

Gerlando Falauto gerlando.falauto at keymile.com
Thu Aug 30 11:36:32 EDT 2012


trace_clock_monotonic_wrapper() should return a u64 representing the
number of nanoseconds since system startup.
ktime_get() provides that value directly within its .tv64 field only
on those architectures defining CONFIG_KTIME_SCALAR, whereas in all
other cases (e.g. PowerPC) a ktime_to_ns() conversion (which
translates back to .tv64 when CONFIG_KTIME_SCALAR is defined)
becomes necessary.

Signed-off-by: Gerlando Falauto <gerlando.falauto at keymile.com>
---
 wrapper/trace-clock.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/wrapper/trace-clock.h b/wrapper/trace-clock.h
index 6ea9e81..bced61c 100644
--- a/wrapper/trace-clock.h
+++ b/wrapper/trace-clock.h
@@ -46,7 +46,7 @@ static inline u64 trace_clock_monotonic_wrapper(void)
 		return (u64) -EIO;
 
 	ktime = ktime_get();
-	return (u64) ktime.tv64;
+	return ktime_to_ns(ktime);
 }
 
 static inline u32 trace_clock_read32(void)
-- 
1.7.10.1




More information about the lttng-dev mailing list