1 **************************************************************************
2 * Notes for all scripts that print inclusive function times (or method,
5 * $Id: ALLinclusive_notes.txt 45 2007-09-17 08:54:56Z brendan $
7 * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
8 **************************************************************************
11 * What is "inclusive" function time?
13 This is the time of function execution, from when the function begins to
14 when it completes. This includes the times from all child functions called.
16 Inclusive function time is calculated in a very simple way,
18 inclusive function time = time(function end) - time(function start)
20 Consider this Bourne shell program,
46 func_a() calls func_b() which calls func_c(). Tracing the flow using
49 # ./sh_flowtime.d | cat -n
50 1 C TIME(us) FILE DELTA(us) -- NAME
51 2 0 3052991099265 func_abc.sh 2 -> func_a
52 3 0 3052991099324 func_abc.sh 59 > echo
53 4 0 3052992111638 func_abc.sh 1012314 | sleep
54 5 0 3052992111678 func_abc.sh 39 -> func_b
55 6 0 3052992111729 func_abc.sh 51 > echo
56 7 0 3052993121633 func_abc.sh 1009903 | sleep
57 8 0 3052993121693 func_abc.sh 60 -> func_c
58 9 0 3052993121745 func_abc.sh 52 > echo
59 10 0 3052994131634 func_abc.sh 1009888 | sleep
60 11 0 3052994131685 func_abc.sh 50 <- func_c
61 12 0 3052994131699 func_abc.sh 14 <- func_b
62 13 0 3052994131707 func_abc.sh 7 <- func_a
64 the output of DTrace was piped through "cat -n" to enumerate the lines.
66 Inclusive function time for func_a() in the above output would be the
67 time from line 2 to line 13. This inclusive time includes the time
68 for both func_b() and func_c().
70 Looking back at the code, inclusive time for func_a() is the time spent
71 in code lines 18, 19 and 20.
73 See Notes/ALLexclusive_notes.txt for details on "exclusive" function time.