src/os/windows/vm/os_windows.cpp

changeset 5204
e72f7eecc96d
parent 5182
a213d425d87a
child 5237
f2110083203d
     1.1 --- a/src/os/windows/vm/os_windows.cpp	Sat Jun 01 10:00:56 2013 +0200
     1.2 +++ b/src/os/windows/vm/os_windows.cpp	Tue May 28 09:32:06 2013 +0200
     1.3 @@ -813,15 +813,21 @@
     1.4    return result;
     1.5  }
     1.6  
     1.7 -// For now, we say that Windows does not support vtime.  I have no idea
     1.8 -// whether it can actually be made to (DLD, 9/13/05).
     1.9 -
    1.10 -bool os::supports_vtime() { return false; }
    1.11 +bool os::supports_vtime() { return true; }
    1.12  bool os::enable_vtime() { return false; }
    1.13  bool os::vtime_enabled() { return false; }
    1.14 +
    1.15  double os::elapsedVTime() {
    1.16 -  // better than nothing, but not much
    1.17 -  return elapsedTime();
    1.18 +  FILETIME created;
    1.19 +  FILETIME exited;
    1.20 +  FILETIME kernel;
    1.21 +  FILETIME user;
    1.22 +  if (GetThreadTimes(GetCurrentThread(), &created, &exited, &kernel, &user) != 0) {
    1.23 +    // the resolution of windows_to_java_time() should be sufficient (ms)
    1.24 +    return (double) (windows_to_java_time(kernel) + windows_to_java_time(user)) / MILLIUNITS;
    1.25 +  } else {
    1.26 +    return elapsedTime();
    1.27 +  }
    1.28  }
    1.29  
    1.30  jlong os::javaTimeMillis() {

mercurial