xref: /netbsd-src/external/cddl/dtracetoolkit/dist/Notes/ALLelapsed_notes.txt (revision c29d51755812ace2e87aeefdb06cb2b4dac7087a)
1**************************************************************************
2* The following are notes for all scripts that measure elapsed time.
3*
4* $Id: ALLelapsed_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 "elapsed" time?
11
12Elapsed time is the absolute time from one point to another. This time
13includes everything that happened between these points, including
14off-CPU time due to other system events such as I/O, scheduling,
15interrupts, etc. It also includes the small overheads of DTrace itself.
16
17Elapsed times are useful for identifying where latencies are, since
18regardless of their nature (CPU, I/O, ...), they will be visible in
19elapsed time.
20
21Since elapsed times don't filter out anything, they are suseptible to
22"noise" - random system events that are unrelated to the analysis target.
23For that reason, it may be best to take several measurements of elapsed
24time and take the average (or run your workload several times and let
25DTrace take the average).
26
27See Notes/ALLoncpu_notes.txt for a description of a different time
28measurement, "on-CPU" time.
29
30
31* How is "elapsed" time measured?
32
33In DTrace, the following template provides elapsed time as "this->elapsed",
34
35   <start-probe>
36   {
37	   self->start = timestamp;
38   }
39
40   <end-probe>
41   {
42	   this->elapsed = timestamp - self->start;
43	   self->start = 0;
44	   ...
45   }
46
47