RFR(xs): 8150843: [windows] os::getTimesSecs() returns negative values for kernel, user times
David Holmes
david.holmes at oracle.com
Mon Feb 29 21:12:50 UTC 2016
Hi Thomas,
On 1/03/2016 3:14 AM, Thomas Stüfe wrote:
> Hi all,
>
> please review and sponsor this small fix.
>
> It fixes an error in os::getTimesSecs() for windows which causes the
> numbers for kernel- and usertime to be off. This does not cause an error,
> because the sole user of this function, the TraceCpuTime class, uses this
> function to measure twice and calculate the deltas.
>
> I still think it is a good idea to fix this bug - with the fix, the
> returned values are based on the process start and will be the same for all
> platforms (the *nix platforms use times()).
>
> bug report: https://bugs.openjdk.java.net/browse/JDK-8150843
> webrev:
> http://cr.openjdk.java.net/~stuefe/webrevs/8150843-windows-osGetTimesSecs/webrev.00/webrev/
So the error is that kernel and user times are treated as-if they were
absolute times - which they are not.
I still find this somewhat confusing though:
955 jlong user_millis = jlong_from(user_time.dwHighDateTime,
user_time.dwLowDateTime);
956 jlong system_millis = jlong_from(kernel_time.dwHighDateTime,
kernel_time.dwLowDateTime);
as neither of those calculations will give a value that represents
milliseconds. I'd rather see the adjustment to millis occur above rather
than here:
958 *process_user_time = ((double) user_millis) / ((double) (10 *
MICROUNITS));
959 *process_system_time = ((double) system_millis) / ((double)
(10 * MICROUNITS));
Thanks,
David
> Kind Regards, Thomas
>
More information about the hotspot-runtime-dev
mailing list