OpenJDK / zgc / zgc
changeset 27668:d373a4781717
8064471: Port 8013895: G1: G1SummarizeRSetStats output on Linux needs improvement to AIX
Reviewed-by: dholmes, simonis
Contributed-by: gunter.haug@sap.com
author | simonis |
---|---|
date | Thu, 13 Nov 2014 16:58:56 +0100 |
parents | 3c814b51da6c |
children | c2c526bc1a18 e86850ef14cf |
files | hotspot/src/os/aix/vm/os_aix.cpp |
diffstat | 1 files changed, 16 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/hotspot/src/os/aix/vm/os_aix.cpp Mon Nov 17 11:26:43 2014 -0500 +++ b/hotspot/src/os/aix/vm/os_aix.cpp Thu Nov 13 16:58:56 2014 +0100 @@ -107,6 +107,12 @@ #include <sys/vminfo.h> #include <sys/wait.h> +// If RUSAGE_THREAD for getrusage() has not been defined, do it here. The code calling +// getrusage() is prepared to handle the associated failure. +#ifndef RUSAGE_THREAD +#define RUSAGE_THREAD (1) /* only the calling thread */ +#endif + // Add missing declarations (should be in procinfo.h but isn't until AIX 6.1). #if !defined(_AIXVERSION_610) extern "C" { @@ -1072,15 +1078,19 @@ return (1000 * 1000); } -// For now, we say that linux does not support vtime. I have no idea -// whether it can actually be made to (DLD, 9/13/05). - -bool os::supports_vtime() { return false; } +bool os::supports_vtime() { return true; } bool os::enable_vtime() { return false; } bool os::vtime_enabled() { return false; } + double os::elapsedVTime() { - // better than nothing, but not much - return elapsedTime(); + struct rusage usage; + int retval = getrusage(RUSAGE_THREAD, &usage); + if (retval == 0) { + return usage.ru_utime.tv_sec + usage.ru_stime.tv_sec + (usage.ru_utime.tv_usec + usage.ru_stime.tv_usec) / (1000.0 * 1000); + } else { + // better than nothing, but not much + return elapsedTime(); + } } jlong os::javaTimeMillis() {