--- old/src/java.base/unix/native/libjli/java_md_solinux.h 2020-03-26 14:02:35.659835143 +0800 +++ new/src/java.base/unix/native/libjli/java_md_solinux.h 2020-03-26 14:02:35.471835809 +0800 @@ -34,8 +34,22 @@ #define CounterGet() (gethrtime()/1000) #define Counter2Micros(counts) (counts) #else /* ! HAVE_GETHRTIME */ -#define CounterGet() (0) -#define Counter2Micros(counts) (1) +/* + * * Add gethrtime() implementation for launch time debug on Linux. + * */ +#include +inline uint64_t gethrtime() { + uint64_t result = 0; + struct timeval tv; + if (gettimeofday(&tv, NULL) != -1) { + result = 1000000LL * (uint64_t)tv.tv_sec; + result += (uint64_t)tv.tv_usec; + } + return result; +} + +#define CounterGet() (gethrtime()) +#define Counter2Micros(counts) (counts) #endif /* HAVE_GETHRTIME */ /* pointer to environment */