Request reviewing patch for bug8006942
liang xie
xieliang007 at gmail.com
Fri Feb 1 04:24:01 PST 2013
Hi,
here is an updated patch for bug8006942, please help to review, thanks in
advance.
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 Feb 01 20:18:36 2013 +0800
@@ -149,6 +149,7 @@
static sigset_t check_signal_done;
static bool check_signals = true;;
+static bool support_clock_monotonic_raw = false;
static pid_t _initial_pid = 0;
/* Signal number used to suspend/resume a thread */
@@ -1388,9 +1389,14 @@
// won't be a problem.
struct timespec res;
struct timespec tp;
- if (clock_getres_func (CLOCK_MONOTONIC, &res) == 0 &&
- clock_gettime_func(CLOCK_MONOTONIC, &tp) == 0) {
- // yes, monotonic clock is supported
+ if (clock_getres_func (CLOCK_MONOTONIC_RAW, &res) == 0 &&
+ clock_gettime_func(CLOCK_MONOTONIC_RAW, &tp) == 0) {
+ // raw monotonic clock is supported
+ _clock_gettime = clock_gettime_func;
+ support_clock_monotonic_raw = true;
+ } else if (clock_getres_func (CLOCK_MONOTONIC, &res) == 0 &&
+ clock_gettime_func(CLOCK_MONOTONIC, &tp) {
+ // monotonic clock is supported
_clock_gettime = clock_gettime_func;
} else {
// close librt if there is no monotonic clock
@@ -1444,7 +1450,11 @@
jlong os::javaTimeNanos() {
if (Linux::supports_monotonic_clock()) {
struct timespec tp;
- int status = Linux::clock_gettime(CLOCK_MONOTONIC, &tp);
+ if (support_clock_monotonic_raw) {
+ int status = Linux::clock_gettime(CLOCK_MONOTONIC_RAW, &tp);
+ } else {
+ int status = Linux::clock_gettime(CLOCK_MONOTONIC, &tp);
+ }
assert(status == 0, "gettime error");
jlong result = jlong(tp.tv_sec) * (1000 * 1000 * 1000) +
jlong(tp.tv_nsec);
return result;
Best Regards,
Liang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/attachments/20130201/05f47621/attachment.html
More information about the hotspot-runtime-dev
mailing list