6888526: Linux getCurrentThreadCpuTime is drastically slower than Windows
authoraph
Wed, 28 Jul 2010 17:38:21 +0100
changeset 6174 24cec171092f
parent 6173 c0c872cc6064
child 6175 86dbf3cacacc
6888526: Linux getCurrentThreadCpuTime is drastically slower than Windows Reviewed-by: dcubed, dholmes
hotspot/src/os/linux/vm/globals_linux.hpp
hotspot/src/share/vm/runtime/arguments.cpp
--- a/hotspot/src/os/linux/vm/globals_linux.hpp	Sun Jul 25 07:31:50 2010 -0700
+++ b/hotspot/src/os/linux/vm/globals_linux.hpp	Wed Jul 28 17:38:21 2010 +0100
@@ -29,9 +29,10 @@
   product(bool, UseOprofile, false,                                 \
         "enable support for Oprofile profiler")                     \
                                                                     \
-  product(bool, UseLinuxPosixThreadCPUClocks, false,                \
-          "enable fast Linux Posix clocks where available")         \
-
+  product(bool, UseLinuxPosixThreadCPUClocks, true,                 \
+          "enable fast Linux Posix clocks where available")
+// NB: The default value of UseLinuxPosixThreadCPUClocks may be
+// overridden in Arguments::parse_each_vm_init_arg.
 
 //
 // Defines Linux-specific default values. The flags are available on all
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Sun Jul 25 07:31:50 2010 -0700
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Wed Jul 28 17:38:21 2010 +0100
@@ -2593,6 +2593,12 @@
       FLAG_IS_DEFAULT(UseVMInterruptibleIO)) {
     FLAG_SET_DEFAULT(UseVMInterruptibleIO, true);
   }
+#ifdef LINUX
+ if (JDK_Version::current().compare_major(6) <= 0 &&
+      FLAG_IS_DEFAULT(UseLinuxPosixThreadCPUClocks)) {
+    FLAG_SET_DEFAULT(UseLinuxPosixThreadCPUClocks, false);
+  }
+#endif // LINUX
   return JNI_OK;
 }