Request reviewing patch for bug8006942

David Holmes david.holmes at oracle.com
Wed Feb 6 17:41:45 PST 2013


Thanks for the updated patch. I am looking into it as time permits. 
Sorry for the delay.

David Holmes

On 1/02/2013 10:24 PM, liang xie wrote:
> 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


More information about the hotspot-runtime-dev mailing list