projects
/
ust.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Replace gettimeofday() with clock_gettime(CLOCK_MONOTONIC,...)
[ust.git]
/
include
/
ust
/
clock.h
diff --git
a/include/ust/clock.h
b/include/ust/clock.h
index d4b6a9ddc1e2768a219beed14d0c6336b4d58b13..cb8a663ceb229f75ab19cc69db8df4390084f8ea 100644
(file)
--- a/
include/ust/clock.h
+++ b/
include/ust/clock.h
@@
-18,6
+18,7
@@
#ifndef UST_CLOCK_H
#define UST_CLOCK_H
#ifndef UST_CLOCK_H
#define UST_CLOCK_H
+#include <time.h>
#include <sys/time.h>
#include <ust/kcompat/kcompat.h>
#include <sys/time.h>
#include <ust/kcompat/kcompat.h>
@@
-34,6
+35,9
@@
For merging traces with the kernel, a time source compatible with that of
the kernel is necessary.
For merging traces with the kernel, a time source compatible with that of
the kernel is necessary.
+ Instead of gettimeofday(), we are now using clock_gettime for better
+ precision and monotonicity.
+
*/
#define TRACE_CLOCK_GENERIC
*/
#define TRACE_CLOCK_GENERIC
@@
-41,13
+45,13
@@
static __inline__ u64 trace_clock_read64(void)
{
static __inline__ u64 trace_clock_read64(void)
{
- struct time
val tv
;
+ struct time
spec ts
;
u64 retval;
u64 retval;
-
gettimeofday(&tv, NULL
);
- retval = t
v
.tv_sec;
- retval *= 1000000;
- retval += t
v.tv_u
sec;
+
clock_gettime(CLOCK_MONOTONIC, &ts
);
+ retval = t
s
.tv_sec;
+ retval *= 1000000
000
;
+ retval += t
s.tv_n
sec;
return retval;
}
return retval;
}
@@
-104,7
+108,7
@@
static __inline__ u64 trace_clock_read64(void)
static __inline__ u64 trace_clock_frequency(void)
{
static __inline__ u64 trace_clock_frequency(void)
{
- return 1000000LL;
+ return 1000000
000
LL;
}
static __inline__ u32 trace_clock_freq_scale(void)
}
static __inline__ u32 trace_clock_freq_scale(void)
This page took
0.026712 seconds
and
4
git commands to generate.