hotspot/src/os/windows/vm/os_windows.cpp
changeset 17854 d65bc1546091
parent 17832 4bb8ccdc32a9
child 18025 b7bcf7497f93
--- a/hotspot/src/os/windows/vm/os_windows.cpp	Sat Jun 01 10:00:56 2013 +0200
+++ b/hotspot/src/os/windows/vm/os_windows.cpp	Tue May 28 09:32:06 2013 +0200
@@ -813,15 +813,21 @@
   return result;
 }
 
-// For now, we say that Windows 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();
+  FILETIME created;
+  FILETIME exited;
+  FILETIME kernel;
+  FILETIME user;
+  if (GetThreadTimes(GetCurrentThread(), &created, &exited, &kernel, &user) != 0) {
+    // the resolution of windows_to_java_time() should be sufficient (ms)
+    return (double) (windows_to_java_time(kernel) + windows_to_java_time(user)) / MILLIUNITS;
+  } else {
+    return elapsedTime();
+  }
 }
 
 jlong os::javaTimeMillis() {