]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - cddl/contrib/dtracetoolkit/Notes/ALLoncpu_notes.txt
Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.
[FreeBSD/stable/10.git] / cddl / contrib / dtracetoolkit / Notes / ALLoncpu_notes.txt
1 **************************************************************************
2 * The following are notes for all scripts that measure on-CPU times.
3 *
4 * $Id: ALLoncpu_notes.txt 58 2007-10-01 13:36:29Z brendan $
5 *
6 * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
7 **************************************************************************
8
9
10 * What is "on-CPU" time?
11
12 This is the time that a thread spent running on a CPU. It does not include
13 time spent off-CPU time such as sleeping for I/O or waiting for scheduling.
14
15 On-CPU times are useful for showing who is causing the CPUs to be busy,
16 since they measure how much CPU time has been consumed by that thread.
17
18 On-CPU times are also less susceptible to system "noise" than elapsed times,
19 since much of the noise will be filtered out. DTrace itself also tries
20 to subtract the small overheads of DTrace from the on-CPU time, to improve
21 the accuracy of this time.
22
23 See Notes/ALLelapsed_notes.txt for a description of a different time
24 measurement, "elapsed" time.
25
26
27 * How is "on-CPU" time measured?
28
29 In 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