src/hotspot/os/aix/os_aix.cpp
changeset 58390 4107e5a422b6
parent 58202 a45cce906207
child 58491 452ad8f882c6
equal deleted inserted replaced
58389:31524b016783 58390:4107e5a422b6
  1025 // time support
  1025 // time support
  1026 
  1026 
  1027 // Time since start-up in seconds to a fine granularity.
  1027 // Time since start-up in seconds to a fine granularity.
  1028 // Used by VMSelfDestructTimer and the MemProfiler.
  1028 // Used by VMSelfDestructTimer and the MemProfiler.
  1029 double os::elapsedTime() {
  1029 double os::elapsedTime() {
  1030   return (double)(os::elapsed_counter()) * 0.000001;
  1030   return ((double)os::elapsed_counter()) / os::elapsed_frequency(); // nanosecond resolution
  1031 }
  1031 }
  1032 
  1032 
  1033 jlong os::elapsed_counter() {
  1033 jlong os::elapsed_counter() {
  1034   timeval time;
  1034   return javaTimeNanos() - initial_time_count;
  1035   int status = gettimeofday(&time, NULL);
       
  1036   return jlong(time.tv_sec) * 1000 * 1000 + jlong(time.tv_usec) - initial_time_count;
       
  1037 }
  1035 }
  1038 
  1036 
  1039 jlong os::elapsed_frequency() {
  1037 jlong os::elapsed_frequency() {
  1040   return (1000 * 1000);
  1038   return NANOSECS_PER_SEC; // nanosecond resolution
  1041 }
  1039 }
  1042 
  1040 
  1043 bool os::supports_vtime() { return true; }
  1041 bool os::supports_vtime() { return true; }
  1044 bool os::enable_vtime()   { return false; }
  1042 bool os::enable_vtime()   { return false; }
  1045 bool os::vtime_enabled()  { return false; }
  1043 bool os::vtime_enabled()  { return false; }
  3496   init_random(1234567);
  3494   init_random(1234567);
  3497 
  3495 
  3498   // _main_thread points to the thread that created/loaded the JVM.
  3496   // _main_thread points to the thread that created/loaded the JVM.
  3499   Aix::_main_thread = pthread_self();
  3497   Aix::_main_thread = pthread_self();
  3500 
  3498 
  3501   initial_time_count = os::elapsed_counter();
  3499   initial_time_count = javaTimeNanos();
  3502 
  3500 
  3503   os::Posix::init();
  3501   os::Posix::init();
  3504 }
  3502 }
  3505 
  3503 
  3506 // This is called _after_ the global arguments have been parsed.
  3504 // This is called _after_ the global arguments have been parsed.