1************************************************************************** 2* The following are notes for all scripts that measure on-CPU times. 3* 4* $Id: ALLoncpu_notes.txt,v 1.1.1.1 2015/09/30 22:01:09 christos Exp $ 5* 6* COPYRIGHT: Copyright (c) 2007 Brendan Gregg. 7************************************************************************** 8 9 10* What is "on-CPU" time? 11 12This is the time that a thread spent running on a CPU. It does not include 13time spent off-CPU time such as sleeping for I/O or waiting for scheduling. 14 15On-CPU times are useful for showing who is causing the CPUs to be busy, 16since they measure how much CPU time has been consumed by that thread. 17 18On-CPU times are also less susceptible to system "noise" than elapsed times, 19since much of the noise will be filtered out. DTrace itself also tries 20to subtract the small overheads of DTrace from the on-CPU time, to improve 21the accuracy of this time. 22 23See Notes/ALLelapsed_notes.txt for a description of a different time 24measurement, "elapsed" time. 25 26 27* How is "on-CPU" time measured? 28 29In DTrace, the following template provides on-CPU time as "this->oncpu", 30 31 <start-probe> 32 { 33 self->vstart = vtimestamp; 34 } 35 36 <end-probe> 37 { 38 this->oncpu = vtimestamp - self->vstart; 39 self->vstart = 0; 40 ... 41 } 42 43