Top


定義場所(file name)

hotspot/src/os/linux/vm/os_linux.cpp

説明(description)

// This is the fastest way to get thread cpu time on Linux.
// Returns cpu time (user+sys) for any thread, not only for current.
// POSIX compliant clocks are implemented in the kernels 2.6.16+.
// It might work on 2.6.10+ with a special kernel/glibc patch.
// For reference, please, see IEEE Std 1003.1-2004:
//   http://www.unix.org/single_unix_specification

名前(function name)

jlong os::Linux::fast_thread_cpu_time(clockid_t clockid) {

本体部(body)

  {- -------------------------------------------
  (1) clock_gettime() を呼び出すだけ.
      ---------------------------------------- -}

      struct timespec tp;
      int rc = os::Linux::clock_gettime(clockid, &tp);
      assert(rc == 0, "clock_gettime is expected to return 0 code");

      return (tp.tv_sec * SEC_IN_NANOSECS) + tp.tv_nsec;
    }

This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.