JDK-8240295 : hs_err elapsed time in seconds is not accurate enough
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 15
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2020-03-02
  • Updated: 2021-03-19
  • Resolved: 2020-03-09
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 13 JDK 15 JDK 8 Other
11.0.9-oracleFixed 13.0.7Fixed 15 b14Fixed 8u270Fixed openjdk8u272Fixed
hs_err reports elapsed time in seconds.
Events are reported in 1/1000th of a second detail.

As second can be a long time, and we might want to know if the last Event logged happened a second ago, or 1/1000th of a second a go, i.e. "right now"?


void os::print_date_and_time(outputStream *st, char* buf, size_t buflen) {
  double t = os::elapsedTime();
  // NOTE: It tends to crash after a SEGV if we want to printf("%f",...) in
  //       Linux. Must be a bug in glibc ? Workaround is to round "t" to int
  //       before printf. We lost some precision, but who cares?
  int eltime = (int)t;  // elapsed time in seconds

The comment came from before JDK 5 repo creation.
It's time to remove the slight on glibc here.

Fix request (13u) on behalf of Ilarion Nakonechnyy: I'd like to port it to 13u, too. Applies clean, tier1 runs OK.

Fix request (11u) -- will label after testing completed. I would like to downport this for parity with 11.0.9-oracle. Applies clean.

8u Fix Request: I would like to backport this patch to 8u for parity with Oracle 8u271. The original patch does not apply cleanly. There is one conflict, where 8u (unpatched) misses leading space on following message: st->print_cr(" elapsed time: %d seconds (%dd %dh %dm %ds)", eltime, eldays, elhours, elmins, elsecs); Code review thread: https://mail.openjdk.java.net/pipermail/jdk8u-dev/2020-June/012059.html (reviewed)

URL: https://hg.openjdk.java.net/jdk/jdk/rev/8a14919d365d User: kevinw Date: 2020-03-09 13:45:33 +0000

ILW = MLM = P4