Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>CPU time tells you how much time the thread took utilizing the CPU, i.e. actually executing code. Block or wait times increase if the thread had been suspended because of e.g. waiting for I/O or entering a monitor.</p> <p>However, it's up to the JVM and OS to assign CPU time to threads and processes. They may choose to suspend a thread or process and resume another one at any time, if necessary. So the thread may be in a state where it is neither blocked nor waiting but just not executing. This will add to wall time but not blocked/wait time.</p> <p>The CPU time value comes from the operating system. I checked OpenJDK 7 for Linux systems, so it might be different on other platforms. Either <code>fast_thread_cpu_time()</code> or <code>slow_thread_cpu_time()</code> is called to calculate CPU time for threads. Both functions are located in<code>hotspot/src/os/linux/vm/os_linux.cpp</code> of the OpenJDK 7 source. </p> <p>Since <a href="https://stackoverflow.com/questions/1888160/distinguish-java-threads-and-os-threads">OpenJDK uses pthreads on Linux</a>, each Java thread is implemented as a lightweight OS thread. The fast method supported on modern kernels calls <code>pthread_getcpuclockid</code> to retrieve the <code>clock_id</code> for specific thread and then call <code>clock_gettime</code> to retrieve the CPU time for the thread. The slow method will lookup the CPU time values from <code>/proc/self/task/&lt;tid&gt;/stat</code>. Both methods tell you how much time a thread spent consuming CPU in user and system/kernel space.</p> <p><strong>References:</strong></p> <ul> <li><a href="http://download.java.net/openjdk/jdk7/" rel="nofollow noreferrer">OpenJDK 7 source</a></li> <li><a href="http://linux.die.net/man/3/pthread_getcpuclockid" rel="nofollow noreferrer">pthread_getcpuclockid(3) man page</a></li> <li><a href="http://linux.die.net/man/3/clock_gettime" rel="nofollow noreferrer">clock_gettime(3) man page</a></li> <li><a href="http://linux.die.net/man/5/proc" rel="nofollow noreferrer">proc(5) man page</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload