Request reviewing patch for bug8006942

David Holmes david.holmes at oracle.com
Wed Feb 6 18:06:44 PST 2013


Hi,

As I said in my original response to your patch, we currently still have 
to build on linux platforms that do not have CLOCK_MONOTONIC_RAW so 
there is no way to incorporate this patch until we move off those 
systems to a later build platform.

If we ifdef'd the change so that it only built on those later platforms 
then the code would not be being built or tested. Hence it is not 
suitable for inclusion in OpenJDK at this time in my opinion.

I'd welcome other opinions, but ensuring that all code is built and 
tested is not a requirement we should be relaxing. I know there are 
efforts to setup external infrastructure to support the porting efforts, 
which may assist here, but again until these exist the patch needs to 
remain on hold.

Thanks,
David


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