aboutsummaryrefslogtreecommitdiff
path: root/Examples/rb_calldist_example.txt
blob: 088497c562865d0264d255c776511e49e1cefcd0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
The following is an example of running rb_calldist.d and tracing the elapsed
times for functions.

We run rb_calldist.d while running the program Code/Ruby/func_abc.rb.  We can
see that there are three sections in the DTrace output

# rb_calldist.d
Tracing... Hit Ctrl-C to end.
^C

Elapsed times (us),
   ., obj-new, NoMemoryError 
           value  ------------- Distribution ------------- count    
               1 |                                         0        
               2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
               4 |                                         0        

   ., obj-new, SystemStackError 
           value  ------------- Distribution ------------- count    
               1 |                                         0        
               2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
               4 |                                         0        

   ., obj-new, ThreadGroup 
           value  ------------- Distribution ------------- count    
               4 |                                         0        
               8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
              16 |                                         0        

   ., obj-new, fatal 
           value  ------------- Distribution ------------- count    
               4 |                                         0        
               8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
              16 |                                         0        

   ., obj-new, Object 
           value  ------------- Distribution ------------- count    
               1 |                                         0        
               2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@              2        
               4 |                                         0        
               8 |                                         0        
              16 |@@@@@@@@@@@@@                            1        
              32 |                                         0        


Exclusive function elapsed times (us),
   func_abc.rb, func, Module::method_added 
           value  ------------- Distribution ------------- count    
               1 |                                         0        
               2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@              2        
               4 |@@@@@@@@@@@@@                            1        
               8 |                                         0        

   func_abc.rb, func, Object::print 
           value  ------------- Distribution ------------- count    
               8 |                                         0        
              16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@              2        
              32 |@@@@@@@@@@@@@                            1        
              64 |                                         0        

   func_abc.rb, func, IO::write 
           value  ------------- Distribution ------------- count    
              16 |                                         0        
              32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@              2        
              64 |@@@@@@@@@@@@@                            1        
             128 |                                         0        

   func_abc.rb, func, Object::func_a 
           value  ------------- Distribution ------------- count    
             128 |                                         0        
             256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
             512 |                                         0        

   func_abc.rb, func, Object::func_b 
           value  ------------- Distribution ------------- count    
             128 |                                         0        
             256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
             512 |                                         0        

   func_abc.rb, func, Object::func_c 
           value  ------------- Distribution ------------- count    
             128 |                                         0        
             256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
             512 |                                         0        

   func_abc.rb, func, Object::sleep 
           value  ------------- Distribution ------------- count    
          262144 |                                         0        
          524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3        
         1048576 |                                         0        


Inclusive function elapsed times (us),
   func_abc.rb, func, Module::method_added 
           value  ------------- Distribution ------------- count    
               1 |                                         0        
               2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@              2        
               4 |@@@@@@@@@@@@@                            1        
               8 |                                         0        

   func_abc.rb, func, IO::write 
           value  ------------- Distribution ------------- count    
              16 |                                         0        
              32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@              2        
              64 |@@@@@@@@@@@@@                            1        
             128 |                                         0        

   func_abc.rb, func, Object::print 
           value  ------------- Distribution ------------- count    
              32 |                                         0        
              64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@              2        
             128 |@@@@@@@@@@@@@                            1        
             256 |                                         0        

   func_abc.rb, func, Object::func_c 
           value  ------------- Distribution ------------- count    
          262144 |                                         0        
          524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
         1048576 |                                         0        

   func_abc.rb, func, Object::func_b 
           value  ------------- Distribution ------------- count    
          524288 |                                         0        
         1048576 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
         2097152 |                                         0        

   func_abc.rb, func, Object::sleep 
           value  ------------- Distribution ------------- count    
          262144 |                                         0        
          524288 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3        
         1048576 |                                         0        

   func_abc.rb, func, Object::func_a 
           value  ------------- Distribution ------------- count    
         1048576 |                                         0        
         2097152 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
         4194304 |                                         0        

The elapsed times show us that the script spent some small amount of time
processing various events that were not functions.  In this case they were all
obj-new events, and you can see that the slowest of these was a new Object at
between 16 microseconds and 31 microseconds.

The exclusive subroutine elapsed times show that each of our user defined
functions took between 256 and 511 microseconds. This time excludes the time 
spent in other subroutines.

The inclusive subroutine elapsed times show that func_c() took between 0.5
seconds and 1 second, func_b() took between 1 second and 2.1 seconds, and
func_a() took between 2.1 seconds and 4.2 seconds to execute. This time
includes the time spent in other subroutines called, and since func_a() called
func_b() which called func_c(), these times make sense.