ruby-prof 0.18.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +44 -1
- data/LICENSE +2 -2
- data/README.rdoc +1 -483
- data/Rakefile +3 -6
- data/bin/ruby-prof +111 -128
- data/ext/ruby_prof/extconf.rb +6 -38
- data/ext/ruby_prof/rp_aggregate_call_tree.c +41 -0
- data/ext/ruby_prof/rp_aggregate_call_tree.h +13 -0
- data/ext/ruby_prof/rp_allocation.c +259 -0
- data/ext/ruby_prof/rp_allocation.h +31 -0
- data/ext/ruby_prof/rp_call_tree.c +353 -0
- data/ext/ruby_prof/rp_call_tree.h +43 -0
- data/ext/ruby_prof/rp_call_trees.c +266 -0
- data/ext/ruby_prof/rp_call_trees.h +29 -0
- data/ext/ruby_prof/rp_measure_allocations.c +25 -51
- data/ext/ruby_prof/rp_measure_memory.c +21 -56
- data/ext/ruby_prof/rp_measure_process_time.c +37 -43
- data/ext/ruby_prof/rp_measure_wall_time.c +40 -21
- data/ext/ruby_prof/rp_measurement.c +221 -0
- data/ext/ruby_prof/rp_measurement.h +50 -0
- data/ext/ruby_prof/rp_method.c +279 -439
- data/ext/ruby_prof/rp_method.h +33 -45
- data/ext/ruby_prof/rp_profile.c +902 -0
- data/ext/ruby_prof/rp_profile.h +36 -0
- data/ext/ruby_prof/rp_stack.c +163 -132
- data/ext/ruby_prof/rp_stack.h +18 -28
- data/ext/ruby_prof/rp_thread.c +192 -124
- data/ext/ruby_prof/rp_thread.h +18 -8
- data/ext/ruby_prof/ruby_prof.c +36 -778
- data/ext/ruby_prof/ruby_prof.h +11 -45
- data/ext/ruby_prof/vc/ruby_prof.vcxproj +18 -12
- data/lib/ruby-prof.rb +4 -21
- data/lib/ruby-prof/assets/call_stack_printer.html.erb +710 -0
- data/lib/ruby-prof/assets/call_stack_printer.png +0 -0
- data/lib/ruby-prof/assets/graph_printer.html.erb +355 -0
- data/lib/ruby-prof/call_tree.rb +57 -0
- data/lib/ruby-prof/call_tree_visitor.rb +36 -0
- data/lib/ruby-prof/compatibility.rb +37 -107
- data/lib/ruby-prof/exclude_common_methods.rb +198 -0
- data/lib/ruby-prof/measurement.rb +17 -0
- data/lib/ruby-prof/method_info.rb +47 -90
- data/lib/ruby-prof/printers/abstract_printer.rb +73 -50
- data/lib/ruby-prof/printers/call_info_printer.rb +24 -12
- data/lib/ruby-prof/printers/call_stack_printer.rb +66 -152
- data/lib/ruby-prof/printers/call_tree_printer.rb +20 -12
- data/lib/ruby-prof/printers/dot_printer.rb +5 -5
- data/lib/ruby-prof/printers/flat_printer.rb +6 -24
- data/lib/ruby-prof/printers/graph_html_printer.rb +6 -192
- data/lib/ruby-prof/printers/graph_printer.rb +11 -14
- data/lib/ruby-prof/printers/multi_printer.rb +66 -23
- data/lib/ruby-prof/profile.rb +10 -3
- data/lib/ruby-prof/thread.rb +5 -20
- data/lib/ruby-prof/version.rb +1 -1
- data/ruby-prof.gemspec +9 -2
- data/test/abstract_printer_test.rb +0 -27
- data/test/alias_test.rb +126 -0
- data/test/basic_test.rb +1 -86
- data/test/call_tree_visitor_test.rb +32 -0
- data/test/call_trees_test.rb +66 -0
- data/test/dynamic_method_test.rb +0 -2
- data/test/exclude_methods_test.rb +17 -12
- data/test/fiber_test.rb +214 -23
- data/test/gc_test.rb +105 -0
- data/test/inverse_call_tree_test.rb +175 -0
- data/test/line_number_test.rb +118 -40
- data/test/marshal_test.rb +115 -0
- data/test/measure_allocations.rb +30 -0
- data/test/measure_allocations_test.rb +361 -12
- data/test/measure_allocations_trace_test.rb +375 -0
- data/test/measure_memory_trace_test.rb +1101 -0
- data/test/measure_process_time_test.rb +757 -33
- data/test/measure_times.rb +56 -0
- data/test/measure_wall_time_test.rb +329 -149
- data/test/multi_printer_test.rb +1 -34
- data/test/pause_resume_test.rb +24 -15
- data/test/prime.rb +1 -1
- data/test/prime_script.rb +6 -0
- data/test/printer_call_stack_test.rb +28 -0
- data/test/printer_call_tree_test.rb +31 -0
- data/test/printer_flat_test.rb +68 -0
- data/test/printer_graph_html_test.rb +60 -0
- data/test/printer_graph_test.rb +41 -0
- data/test/printers_test.rb +32 -166
- data/test/printing_recursive_graph_test.rb +26 -72
- data/test/recursive_test.rb +68 -77
- data/test/stack_printer_test.rb +2 -15
- data/test/start_stop_test.rb +22 -25
- data/test/test_helper.rb +6 -261
- data/test/thread_test.rb +11 -54
- data/test/unique_call_path_test.rb +25 -107
- data/test/yarv_test.rb +1 -0
- metadata +43 -41
- data/examples/flat.txt +0 -50
- data/examples/graph.dot +0 -84
- data/examples/graph.html +0 -823
- data/examples/graph.txt +0 -139
- data/examples/multi.flat.txt +0 -23
- data/examples/multi.graph.html +0 -760
- data/examples/multi.grind.dat +0 -114
- data/examples/multi.stack.html +0 -547
- data/examples/stack.html +0 -547
- data/ext/ruby_prof/rp_call_info.c +0 -425
- data/ext/ruby_prof/rp_call_info.h +0 -53
- data/ext/ruby_prof/rp_measure.c +0 -40
- data/ext/ruby_prof/rp_measure.h +0 -45
- data/ext/ruby_prof/rp_measure_cpu_time.c +0 -136
- data/ext/ruby_prof/rp_measure_gc_runs.c +0 -73
- data/ext/ruby_prof/rp_measure_gc_time.c +0 -60
- data/lib/ruby-prof/aggregate_call_info.rb +0 -76
- data/lib/ruby-prof/assets/call_stack_printer.css.html +0 -117
- data/lib/ruby-prof/assets/call_stack_printer.js.html +0 -385
- data/lib/ruby-prof/call_info.rb +0 -115
- data/lib/ruby-prof/call_info_visitor.rb +0 -40
- data/lib/ruby-prof/printers/flat_printer_with_line_numbers.rb +0 -83
- data/lib/ruby-prof/profile/exclude_common_methods.rb +0 -207
- data/lib/ruby-prof/profile/legacy_method_elimination.rb +0 -50
- data/test/aggregate_test.rb +0 -136
- data/test/block_test.rb +0 -74
- data/test/call_info_test.rb +0 -78
- data/test/call_info_visitor_test.rb +0 -31
- data/test/issue137_test.rb +0 -63
- data/test/measure_cpu_time_test.rb +0 -212
- data/test/measure_gc_runs_test.rb +0 -32
- data/test/measure_gc_time_test.rb +0 -36
- data/test/measure_memory_test.rb +0 -33
- data/test/method_elimination_test.rb +0 -84
- data/test/module_test.rb +0 -45
- data/test/stack_test.rb +0 -138
@@ -0,0 +1,115 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
3
|
+
|
4
|
+
require File.expand_path("../test_helper", __FILE__)
|
5
|
+
require 'stringio'
|
6
|
+
|
7
|
+
class MarshalTest < TestCase
|
8
|
+
def verify_profile(profile_1, profile_2)
|
9
|
+
verify_threads(profile_1.threads, profile_2.threads)
|
10
|
+
end
|
11
|
+
|
12
|
+
def verify_threads(threads_1, threads_2)
|
13
|
+
assert_equal(threads_1.count, threads_2.count)
|
14
|
+
threads_1.count.times do |i|
|
15
|
+
thread_1 = threads_1[i]
|
16
|
+
thread_2 = threads_2[i]
|
17
|
+
assert_nil(thread_2.id)
|
18
|
+
assert_equal(thread_1.fiber_id, thread_2.fiber_id)
|
19
|
+
verify_call_info(thread_1.call_tree, thread_2.call_tree)
|
20
|
+
|
21
|
+
verify_methods(thread_1.methods, thread_2.methods)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def verify_methods(methods_1, methods_2)
|
26
|
+
assert_equal(methods_1.count, methods_2.count)
|
27
|
+
|
28
|
+
methods_1.count.times do |i|
|
29
|
+
method_1 = methods_1[i]
|
30
|
+
method_2 = methods_2[i]
|
31
|
+
|
32
|
+
assert_equal(method_1.klass_name, method_2.klass_name)
|
33
|
+
assert_equal(method_1.klass_flags, method_2.klass_flags)
|
34
|
+
|
35
|
+
assert_equal(method_1.method_name, method_2.method_name)
|
36
|
+
assert_equal(method_1.full_name, method_2.full_name)
|
37
|
+
|
38
|
+
assert_equal(method_1.recursive?, method_2.recursive?)
|
39
|
+
|
40
|
+
assert_equal(method_1.source_file, method_2.source_file)
|
41
|
+
assert_equal(method_1.line, method_2.line)
|
42
|
+
|
43
|
+
verify_measurement(method_1.measurement, method_2.measurement)
|
44
|
+
verify_call_infos(method_1.call_trees, method_2.call_trees)
|
45
|
+
verify_allocations(method_1.allocations, method_2.allocations)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def verify_allocations(allocations_1, allocations_2)
|
50
|
+
assert_equal(allocations_1.count, allocations_2.count)
|
51
|
+
|
52
|
+
allocations_1.count.times do |i|
|
53
|
+
allocation_1 = allocations_1[i]
|
54
|
+
allocation_2 = allocations_2[i]
|
55
|
+
|
56
|
+
assert_equal(allocation_1.klass_name, allocation_2.klass_name)
|
57
|
+
assert_equal(allocation_1.klass_flags, allocation_2.klass_flags)
|
58
|
+
|
59
|
+
assert_equal(allocation_1.count, allocation_2.count)
|
60
|
+
assert_equal(allocation_1.memory, allocation_2.memory)
|
61
|
+
|
62
|
+
assert_equal(allocation_1.source_file, allocation_2.source_file)
|
63
|
+
assert_equal(allocation_1.line, allocation_2.line)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def verify_call_infos(call_infos_1, call_infos_2)
|
68
|
+
assert_equal(call_infos_1.call_trees.count, call_infos_2.call_trees.count)
|
69
|
+
call_infos_1.call_trees.count.times do |i|
|
70
|
+
call_info_1 = call_infos_1.call_trees[i]
|
71
|
+
call_info_2 = call_infos_2.call_trees[i]
|
72
|
+
verify_call_info(call_info_1, call_info_2)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def verify_call_info(call_info_1, call_info_2)
|
77
|
+
assert_equal(call_info_1.target, call_info_2.target)
|
78
|
+
assert_equal(call_info_1.parent&.target, call_info_2.parent&.target)
|
79
|
+
|
80
|
+
assert_equal(call_info_1.depth, call_info_2.depth)
|
81
|
+
assert_equal(call_info_1.source_file, call_info_2.source_file)
|
82
|
+
assert_equal(call_info_1.line, call_info_2.line)
|
83
|
+
|
84
|
+
verify_measurement(call_info_1.measurement, call_info_2.measurement)
|
85
|
+
end
|
86
|
+
|
87
|
+
def verify_measurement(measurement_1, measurement_2)
|
88
|
+
assert_equal(measurement_1.total_time, measurement_2.total_time)
|
89
|
+
assert_equal(measurement_1.self_time, measurement_2.self_time)
|
90
|
+
assert_equal(measurement_1.wait_time, measurement_2.wait_time)
|
91
|
+
assert_equal(measurement_1.called, measurement_2.called)
|
92
|
+
end
|
93
|
+
|
94
|
+
def test_marshal
|
95
|
+
profile_1 = RubyProf.profile do
|
96
|
+
1.times { RubyProf::C1.new.sleep_wait }
|
97
|
+
end
|
98
|
+
|
99
|
+
data = Marshal.dump(profile_1)
|
100
|
+
profile_2 = Marshal.load(data)
|
101
|
+
|
102
|
+
verify_profile(profile_1, profile_2)
|
103
|
+
end
|
104
|
+
|
105
|
+
def test_singleton
|
106
|
+
profile_1 = RubyProf.profile do
|
107
|
+
SingletonTest.instance.busy_wait
|
108
|
+
end
|
109
|
+
|
110
|
+
data = Marshal.dump(profile_1)
|
111
|
+
profile_2 = Marshal.load(data)
|
112
|
+
|
113
|
+
verify_profile(profile_1, profile_2)
|
114
|
+
end
|
115
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# Some classes used in measurement tests
|
2
|
+
class Allocator
|
3
|
+
def make_arrays
|
4
|
+
10.times {|i| Array.new}
|
5
|
+
end
|
6
|
+
|
7
|
+
def make_hashes
|
8
|
+
Hash.new
|
9
|
+
Hash.new
|
10
|
+
Hash.new
|
11
|
+
Hash.new
|
12
|
+
Hash.new
|
13
|
+
end
|
14
|
+
|
15
|
+
def make_strings
|
16
|
+
a_string = 'a'
|
17
|
+
b_string = a_string * 100
|
18
|
+
String.new(b_string)
|
19
|
+
end
|
20
|
+
|
21
|
+
def internal_run
|
22
|
+
make_arrays
|
23
|
+
make_hashes
|
24
|
+
make_strings
|
25
|
+
end
|
26
|
+
|
27
|
+
def run
|
28
|
+
internal_run
|
29
|
+
end
|
30
|
+
end
|
@@ -2,25 +2,374 @@
|
|
2
2
|
# encoding: UTF-8
|
3
3
|
|
4
4
|
require File.expand_path('../test_helper', __FILE__)
|
5
|
+
require_relative './measure_allocations'
|
5
6
|
|
6
7
|
class MeasureAllocationsTest < TestCase
|
7
|
-
def
|
8
|
+
def setup
|
8
9
|
RubyProf::measure_mode = RubyProf::ALLOCATIONS
|
9
|
-
assert_equal(RubyProf::ALLOCATIONS, RubyProf::measure_mode)
|
10
10
|
end
|
11
11
|
|
12
|
-
def
|
13
|
-
|
12
|
+
def test_allocations_mode
|
13
|
+
RubyProf::measure_mode = RubyProf::ALLOCATIONS
|
14
|
+
assert_equal(RubyProf::ALLOCATIONS, RubyProf::measure_mode)
|
14
15
|
end
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
u = RubyProf.measure_allocations
|
21
|
-
assert_kind_of Integer, t
|
22
|
-
assert_kind_of Integer, u
|
23
|
-
assert_operator t, :<, u
|
17
|
+
def test_allocations
|
18
|
+
result = RubyProf.profile do
|
19
|
+
allocator = Allocator.new
|
20
|
+
allocator.run
|
24
21
|
end
|
22
|
+
|
23
|
+
thread = result.threads.first
|
24
|
+
assert_in_delta(20, thread.total_time, 1)
|
25
|
+
|
26
|
+
methods = result.threads.first.methods.sort.reverse
|
27
|
+
assert_equal(13, methods.length)
|
28
|
+
|
29
|
+
# Method 0
|
30
|
+
method = methods[0]
|
31
|
+
assert_equal('MeasureAllocationsTest#test_allocations', method.full_name)
|
32
|
+
assert_in_delta(20, method.total_time, 1)
|
33
|
+
assert_equal(0, method.wait_time)
|
34
|
+
assert_equal(0, method.self_time)
|
35
|
+
assert_in_delta(20, method.children_time, 1)
|
36
|
+
|
37
|
+
assert_equal(0, method.call_trees.callers.length)
|
38
|
+
|
39
|
+
assert_equal(2, method.call_trees.callees.length)
|
40
|
+
call_tree = method.call_trees.callees[0]
|
41
|
+
assert_equal('Class#new', call_tree.target.full_name)
|
42
|
+
assert_equal(1, call_tree.total_time)
|
43
|
+
assert_equal(0, call_tree.wait_time)
|
44
|
+
assert_equal(1, call_tree.self_time)
|
45
|
+
assert_equal(0, call_tree.children_time)
|
46
|
+
|
47
|
+
call_tree = method.call_trees.callees[1]
|
48
|
+
assert_equal('Allocator#run', call_tree.target.full_name)
|
49
|
+
assert_equal(19, call_tree.total_time)
|
50
|
+
assert_equal(0, call_tree.wait_time)
|
51
|
+
assert_equal(0, call_tree.self_time)
|
52
|
+
assert_equal(19, call_tree.children_time)
|
53
|
+
|
54
|
+
# Method 1
|
55
|
+
method = methods[1]
|
56
|
+
assert_equal('Allocator#run',method.full_name)
|
57
|
+
assert_equal(19, method.total_time)
|
58
|
+
assert_equal(0, method.wait_time)
|
59
|
+
assert_equal(0, method.self_time)
|
60
|
+
assert_equal(19, method.children_time)
|
61
|
+
|
62
|
+
assert_equal(1, method.call_trees.callers.length)
|
63
|
+
call_tree = method.call_trees.callers[0]
|
64
|
+
assert_equal('MeasureAllocationsTest#test_allocations', call_tree.parent.target.full_name)
|
65
|
+
assert_equal(19, call_tree.total_time)
|
66
|
+
assert_equal(0, call_tree.wait_time)
|
67
|
+
assert_equal(0, call_tree.self_time)
|
68
|
+
assert_equal(19, call_tree.children_time)
|
69
|
+
|
70
|
+
assert_equal(1, method.call_trees.callees.length)
|
71
|
+
call_tree = method.call_trees.callees[0]
|
72
|
+
assert_equal('Allocator#internal_run', call_tree.target.full_name)
|
73
|
+
assert_equal(19, call_tree.total_time)
|
74
|
+
assert_equal(0, call_tree.wait_time)
|
75
|
+
assert_equal(0, call_tree.self_time)
|
76
|
+
assert_equal(19, call_tree.children_time)
|
77
|
+
|
78
|
+
# Method 2
|
79
|
+
method = methods[2]
|
80
|
+
assert_equal('Allocator#internal_run', method.full_name)
|
81
|
+
assert_equal(19, method.total_time)
|
82
|
+
assert_equal(0, method.wait_time)
|
83
|
+
assert_equal(0, method.self_time)
|
84
|
+
assert_equal(19, method.children_time)
|
85
|
+
|
86
|
+
assert_equal(1, method.call_trees.callers.length)
|
87
|
+
call_tree = method.call_trees.callers[0]
|
88
|
+
assert_equal('Allocator#run', call_tree.parent.target.full_name)
|
89
|
+
assert_equal(19, call_tree.total_time)
|
90
|
+
assert_equal(0, call_tree.wait_time)
|
91
|
+
assert_equal(0, call_tree.self_time)
|
92
|
+
assert_equal(19, call_tree.children_time)
|
93
|
+
|
94
|
+
assert_equal(3, method.call_trees.callees.length)
|
95
|
+
call_tree = method.call_trees.callees[0]
|
96
|
+
assert_equal('Allocator#make_arrays', call_tree.target.full_name)
|
97
|
+
assert_equal(10, call_tree.total_time)
|
98
|
+
assert_equal(0, call_tree.wait_time)
|
99
|
+
assert_equal(0, call_tree.self_time)
|
100
|
+
assert_equal(10, call_tree.children_time)
|
101
|
+
|
102
|
+
call_tree = method.call_trees.callees[1]
|
103
|
+
assert_equal('Allocator#make_hashes', call_tree.target.full_name)
|
104
|
+
assert_equal(5, call_tree.total_time)
|
105
|
+
assert_equal(0, call_tree.wait_time)
|
106
|
+
assert_equal(0, call_tree.self_time)
|
107
|
+
assert_equal(5, call_tree.children_time)
|
108
|
+
|
109
|
+
call_tree = method.call_trees.callees[2]
|
110
|
+
assert_equal('Allocator#make_strings', call_tree.target.full_name)
|
111
|
+
assert_equal(4, call_tree.total_time)
|
112
|
+
assert_equal(0, call_tree.wait_time)
|
113
|
+
assert_equal(1, call_tree.self_time)
|
114
|
+
assert_equal(3, call_tree.children_time)
|
115
|
+
|
116
|
+
# Method 3
|
117
|
+
method = methods[3]
|
118
|
+
assert_equal('Class#new', method.full_name)
|
119
|
+
assert_equal(18, method.total_time)
|
120
|
+
assert_equal(0, method.wait_time)
|
121
|
+
assert_equal(17, method.self_time)
|
122
|
+
assert_equal(1, method.children_time)
|
123
|
+
|
124
|
+
assert_equal(4, method.call_trees.callers.length)
|
125
|
+
call_tree = method.call_trees.callers[0]
|
126
|
+
assert_equal('MeasureAllocationsTest#test_allocations', call_tree.parent.target.full_name)
|
127
|
+
assert_equal(1, call_tree.total_time)
|
128
|
+
assert_equal(0, call_tree.wait_time)
|
129
|
+
assert_equal(1, call_tree.self_time)
|
130
|
+
assert_equal(0, call_tree.children_time)
|
131
|
+
|
132
|
+
call_tree = method.call_trees.callers[1]
|
133
|
+
assert_equal('Integer#times', call_tree.parent.target.full_name)
|
134
|
+
assert_equal(10, call_tree.total_time)
|
135
|
+
assert_equal(0, call_tree.wait_time)
|
136
|
+
assert_equal(10, call_tree.self_time)
|
137
|
+
assert_equal(0, call_tree.children_time)
|
138
|
+
|
139
|
+
call_tree = method.call_trees.callers[2]
|
140
|
+
assert_equal('Allocator#make_hashes', call_tree.parent.target.full_name)
|
141
|
+
assert_equal(5, call_tree.total_time)
|
142
|
+
assert_equal(0, call_tree.wait_time)
|
143
|
+
assert_equal(5, call_tree.self_time)
|
144
|
+
assert_equal(0, call_tree.children_time)
|
145
|
+
|
146
|
+
call_tree = method.call_trees.callers[3]
|
147
|
+
assert_equal('Allocator#make_strings', call_tree.parent.target.full_name)
|
148
|
+
assert_equal(2, call_tree.total_time)
|
149
|
+
assert_equal(0, call_tree.wait_time)
|
150
|
+
assert_equal(1, call_tree.self_time)
|
151
|
+
assert_equal(1, call_tree.children_time)
|
152
|
+
|
153
|
+
assert_equal(4, method.call_trees.callees.length)
|
154
|
+
call_tree = method.call_trees.callees[0]
|
155
|
+
assert_equal('BasicObject#initialize', call_tree.target.full_name)
|
156
|
+
assert_equal(0, call_tree.total_time)
|
157
|
+
assert_equal(0, call_tree.wait_time)
|
158
|
+
assert_equal(0, call_tree.self_time)
|
159
|
+
assert_equal(0, call_tree.children_time)
|
160
|
+
|
161
|
+
call_tree = method.call_trees.callees[1]
|
162
|
+
assert_equal('Array#initialize', call_tree.target.full_name)
|
163
|
+
assert_equal(0, call_tree.total_time)
|
164
|
+
assert_equal(0, call_tree.wait_time)
|
165
|
+
assert_equal(0, call_tree.self_time)
|
166
|
+
assert_equal(0, call_tree.children_time)
|
167
|
+
|
168
|
+
call_tree = method.call_trees.callees[2]
|
169
|
+
assert_equal('Hash#initialize', call_tree.target.full_name)
|
170
|
+
assert_equal(0, call_tree.total_time)
|
171
|
+
assert_equal(0, call_tree.wait_time)
|
172
|
+
assert_equal(0, call_tree.self_time)
|
173
|
+
assert_equal(0, call_tree.children_time)
|
174
|
+
|
175
|
+
call_tree = method.call_trees.callees[3]
|
176
|
+
assert_equal('String#initialize', call_tree.target.full_name)
|
177
|
+
assert_equal(1, call_tree.total_time)
|
178
|
+
assert_equal(0, call_tree.wait_time)
|
179
|
+
assert_equal(1, call_tree.self_time)
|
180
|
+
assert_equal(0, call_tree.children_time)
|
181
|
+
|
182
|
+
# Method 4
|
183
|
+
method = methods[4]
|
184
|
+
assert_equal('Allocator#make_arrays', method.full_name)
|
185
|
+
assert_equal(10, method.total_time)
|
186
|
+
assert_equal(0, method.wait_time)
|
187
|
+
assert_equal(0, method.self_time)
|
188
|
+
assert_equal(10, method.children_time)
|
189
|
+
|
190
|
+
assert_equal(1, method.call_trees.callers.length)
|
191
|
+
call_tree = method.call_trees.callers[0]
|
192
|
+
assert_equal('Allocator#internal_run', call_tree.parent.target.full_name)
|
193
|
+
assert_equal(10, call_tree.total_time)
|
194
|
+
assert_equal(0, call_tree.wait_time)
|
195
|
+
assert_equal(0, call_tree.self_time)
|
196
|
+
assert_equal(10, call_tree.children_time)
|
197
|
+
|
198
|
+
assert_equal(1, method.call_trees.callees.length)
|
199
|
+
call_tree = method.call_trees.callees[0]
|
200
|
+
assert_equal('Integer#times', call_tree.target.full_name)
|
201
|
+
assert_equal(10, call_tree.total_time)
|
202
|
+
assert_equal(0, call_tree.wait_time)
|
203
|
+
assert_equal(0, call_tree.self_time)
|
204
|
+
assert_equal(10, call_tree.children_time)
|
205
|
+
|
206
|
+
# Method 5
|
207
|
+
method = methods[5]
|
208
|
+
assert_equal('Integer#times', method.full_name)
|
209
|
+
assert_equal(10, method.total_time)
|
210
|
+
assert_equal(0, method.wait_time)
|
211
|
+
assert_equal(0, method.self_time)
|
212
|
+
assert_equal(10, method.children_time)
|
213
|
+
|
214
|
+
assert_equal(1, method.call_trees.callers.length)
|
215
|
+
call_tree = method.call_trees.callers[0]
|
216
|
+
assert_equal('Allocator#make_arrays', call_tree.parent.target.full_name)
|
217
|
+
assert_equal(10, call_tree.total_time)
|
218
|
+
assert_equal(0, call_tree.wait_time)
|
219
|
+
assert_equal(0, call_tree.self_time)
|
220
|
+
assert_equal(10, call_tree.children_time)
|
221
|
+
|
222
|
+
assert_equal(1, method.call_trees.callees.length)
|
223
|
+
call_tree = method.call_trees.callees[0]
|
224
|
+
assert_equal('Class#new', call_tree.target.full_name)
|
225
|
+
assert_equal(10, call_tree.total_time)
|
226
|
+
assert_equal(0, call_tree.wait_time)
|
227
|
+
assert_equal(10, call_tree.self_time)
|
228
|
+
assert_equal(0, call_tree.children_time)
|
229
|
+
|
230
|
+
# Method 6
|
231
|
+
method = methods[6]
|
232
|
+
assert_equal('Allocator#make_hashes', method.full_name)
|
233
|
+
assert_equal(5, method.total_time)
|
234
|
+
assert_equal(0, method.wait_time)
|
235
|
+
assert_equal(0, method.self_time)
|
236
|
+
assert_equal(5, method.children_time)
|
237
|
+
|
238
|
+
assert_equal(1, method.call_trees.callers.length)
|
239
|
+
call_tree = method.call_trees.callers[0]
|
240
|
+
assert_equal('Allocator#internal_run', call_tree.parent.target.full_name)
|
241
|
+
assert_equal(5, call_tree.total_time)
|
242
|
+
assert_equal(0, call_tree.wait_time)
|
243
|
+
assert_equal(0, call_tree.self_time)
|
244
|
+
assert_equal(5, call_tree.children_time)
|
245
|
+
|
246
|
+
assert_equal(1, method.call_trees.callees.length)
|
247
|
+
call_tree = method.call_trees.callees[0]
|
248
|
+
assert_equal('Class#new', call_tree.target.full_name)
|
249
|
+
assert_equal(5, call_tree.total_time)
|
250
|
+
assert_equal(0, call_tree.wait_time)
|
251
|
+
assert_equal(5, call_tree.self_time)
|
252
|
+
assert_equal(0, call_tree.children_time)
|
253
|
+
|
254
|
+
# Method 7
|
255
|
+
method = methods[7]
|
256
|
+
assert_equal('Allocator#make_strings', method.full_name)
|
257
|
+
assert_equal(4, method.total_time)
|
258
|
+
assert_equal(0, method.wait_time)
|
259
|
+
assert_equal(1, method.self_time)
|
260
|
+
assert_equal(3, method.children_time)
|
261
|
+
|
262
|
+
assert_equal(1, method.call_trees.callers.length)
|
263
|
+
call_tree = method.call_trees.callers[0]
|
264
|
+
assert_equal('Allocator#internal_run', call_tree.parent.target.full_name)
|
265
|
+
assert_equal(4, call_tree.total_time)
|
266
|
+
assert_equal(0, call_tree.wait_time)
|
267
|
+
assert_equal(1, call_tree.self_time)
|
268
|
+
assert_equal(3, call_tree.children_time)
|
269
|
+
|
270
|
+
assert_equal(2, method.call_trees.callees.length)
|
271
|
+
call_tree = method.call_trees.callees[0]
|
272
|
+
assert_equal('String#*', call_tree.target.full_name)
|
273
|
+
assert_equal(1, call_tree.total_time)
|
274
|
+
assert_equal(0, call_tree.wait_time)
|
275
|
+
assert_equal(1, call_tree.self_time)
|
276
|
+
assert_equal(0, call_tree.children_time)
|
277
|
+
|
278
|
+
call_tree = method.call_trees.callees[1]
|
279
|
+
assert_equal('Class#new', call_tree.target.full_name)
|
280
|
+
assert_equal(2, call_tree.total_time)
|
281
|
+
assert_equal(0, call_tree.wait_time)
|
282
|
+
assert_equal(1, call_tree.self_time)
|
283
|
+
assert_equal(1, call_tree.children_time)
|
284
|
+
|
285
|
+
# Method 8
|
286
|
+
method = methods[8]
|
287
|
+
assert_equal('String#*', method.full_name)
|
288
|
+
assert_equal(1, method.total_time)
|
289
|
+
assert_equal(0, method.wait_time)
|
290
|
+
assert_equal(1, method.self_time)
|
291
|
+
assert_equal(0, method.children_time)
|
292
|
+
|
293
|
+
assert_equal(1, method.call_trees.callers.length)
|
294
|
+
call_tree = method.call_trees.callers[0]
|
295
|
+
assert_equal('Allocator#make_strings', call_tree.parent.target.full_name)
|
296
|
+
assert_equal(1, call_tree.total_time)
|
297
|
+
assert_equal(0, call_tree.wait_time)
|
298
|
+
assert_equal(1, call_tree.self_time)
|
299
|
+
assert_equal(0, call_tree.children_time)
|
300
|
+
|
301
|
+
assert_equal(0, method.call_trees.callees.length)
|
302
|
+
|
303
|
+
# Method 9
|
304
|
+
method = methods[9]
|
305
|
+
assert_equal('String#initialize', method.full_name)
|
306
|
+
assert_equal(1, method.total_time)
|
307
|
+
assert_equal(0, method.wait_time)
|
308
|
+
assert_equal(1, method.self_time)
|
309
|
+
assert_equal(0, method.children_time)
|
310
|
+
|
311
|
+
assert_equal(1, method.call_trees.callers.length)
|
312
|
+
call_tree = method.call_trees.callers[0]
|
313
|
+
assert_equal('Class#new', call_tree.parent.target.full_name)
|
314
|
+
assert_equal(1, call_tree.total_time)
|
315
|
+
assert_equal(0, call_tree.wait_time)
|
316
|
+
assert_equal(1, call_tree.self_time)
|
317
|
+
assert_equal(0, call_tree.children_time)
|
318
|
+
|
319
|
+
assert_equal(0, method.call_trees.callees.length)
|
320
|
+
|
321
|
+
# Method 10
|
322
|
+
method = methods[10]
|
323
|
+
assert_equal('BasicObject#initialize', method.full_name)
|
324
|
+
assert_equal(0, method.total_time)
|
325
|
+
assert_equal(0, method.wait_time)
|
326
|
+
assert_equal(0, method.self_time)
|
327
|
+
assert_equal(0, method.children_time)
|
328
|
+
|
329
|
+
assert_equal(1, method.call_trees.callers.length)
|
330
|
+
call_tree = method.call_trees.callers[0]
|
331
|
+
assert_equal('Class#new', call_tree.parent.target.full_name)
|
332
|
+
assert_equal(0, call_tree.total_time)
|
333
|
+
assert_equal(0, call_tree.wait_time)
|
334
|
+
assert_equal(0, call_tree.self_time)
|
335
|
+
assert_equal(0, call_tree.children_time)
|
336
|
+
|
337
|
+
assert_equal(0, method.call_trees.callees.length)
|
338
|
+
|
339
|
+
# Method 11
|
340
|
+
method = methods[11]
|
341
|
+
assert_equal('Hash#initialize', method.full_name)
|
342
|
+
assert_equal(0, method.total_time)
|
343
|
+
assert_equal(0, method.wait_time)
|
344
|
+
assert_equal(0, method.self_time)
|
345
|
+
assert_equal(0, method.children_time)
|
346
|
+
|
347
|
+
assert_equal(1, method.call_trees.callers.length)
|
348
|
+
call_tree = method.call_trees.callers[0]
|
349
|
+
assert_equal('Class#new', call_tree.parent.target.full_name)
|
350
|
+
assert_equal(0, call_tree.total_time)
|
351
|
+
assert_equal(0, call_tree.wait_time)
|
352
|
+
assert_equal(0, call_tree.self_time)
|
353
|
+
assert_equal(0, call_tree.children_time)
|
354
|
+
|
355
|
+
assert_equal(0, method.call_trees.callees.length)
|
356
|
+
|
357
|
+
# Method 12
|
358
|
+
method = methods[12]
|
359
|
+
assert_equal('Array#initialize', method.full_name)
|
360
|
+
assert_equal(0, method.total_time)
|
361
|
+
assert_equal(0, method.wait_time)
|
362
|
+
assert_equal(0, method.self_time)
|
363
|
+
assert_equal(0, method.children_time)
|
364
|
+
|
365
|
+
assert_equal(1, method.call_trees.callers.length)
|
366
|
+
call_tree = method.call_trees.callers[0]
|
367
|
+
assert_equal('Class#new', call_tree.parent.target.full_name)
|
368
|
+
assert_equal(0, call_tree.total_time)
|
369
|
+
assert_equal(0, call_tree.wait_time)
|
370
|
+
assert_equal(0, call_tree.self_time)
|
371
|
+
assert_equal(0, call_tree.children_time)
|
372
|
+
|
373
|
+
assert_equal(0, method.call_trees.callees.length)
|
25
374
|
end
|
26
375
|
end
|