Home | History | Annotate | Line # | Download | only in Notes
      1  1.1  christos **************************************************************************
      2  1.1  christos * Notes for all scripts that print a function or method flow.
      3  1.1  christos *
      4  1.1  christos * $Id: ALLflow_notes.txt,v 1.1.1.1 2015/09/30 22:01:08 christos Exp $
      5  1.1  christos *
      6  1.1  christos * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
      7  1.1  christos **************************************************************************
      8  1.1  christos 
      9  1.1  christos 
     10  1.1  christos * What is a flow?
     11  1.1  christos 
     12  1.1  christos Output that has some meaningful indent, such as function flow indented by
     13  1.1  christos stack depth. eg,
     14  1.1  christos 
     15  1.1  christos    # ./pl_flow.d 
     16  1.1  christos      C TIME(us)          FILE             -- SUB
     17  1.1  christos      0 2963130861619     func_abc.pl      -> func_a
     18  1.1  christos      0 2963131870998     func_abc.pl        -> func_b
     19  1.1  christos      0 2963132871121     func_abc.pl          -> func_c
     20  1.1  christos      0 2963133881150     func_abc.pl          <- func_c
     21  1.1  christos      0 2963133881166     func_abc.pl        <- func_b
     22  1.1  christos      0 2963133881174     func_abc.pl      <- func_a
     23  1.1  christos    ^C
     24  1.1  christos 
     25  1.1  christos 
     26  1.1  christos * The output looks shuffled?
     27  1.1  christos 
     28  1.1  christos Eg,
     29  1.1  christos 
     30  1.1  christos    # ./pl_flow.d 
     31  1.1  christos      C TIME(us)          FILE             -- SUB
     32  1.1  christos      0 2963130861619     func_abc.pl      -> func_a
     33  1.1  christos      0 2963131870998     func_abc.pl        -> func_b
     34  1.1  christos      0 2963132871121     func_abc.pl          -> func_c
     35  1.1  christos      0 2963133881166     func_abc.pl        <- func_b
     36  1.1  christos      0 2963133881174     func_abc.pl      <- func_a
     37  1.1  christos      1 2963133881150     func_abc.pl          <- func_c
     38  1.1  christos    ^C
     39  1.1  christos 
     40  1.1  christos Yes, this is shuffled. DTrace has been designed with a number of important
     41  1.1  christos goals in mind - including minimising the enabled performance overhead. To do
     42  1.1  christos this, per-CPU kernel buffers have been used to collect output, which are
     43  1.1  christos (currently) dumped in sequence by /usr/sbin/dtrace whenever it wakes
     44  1.1  christos up ("switchrate" tunable). So, on multi-CPU servers, there is always the
     45  1.1  christos possibility that any DTrace script can print out-of-order data.
     46  1.1  christos 
     47  1.1  christos To deal with this behaviour, the flow scripts may,
     48  1.1  christos 
     49  1.1  christos - print a "C" CPU column. If this changes from one line to the next then
     50  1.1  christos   the output is probably shuffled around that point. This is why the "C"
     51  1.1  christos   column appears in these flow scripts.
     52  1.1  christos - print a "TIME(us)" column. You can eyeball this for shuffles, or just
     53  1.1  christos   post sort the dtrace output.
     54  1.1  christos 
     55  1.1  christos Now have a closer look at the pl_flow.d output above. The change in C 
     56  1.1  christos indicates that a shuffle may have happened, and the out-of-order TIME(us)
     57  1.1  christos shows that it did happen.
     58  1.1  christos 
     59  1.1  christos It is possible that DTrace will be enhanced to always sort output before
     60  1.1  christos printing, and this behaviour is no longer an issue.
     61  1.1  christos 
     62  1.1  christos See "The output seems shuffled?" in Notes/ALLsnoop_notes.txt for more
     63  1.1  christos notes on this behaviour.
     64  1.1  christos 
     65