ruby-prof 0.15.8 → 0.15.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +5 -0
- data/README.rdoc +187 -185
- data/doc/LICENSE.html +114 -0
- data/doc/README_rdoc.html +544 -0
- data/doc/Rack.html +95 -0
- data/doc/Rack/RubyProf.html +223 -0
- data/doc/RubyProf.html +961 -0
- data/doc/RubyProf/AbstractPrinter.html +546 -0
- data/doc/RubyProf/AggregateCallInfo.html +551 -0
- data/doc/RubyProf/CallInfo.html +639 -0
- data/doc/RubyProf/CallInfoPrinter.html +120 -0
- data/doc/RubyProf/CallInfoVisitor.html +198 -0
- data/doc/RubyProf/CallStackPrinter.html +1121 -0
- data/doc/RubyProf/CallTreePrinter.html +359 -0
- data/doc/RubyProf/Cmd.html +631 -0
- data/doc/RubyProf/DotPrinter.html +257 -0
- data/doc/RubyProf/FlatPrinter.html +163 -0
- data/doc/RubyProf/FlatPrinterWithLineNumbers.html +208 -0
- data/doc/RubyProf/GraphHtmlPrinter.html +552 -0
- data/doc/RubyProf/GraphPrinter.html +139 -0
- data/doc/RubyProf/MethodInfo.html +745 -0
- data/doc/RubyProf/MultiPrinter.html +358 -0
- data/doc/RubyProf/Profile.html +713 -0
- data/doc/RubyProf/ProfileTask.html +490 -0
- data/doc/RubyProf/Thread.html +268 -0
- data/doc/created.rid +13 -13
- data/doc/examples/flat_txt.html +138 -0
- data/doc/examples/graph_html.html +909 -0
- data/doc/examples/graph_txt.html +247 -0
- data/doc/images/add.png +0 -0
- data/doc/images/arrow_up.png +0 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/delete.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_blue.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/transparent.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +571 -0
- data/doc/js/navigation.js.gz +0 -0
- data/doc/js/search_index.js +1 -1
- data/doc/js/search_index.js.gz +0 -0
- data/doc/js/searcher.js.gz +0 -0
- data/doc/table_of_contents.html +893 -0
- data/examples/flat.txt +50 -55
- data/examples/graph.html +823 -823
- data/examples/graph.txt +139 -170
- data/ext/ruby_prof/extconf.rb +6 -1
- data/lib/ruby-prof/aggregate_call_info.rb +17 -11
- data/lib/ruby-prof/call_info.rb +2 -17
- data/lib/ruby-prof/method_info.rb +6 -22
- data/lib/ruby-prof/printers/graph_html_printer.rb +0 -2
- data/lib/ruby-prof/printers/graph_printer.rb +4 -6
- data/lib/ruby-prof/rack.rb +7 -0
- data/lib/ruby-prof/thread.rb +0 -4
- data/lib/ruby-prof/version.rb +1 -1
- data/ruby-prof.gemspec +1 -1
- data/test/basic_test.rb +26 -26
- data/test/issue137_test.rb +63 -0
- data/test/measure_allocations_test.rb +4 -3
- data/test/measure_cpu_time_test.rb +6 -6
- data/test/measure_process_time_test.rb +8 -8
- data/test/pause_resume_test.rb +9 -9
- data/test/printers_test.rb +1 -1
- data/test/printing_recursive_graph_test.rb +127 -0
- data/test/rack_test.rb +49 -1
- data/test/recursive_test.rb +41 -37
- data/test/test_helper.rb +93 -0
- metadata +59 -5
data/examples/graph.txt
CHANGED
@@ -1,170 +1,139 @@
|
|
1
|
-
= Graph Profiles
|
2
|
-
|
3
|
-
Graph profiles show how long each method runs, which methods call it
|
4
|
-
|
5
|
-
|
6
|
-
As an example, here is the output from running printers_test.rb:
|
7
|
-
|
8
|
-
|
9
|
-
Thread ID:
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
100.00% 0.
|
17
|
-
0.
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
0.
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
0.
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
0.
|
60
|
-
|
61
|
-
|
62
|
-
0.
|
63
|
-
|
64
|
-
0.
|
65
|
-
|
66
|
-
0.
|
67
|
-
|
68
|
-
|
69
|
-
0.
|
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
|
-
For parent lines, the columns represent:
|
141
|
-
|
142
|
-
total - The time spent in the current method and it children on behalf of the parent method.
|
143
|
-
self - The time spent in this method on behalf of the parent method.
|
144
|
-
children - The time spent in this method's children on behalf of the parent.
|
145
|
-
calls - The number of times the parent method called this child
|
146
|
-
|
147
|
-
Looking at Integer#upto again, we see that it was called 500 times from Object#is_prime
|
148
|
-
and 1 time from find_largest. Of the 8.72 total seconds spent in Integer#upto, 6.63
|
149
|
-
were done for Object#is_prime and 2.09 for Object#find_largest.
|
150
|
-
|
151
|
-
|
152
|
-
== Children
|
153
|
-
In each entry, the lines below the primary line are the methods that
|
154
|
-
the current method called. If the current method is a leaf method then
|
155
|
-
no children are shown.
|
156
|
-
|
157
|
-
For children lines, the columns represent:
|
158
|
-
|
159
|
-
total - The time spent in the child, and its children, on behalf of the current method
|
160
|
-
self - The time spent in the child on behalf of the current method.
|
161
|
-
children - The time spent in the child's children (ie, granchildren) in behalf of the current method
|
162
|
-
calls - The number of times the child method was called by the current method.
|
163
|
-
|
164
|
-
Taking our example of Integer#upto, we see that it called five other methods - Array#[],
|
165
|
-
Fixnum#>, Kernel.sleep, Fixnum#= and Fixnum#%. Looking at Kernel.sleep, we see that
|
166
|
-
its spent 2.09 seconds working for Integer#upto and its children spent 0 time working for
|
167
|
-
Integer#upto. To see the overall time Kernel.sleep took we would have to look up its entry
|
168
|
-
in the graph table.
|
169
|
-
|
170
|
-
|
1
|
+
= Graph Profiles
|
2
|
+
|
3
|
+
Graph profiles show how long each method runs, which methods call it and which
|
4
|
+
methods it calls.
|
5
|
+
|
6
|
+
As an example, here is the output from running printers_test.rb:
|
7
|
+
|
8
|
+
Measure Mode: wall_time
|
9
|
+
Thread ID: 70310439543100
|
10
|
+
Fiber ID: 70310456289620
|
11
|
+
Total Time: 0.05264616012573242
|
12
|
+
Sort by: total_time
|
13
|
+
|
14
|
+
%total %self total self wait child calls name
|
15
|
+
--------------------------------------------------------------------------------
|
16
|
+
100.00% 0.01% 0.053 0.000 0.000 0.053 1 PrintersTest#setup
|
17
|
+
0.053 0.000 0.000 0.053 1/1 Object#run_primes
|
18
|
+
--------------------------------------------------------------------------------
|
19
|
+
0.053 0.000 0.000 0.053 1/1 PrintersTest#setup
|
20
|
+
99.99% 0.01% 0.053 0.000 0.000 0.053 1 Object#run_primes
|
21
|
+
0.052 0.000 0.000 0.052 1/1 Object#find_primes
|
22
|
+
0.001 0.000 0.000 0.001 1/1 Object#make_random_array
|
23
|
+
0.000 0.000 0.000 0.000 1/1 Object#find_largest
|
24
|
+
--------------------------------------------------------------------------------
|
25
|
+
0.052 0.000 0.000 0.052 1/1 Object#run_primes
|
26
|
+
98.35% 0.00% 0.052 0.000 0.000 0.052 1 Object#find_primes
|
27
|
+
0.052 0.000 0.000 0.051 1/1 Array#select
|
28
|
+
--------------------------------------------------------------------------------
|
29
|
+
0.052 0.000 0.000 0.051 1/1 Object#find_primes
|
30
|
+
98.34% 0.61% 0.052 0.000 0.000 0.051 1 Array#select
|
31
|
+
0.051 0.000 0.000 0.051 1000/1000 Object#is_prime
|
32
|
+
--------------------------------------------------------------------------------
|
33
|
+
0.051 0.000 0.000 0.051 1000/1000 Array#select
|
34
|
+
97.74% 0.93% 0.051 0.000 0.000 0.051 1000 Object#is_prime
|
35
|
+
0.051 0.051 0.000 0.000 1000/1001 Integer#upto
|
36
|
+
--------------------------------------------------------------------------------
|
37
|
+
0.000 0.000 0.000 0.000 1/1001 Object#find_largest
|
38
|
+
0.051 0.051 0.000 0.000 1000/1001 Object#is_prime
|
39
|
+
96.91% 96.91% 0.051 0.051 0.000 0.000 1001 Integer#upto
|
40
|
+
--------------------------------------------------------------------------------
|
41
|
+
0.001 0.000 0.000 0.001 1/1 Object#run_primes
|
42
|
+
1.51% 0.00% 0.001 0.000 0.000 0.001 1 Object#make_random_array
|
43
|
+
0.001 0.000 0.000 0.000 1/1 Array#each_index
|
44
|
+
0.000 0.000 0.000 0.000 1/1 Class#new
|
45
|
+
--------------------------------------------------------------------------------
|
46
|
+
0.001 0.000 0.000 0.000 1/1 Object#make_random_array
|
47
|
+
1.50% 0.56% 0.001 0.000 0.000 0.000 1 Array#each_index
|
48
|
+
0.000 0.000 0.000 0.000 1000/1000 Kernel#rand
|
49
|
+
--------------------------------------------------------------------------------
|
50
|
+
0.000 0.000 0.000 0.000 1000/1000 Array#each_index
|
51
|
+
0.94% 0.72% 0.000 0.000 0.000 0.000 1000 Kernel#rand
|
52
|
+
0.000 0.000 0.000 0.000 1000/1000 Kernel#respond_to_missing?
|
53
|
+
--------------------------------------------------------------------------------
|
54
|
+
0.000 0.000 0.000 0.000 1000/1000 Kernel#rand
|
55
|
+
0.22% 0.22% 0.000 0.000 0.000 0.000 1000 Kernel#respond_to_missing?
|
56
|
+
--------------------------------------------------------------------------------
|
57
|
+
0.000 0.000 0.000 0.000 1/1 Object#run_primes
|
58
|
+
0.12% 0.02% 0.000 0.000 0.000 0.000 1 Object#find_largest
|
59
|
+
0.000 0.000 0.000 0.000 1/1001 Integer#upto
|
60
|
+
0.000 0.000 0.000 0.000 1/1 Array#first
|
61
|
+
--------------------------------------------------------------------------------
|
62
|
+
0.000 0.000 0.000 0.000 1/1 Object#make_random_array
|
63
|
+
0.01% 0.00% 0.000 0.000 0.000 0.000 1 Class#new
|
64
|
+
0.000 0.000 0.000 0.000 1/1 Array#initialize
|
65
|
+
--------------------------------------------------------------------------------
|
66
|
+
0.000 0.000 0.000 0.000 1/1 Class#new
|
67
|
+
0.01% 0.01% 0.000 0.000 0.000 0.000 1 Array#initialize
|
68
|
+
--------------------------------------------------------------------------------
|
69
|
+
0.000 0.000 0.000 0.000 1/1 Object#find_largest
|
70
|
+
0.00% 0.00% 0.000 0.000 0.000 0.000 1 Array#first
|
71
|
+
|
72
|
+
|
73
|
+
== Overview
|
74
|
+
|
75
|
+
Dashed lines divide the report into entries, with one entry per method. Entries
|
76
|
+
are sorted by total time which is the time spent in the method plus its
|
77
|
+
children.
|
78
|
+
|
79
|
+
Each entry has a primary line demarked by values in the %total and %self
|
80
|
+
columns. The primary line represents the method being profiled. Lines above it
|
81
|
+
are the methods that called this method (parents) while the lines below it are
|
82
|
+
the methods it called (children).
|
83
|
+
|
84
|
+
All values are in seconds. For the primary line, the columns represent:
|
85
|
+
|
86
|
+
%total - The percentage of time spent in this method and its children
|
87
|
+
%self - The percentage of time spent in this method
|
88
|
+
total - The time spent in this method and its children.
|
89
|
+
self - The time spent in this method.
|
90
|
+
wait - The time spent waiting for other threads in this method.
|
91
|
+
child - The time spent in this method's children.
|
92
|
+
calls - The number of times this method was called.
|
93
|
+
name - The name of the method.
|
94
|
+
|
95
|
+
The interpretation of method names is:
|
96
|
+
MyObject#test - An instance method "test" of the class "MyObject"
|
97
|
+
<Object:MyObject>#test - The <> characters indicate a singleton method on a singleton class.
|
98
|
+
|
99
|
+
For example, we see that 97.74% of the time was spent in Object#is_prime and its
|
100
|
+
children. Of that time, almost everything was contributed by Integer#upto.
|
101
|
+
Overall, Object#is_prime was called 1001 times and 1000 of those calls were made
|
102
|
+
by Object#is_prime.
|
103
|
+
|
104
|
+
|
105
|
+
== Parents
|
106
|
+
|
107
|
+
In each entry, the lines above the primary line are the methods that called the
|
108
|
+
current method. If the current method is a root method then no parents are
|
109
|
+
shown.
|
110
|
+
|
111
|
+
For parent lines, the columns represent:
|
112
|
+
|
113
|
+
total - The time spent in the current method and its children on behalf of the parent method.
|
114
|
+
self - The time spent in this method on behalf of the parent method.
|
115
|
+
child - The time spent in this method's children on behalf of the parent.
|
116
|
+
wait - The time spent waiting for other threads in this method's children on behalf of the parent.
|
117
|
+
calls - The number of times the parent method called the current method vs. the total number of calls of the current method.
|
118
|
+
|
119
|
+
Looking at the main entry for Integer#upto, we see that it was called 1000 times
|
120
|
+
from Object#is_prime and 1 time from find_largest.
|
121
|
+
|
122
|
+
|
123
|
+
== Children
|
124
|
+
|
125
|
+
In each entry, the lines below the primary line are the methods that
|
126
|
+
the current method called. If the current method is a leaf method then
|
127
|
+
no children are shown.
|
128
|
+
|
129
|
+
For children lines, the columns represent:
|
130
|
+
|
131
|
+
total - The time spent in the child, and its descendants, on behalf of the current method
|
132
|
+
self - The time spent in the child on behalf of the current method.
|
133
|
+
wait - The time spent waiting for other threads in the child's and its descendants on behalf of the current method.
|
134
|
+
child - The time spent in the child's descendants on behalf of the current method.
|
135
|
+
calls - The number of times the child method was called by the current method vs. the total number of calls of the child method.
|
136
|
+
|
137
|
+
If we look at the main entry for Objext#run_primes, we see that it called three
|
138
|
+
other methods - Object#find_primes, Object#make_random_array and
|
139
|
+
Object#find_largest.
|
data/ext/ruby_prof/extconf.rb
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
require "mkmf"
|
2
2
|
|
3
|
+
if RUBY_ENGINE != "ruby"
|
4
|
+
STDERR.puts("\n\n***** This gem is MRI-specific. It does not support #{RUBY_ENGINE}. *****\n\n")
|
5
|
+
exit(1)
|
6
|
+
end
|
7
|
+
|
3
8
|
if RUBY_VERSION < "1.9.3"
|
4
|
-
STDERR.puts("Ruby version #{RUBY_VERSION} is no longer supported. Please upgrade to 1.9.3 or higher")
|
9
|
+
STDERR.puts("\n\n***** Ruby version #{RUBY_VERSION} is no longer supported. Please upgrade to 1.9.3 or higher. *****\n\n")
|
5
10
|
exit(1)
|
6
11
|
end
|
7
12
|
|
@@ -2,13 +2,14 @@
|
|
2
2
|
|
3
3
|
module RubyProf
|
4
4
|
class AggregateCallInfo
|
5
|
-
attr_reader :call_infos
|
5
|
+
attr_reader :call_infos, :method_info
|
6
6
|
|
7
|
-
def initialize(call_infos)
|
7
|
+
def initialize(call_infos, method_info)
|
8
8
|
if call_infos.length == 0
|
9
9
|
raise(ArgumentError, "Must specify at least one call info.")
|
10
10
|
end
|
11
11
|
@call_infos = call_infos
|
12
|
+
@method_info = method_info
|
12
13
|
end
|
13
14
|
|
14
15
|
def target
|
@@ -30,23 +31,23 @@ module RubyProf
|
|
30
31
|
end
|
31
32
|
|
32
33
|
def total_time
|
33
|
-
|
34
|
+
aggregate_roots(:total_time)
|
34
35
|
end
|
35
36
|
|
36
37
|
def self_time
|
37
|
-
|
38
|
+
aggregate_roots(:self_time)
|
38
39
|
end
|
39
40
|
|
40
41
|
def wait_time
|
41
|
-
|
42
|
+
aggregate_roots(:wait_time)
|
42
43
|
end
|
43
44
|
|
44
45
|
def children_time
|
45
|
-
|
46
|
+
aggregate_roots(:children_time)
|
46
47
|
end
|
47
48
|
|
48
49
|
def called
|
49
|
-
|
50
|
+
aggregate_all(:called)
|
50
51
|
end
|
51
52
|
|
52
53
|
def to_s
|
@@ -55,15 +56,20 @@ module RubyProf
|
|
55
56
|
|
56
57
|
private
|
57
58
|
|
58
|
-
|
59
|
+
# return all call_infos which are not (grand) children of any other node in the list of given call_infos
|
60
|
+
def roots
|
61
|
+
@roots ||= method_info.recursive? ? CallInfo.roots_of(call_infos) : call_infos
|
62
|
+
end
|
63
|
+
|
64
|
+
def aggregate_all(method_name)
|
59
65
|
call_infos.inject(0) do |sum, call_info|
|
60
66
|
sum + call_info.send(method_name)
|
61
67
|
end
|
62
68
|
end
|
63
69
|
|
64
|
-
def
|
65
|
-
|
66
|
-
|
70
|
+
def aggregate_roots(method_name)
|
71
|
+
roots.inject(0) do |sum, call_info|
|
72
|
+
sum + call_info.send(method_name)
|
67
73
|
end
|
68
74
|
end
|
69
75
|
end
|
data/lib/ruby-prof/call_info.rb
CHANGED
@@ -11,28 +11,13 @@ module RubyProf
|
|
11
11
|
|
12
12
|
attr_reader :recursive
|
13
13
|
|
14
|
-
def non_recursive?
|
15
|
-
@non_recursive
|
16
|
-
end
|
17
|
-
|
18
14
|
def detect_recursion(visited_methods = Hash.new(0))
|
19
|
-
@recursive = (visited_methods[target] += 1) > 1
|
20
|
-
@non_recursive = true
|
21
|
-
children.each do |child|
|
22
|
-
@non_recursive = false if child.detect_recursion(visited_methods)
|
23
|
-
end
|
24
|
-
visited_methods.delete(target) if (visited_methods[target] -= 1) == 0
|
25
|
-
return !@non_recursive
|
26
|
-
end
|
27
|
-
|
28
|
-
def recalc_recursion(visited_methods = Hash.new(0))
|
29
|
-
return if @non_recursive
|
30
|
-
target.clear_cached_values_which_depend_on_recursiveness
|
31
15
|
@recursive = (visited_methods[target] += 1) > 1
|
32
16
|
children.each do |child|
|
33
|
-
child.
|
17
|
+
child.detect_recursion(visited_methods)
|
34
18
|
end
|
35
19
|
visited_methods.delete(target) if (visited_methods[target] -= 1) == 0
|
20
|
+
return @recursive
|
36
21
|
end
|
37
22
|
|
38
23
|
def children_time
|
@@ -22,18 +22,10 @@ module RubyProf
|
|
22
22
|
call_infos.each(&:detect_recursion)
|
23
23
|
end
|
24
24
|
|
25
|
-
def recalc_recursion
|
26
|
-
call_infos.each(&:recalc_recursion)
|
27
|
-
end
|
28
|
-
|
29
|
-
def clear_cached_values_which_depend_on_recursiveness
|
30
|
-
@total_time = @self_time = @wait_time = @children_time = nil
|
31
|
-
end
|
32
|
-
|
33
25
|
def called
|
34
26
|
@called ||= begin
|
35
27
|
call_infos.inject(0) do |sum, call_info|
|
36
|
-
sum
|
28
|
+
sum + call_info.called
|
37
29
|
end
|
38
30
|
end
|
39
31
|
end
|
@@ -87,15 +79,7 @@ module RubyProf
|
|
87
79
|
end
|
88
80
|
|
89
81
|
def recursive?
|
90
|
-
call_infos.detect(&:recursive)
|
91
|
-
end
|
92
|
-
|
93
|
-
def non_recursive?
|
94
|
-
non_recursive == 1
|
95
|
-
end
|
96
|
-
|
97
|
-
def non_recursive
|
98
|
-
@non_recursive ||= call_infos.all?(&:non_recursive?) ? 1 : 0
|
82
|
+
(@recursive ||= call_infos.detect(&:recursive) ? :true : :false) == :true
|
99
83
|
end
|
100
84
|
|
101
85
|
def children
|
@@ -107,26 +91,26 @@ module RubyProf
|
|
107
91
|
end
|
108
92
|
|
109
93
|
def aggregate_parents
|
110
|
-
#
|
94
|
+
# group call infos based on their parents
|
111
95
|
groups = self.call_infos.each_with_object({}) do |call_info, hash|
|
112
96
|
key = call_info.parent ? call_info.parent.target : self
|
113
97
|
(hash[key] ||= []) << call_info
|
114
98
|
end
|
115
99
|
|
116
100
|
groups.map do |key, value|
|
117
|
-
AggregateCallInfo.new(value)
|
101
|
+
AggregateCallInfo.new(value, self)
|
118
102
|
end
|
119
103
|
end
|
120
104
|
|
121
105
|
def aggregate_children
|
122
|
-
#
|
106
|
+
# group call infos based on their targets
|
123
107
|
groups = self.children.each_with_object({}) do |call_info, hash|
|
124
108
|
key = call_info.target
|
125
109
|
(hash[key] ||= []) << call_info
|
126
110
|
end
|
127
111
|
|
128
112
|
groups.map do |key, value|
|
129
|
-
AggregateCallInfo.new(value)
|
113
|
+
AggregateCallInfo.new(value, self)
|
130
114
|
end
|
131
115
|
end
|
132
116
|
|