Home | History | Annotate | Line # | Download | only in Notes
      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 
     12 Elapsed time is the absolute time from one point to another. This time
     13 includes everything that happened between these points, including 
     14 off-CPU time due to other system events such as I/O, scheduling,
     15 interrupts, etc. It also includes the small overheads of DTrace itself.
     16 
     17 Elapsed times are useful for identifying where latencies are, since
     18 regardless of their nature (CPU, I/O, ...), they will be visible in
     19 elapsed time.
     20 
     21 Since elapsed times don't filter out anything, they are suseptible to
     22 "noise" - random system events that are unrelated to the analysis target.
     23 For that reason, it may be best to take several measurements of elapsed
     24 time and take the average (or run your workload several times and let
     25 DTrace take the average).
     26 
     27 See Notes/ALLoncpu_notes.txt for a description of a different time
     28 measurement, "on-CPU" time.
     29 
     30 
     31 * How is "elapsed" time measured?
     32 
     33 In 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