JDK-7194409 : os::javaTimeNanos() shows hot on CPU_CLK_UNHALTED profiles
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 7u6
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2012-08-27
  • Updated: 2013-06-26
  • Resolved: 2012-09-05
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 7 JDK 8 Other
7u40Fixed 8Fixed hs24Fixed
Description from Brandon Mitchell @ Twitter:

"os::javaTimeNanos() shows hot on CPU_CLK_UNHALTED profiles due to
unnecessary function setup/teardown code around
Linux::supports_monotonic_clock(). I've added an inline annotation to
simplify the funcall to a NULL check, and verified the change using
both gdb disas and additional profiling. I observed a 2-3% CPU time
delta in my profile data for os::javaTimeNanos()."

EVALUATION http://hg.openjdk.java.net/hsx/hotspot-gc/hotspot/rev/fa9253dcd4df

EVALUATION Add inline directives to os::Linux::supports_monotonic_clock() and os::Bsd::supports_monotonic_clock().

SUGGESTED FIX --- a/src/os/linux/vm/os_linux.hpp +++ b/src/os/linux/vm/os_linux.hpp @@ -178,7 +178,7 @@ class Linux { // fast POSIX clocks support static void fast_thread_clock_init(void); - static bool supports_monotonic_clock() { + static inline bool supports_monotonic_clock() { return _clock_gettime != NULL; } src/os/linux/vm/os_bsd.hpp probably should change similarly.

PUBLIC COMMENTS Please see Description.