OpenJDK / jdk / jdk
changeset 56436:4107e5a422b6
8231457: Asserts on AIX because os::elapsed_counter() is not monotonic
Summary: replace gettimeofday with javaTimeNanos
Reviewed-by: dholmes, stuefe
author | azeller |
---|---|
date | Sat, 28 Sep 2019 17:52:07 -0400 |
parents | 31524b016783 |
children | 0df9370fee29 |
files | src/hotspot/os/aix/os_aix.cpp |
diffstat | 1 files changed, 4 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/hotspot/os/aix/os_aix.cpp Sat Sep 28 12:33:34 2019 -0700 +++ b/src/hotspot/os/aix/os_aix.cpp Sat Sep 28 17:52:07 2019 -0400 @@ -1027,17 +1027,15 @@ // Time since start-up in seconds to a fine granularity. // Used by VMSelfDestructTimer and the MemProfiler. double os::elapsedTime() { - return (double)(os::elapsed_counter()) * 0.000001; + return ((double)os::elapsed_counter()) / os::elapsed_frequency(); // nanosecond resolution } jlong os::elapsed_counter() { - timeval time; - int status = gettimeofday(&time, NULL); - return jlong(time.tv_sec) * 1000 * 1000 + jlong(time.tv_usec) - initial_time_count; + return javaTimeNanos() - initial_time_count; } jlong os::elapsed_frequency() { - return (1000 * 1000); + return NANOSECS_PER_SEC; // nanosecond resolution } bool os::supports_vtime() { return true; } @@ -3498,7 +3496,7 @@ // _main_thread points to the thread that created/loaded the JVM. Aix::_main_thread = pthread_self(); - initial_time_count = os::elapsed_counter(); + initial_time_count = javaTimeNanos(); os::Posix::init(); }