Trivial patch about "Use CLOCK_MONOTONIC_RAW if available"
liang xie
xieliang007 at gmail.com
Thu Jan 24 23:42:55 PST 2013
Hi,
I'm not familiar hotspot dev flow and i don't know how to make a webcr:)
please feel free to
move it to the correct list if wrong.
"CLOCK_MONOTONIC_RAW" is available from 2.6.28+, it's a better choice while
ntp
slew happened againt CLOCK_MONOTONIC_RAW. This's important for some
applications,
e.g. zookeeper. Please see zookeeper--1616 for details.
diff -r 8389681cd7b1 src/os/linux/vm/os_linux.cpp
--- a/src/os/linux/vm/os_linux.cpp Tue Nov 15 16:44:09 2011 -0800
+++ b/src/os/linux/vm/os_linux.cpp Fri Jan 25 15:14:55 2013 +0800
@@ -1444,7 +1444,11 @@
jlong os::javaTimeNanos() {
if (Linux::supports_monotonic_clock()) {
struct timespec tp;
+ #ifdef CLOCK_MONOTONIC_RAW
+ int status = Linux::clock_gettime(CLOCK_MONOTONIC_RAW, &tp);
+ #else
int status = Linux::clock_gettime(CLOCK_MONOTONIC, &tp);
+ #endif
assert(status == 0, "gettime error");
jlong result = jlong(tp.tv_sec) * (1000 * 1000 * 1000) +
jlong(tp.tv_nsec);
return result;
More information about the hotspot-dev
mailing list