ruby-prof 1.7.1 → 1.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES +8 -0
- data/ext/ruby_prof/extconf.rb +23 -22
- data/ext/ruby_prof/rp_call_trees.c +296 -296
- data/ext/ruby_prof/rp_call_trees.h +28 -28
- data/ext/ruby_prof/rp_measure_allocations.c +47 -47
- data/ext/ruby_prof/rp_measure_process_time.c +64 -66
- data/ext/ruby_prof/rp_measure_wall_time.c +52 -64
- data/ext/ruby_prof/rp_method.c +551 -551
- data/ext/ruby_prof/rp_stack.c +212 -212
- data/ext/ruby_prof/ruby_prof.c +50 -50
- data/ext/ruby_prof/ruby_prof.h +3 -2
- data/ext/ruby_prof/vc/ruby_prof.vcxproj +3 -3
- data/lib/ruby-prof/compatibility.rb +113 -113
- data/lib/ruby-prof/exclude_common_methods.rb +204 -204
- data/lib/ruby-prof/printers/abstract_printer.rb +156 -138
- data/lib/ruby-prof/version.rb +3 -3
- data/ruby-prof.gemspec +66 -65
- data/test/dynamic_method_test.rb +9 -21
- data/test/enumerable_test.rb +23 -21
- data/test/exclude_methods_test.rb +363 -257
- data/test/fiber_test.rb +195 -195
- data/test/gc_test.rb +104 -102
- data/test/line_number_test.rb +426 -289
- data/test/measure_allocations_test.rb +1172 -1081
- data/test/measure_memory_test.rb +1193 -1456
- data/test/measure_process_time_test.rb +3330 -2477
- data/test/measure_wall_time_test.rb +634 -568
- data/test/merge_test.rb +146 -146
- data/test/method_info_test.rb +100 -95
- data/test/printers_test.rb +178 -135
- data/test/recursive_test.rb +796 -622
- data/test/start_stop_test.rb +4 -4
- data/test/test_helper.rb +20 -20
- data/test/thread_test.rb +229 -231
- data/test/unique_call_path_test.rb +9 -22
- data/test/yarv_test.rb +1 -5
- metadata +19 -9
- data/test/crash2.rb +0 -144
data/test/start_stop_test.rb
CHANGED
@@ -76,10 +76,10 @@ class StartStopTest < TestCase
|
|
76
76
|
method = methods[2]
|
77
77
|
assert_equal('StartStopTest#method3', method.full_name)
|
78
78
|
assert_equal(1, method.called)
|
79
|
-
assert_in_delta(2, method.total_time, 0.
|
79
|
+
assert_in_delta(2, method.total_time, 0.05)
|
80
80
|
assert_in_delta(0, method.wait_time, 0.02)
|
81
81
|
assert_in_delta(0, method.self_time, 0.02)
|
82
|
-
assert_in_delta(2, method.children_time, 0.
|
82
|
+
assert_in_delta(2, method.children_time, 0.05)
|
83
83
|
|
84
84
|
assert_equal(1, method.call_trees.callers.length)
|
85
85
|
call_tree = method.call_trees.callers[0]
|
@@ -92,10 +92,10 @@ class StartStopTest < TestCase
|
|
92
92
|
method = methods[3]
|
93
93
|
assert_equal('Kernel#sleep', method.full_name)
|
94
94
|
assert_equal(1, method.called)
|
95
|
-
assert_in_delta(2, method.total_time, 0.
|
95
|
+
assert_in_delta(2, method.total_time, 0.05)
|
96
96
|
assert_in_delta(0, method.wait_time, 0.02)
|
97
97
|
assert_in_delta(2, method.self_time, 0.02)
|
98
|
-
assert_in_delta(0, method.children_time, 0.
|
98
|
+
assert_in_delta(0, method.children_time, 0.05)
|
99
99
|
|
100
100
|
assert_equal(1, method.call_trees.callers.length)
|
101
101
|
call_tree = method.call_trees.callers[0]
|
data/test/test_helper.rb
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
# To make testing/debugging easier test within this source tree versus an installed gem
|
4
|
-
require 'bundler/setup'
|
5
|
-
|
6
|
-
# Add ext directory to load path to make it easier to test locally built extensions
|
7
|
-
ext_path = File.expand_path(File.join(__dir__, '..', 'ext', 'ruby_prof'))
|
8
|
-
$LOAD_PATH.unshift(
|
9
|
-
|
10
|
-
# Now load code
|
11
|
-
require 'ruby-prof'
|
12
|
-
|
13
|
-
# Disable minitest parallel tests. The problem is the thread switching will change test results
|
14
|
-
# (self vs wait time)
|
15
|
-
ENV["MT_CPU"] = "0" # New versions of minitest
|
16
|
-
ENV["N"] = "0" # Older versions of minitest
|
17
|
-
|
18
|
-
require 'minitest/autorun'
|
19
|
-
class TestCase < Minitest::Test
|
20
|
-
end
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
# To make testing/debugging easier test within this source tree versus an installed gem
|
4
|
+
require 'bundler/setup'
|
5
|
+
|
6
|
+
# Add ext directory to load path to make it easier to test locally built extensions
|
7
|
+
ext_path = File.expand_path(File.join(__dir__, '..', 'ext', 'ruby_prof'))
|
8
|
+
$LOAD_PATH.unshift(ext_path)
|
9
|
+
|
10
|
+
# Now load code
|
11
|
+
require 'ruby-prof'
|
12
|
+
|
13
|
+
# Disable minitest parallel tests. The problem is the thread switching will change test results
|
14
|
+
# (self vs wait time)
|
15
|
+
ENV["MT_CPU"] = "0" # New versions of minitest
|
16
|
+
ENV["N"] = "0" # Older versions of minitest
|
17
|
+
|
18
|
+
require 'minitest/autorun'
|
19
|
+
class TestCase < Minitest::Test
|
20
|
+
end
|
data/test/thread_test.rb
CHANGED
@@ -1,231 +1,229 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# encoding: UTF-8
|
3
|
-
|
4
|
-
require File.expand_path('../test_helper', __FILE__)
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
assert(thread)
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
#
|
38
|
-
assert_in_delta(
|
39
|
-
assert_in_delta(
|
40
|
-
assert_in_delta(
|
41
|
-
assert_in_delta(
|
42
|
-
assert_in_delta(
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
call_tree
|
48
|
-
|
49
|
-
assert_in_delta(
|
50
|
-
assert_in_delta(
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
call_tree
|
56
|
-
|
57
|
-
assert_in_delta(
|
58
|
-
assert_in_delta(
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
call_tree
|
64
|
-
|
65
|
-
assert_in_delta(
|
66
|
-
assert_in_delta(
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
call_tree
|
72
|
-
|
73
|
-
assert_in_delta(
|
74
|
-
assert_in_delta(
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
#
|
79
|
-
# call_tree
|
80
|
-
#
|
81
|
-
# assert_in_delta(
|
82
|
-
# assert_in_delta(
|
83
|
-
|
84
|
-
#
|
85
|
-
|
86
|
-
# bb
|
87
|
-
# call_tree
|
88
|
-
#
|
89
|
-
# assert_in_delta(
|
90
|
-
# assert_in_delta(
|
91
|
-
|
92
|
-
#
|
93
|
-
|
94
|
-
|
95
|
-
call_tree
|
96
|
-
|
97
|
-
assert_in_delta(0.
|
98
|
-
assert_in_delta(0.
|
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
|
-
sleep
|
144
|
-
#
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
method
|
159
|
-
|
160
|
-
|
161
|
-
assert_in_delta(
|
162
|
-
assert_in_delta(
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
method
|
168
|
-
|
169
|
-
|
170
|
-
assert_in_delta(
|
171
|
-
assert_in_delta(
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
methods =
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
#
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
assert_in_delta(
|
191
|
-
assert_in_delta(
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
method
|
199
|
-
|
200
|
-
|
201
|
-
assert_in_delta(1, method.
|
202
|
-
assert_in_delta(0, method.
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
method
|
210
|
-
|
211
|
-
|
212
|
-
assert_in_delta(0, method.
|
213
|
-
assert_in_delta(0, method.
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
method
|
221
|
-
|
222
|
-
|
223
|
-
assert_in_delta(0, method.
|
224
|
-
assert_in_delta(0, method.
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
end
|
231
|
-
end
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
3
|
+
|
4
|
+
require File.expand_path('../test_helper', __FILE__)
|
5
|
+
require_relative './call_tree_builder'
|
6
|
+
|
7
|
+
# -- Tests ----
|
8
|
+
class ThreadTest < TestCase
|
9
|
+
def test_initialize
|
10
|
+
method_info = RubyProf::MethodInfo.new(Array, :size)
|
11
|
+
call_tree = RubyProf::CallTree.new(method_info)
|
12
|
+
thread = RubyProf::Thread.new(call_tree, Thread.current, Fiber.current)
|
13
|
+
|
14
|
+
assert_equal(call_tree, thread.call_tree)
|
15
|
+
assert(thread)
|
16
|
+
assert(thread.id)
|
17
|
+
assert(thread.fiber_id)
|
18
|
+
|
19
|
+
assert_equal(1, thread.methods.size)
|
20
|
+
assert_same(method_info, thread.methods[0])
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_merge
|
24
|
+
call_tree_1 = create_call_tree_1
|
25
|
+
thread_1 = RubyProf::Thread.new(call_tree_1, Thread.current, Fiber.current)
|
26
|
+
assert_equal(6, thread_1.methods.size)
|
27
|
+
|
28
|
+
call_tree_2 = create_call_tree_2
|
29
|
+
thread_2 = RubyProf::Thread.new(call_tree_2, Thread.current, Fiber.current)
|
30
|
+
assert_equal(6, thread_2.methods.size)
|
31
|
+
|
32
|
+
thread_1.merge!(thread_2)
|
33
|
+
assert_equal(7, thread_1.methods.size)
|
34
|
+
|
35
|
+
# Method times
|
36
|
+
assert_in_delta(11.6, thread_1.methods[0].total_time, 0.00001) # root
|
37
|
+
assert_in_delta(4.1, thread_1.methods[1].total_time, 0.00001) # a
|
38
|
+
assert_in_delta(1.5, thread_1.methods[2].total_time, 0.00001) # aa
|
39
|
+
assert_in_delta(2.6, thread_1.methods[3].total_time, 0.00001) # ab
|
40
|
+
assert_in_delta(7.5, thread_1.methods[4].total_time, 0.00001) # b
|
41
|
+
assert_in_delta(6.6, thread_1.methods[5].total_time, 0.00001) # bb
|
42
|
+
assert_in_delta(0.9, thread_1.methods[6].total_time, 0.00001) # ba
|
43
|
+
|
44
|
+
# Root
|
45
|
+
call_tree = call_tree_1
|
46
|
+
assert_equal(:root, call_tree.target.method_name)
|
47
|
+
assert_in_delta(11.6, call_tree.total_time, 0.00001)
|
48
|
+
assert_in_delta(0, call_tree.self_time, 0.00001)
|
49
|
+
assert_in_delta(0.0, call_tree.wait_time, 0.00001)
|
50
|
+
assert_in_delta(11.6, call_tree.children_time, 0.00001)
|
51
|
+
|
52
|
+
# a
|
53
|
+
call_tree = call_tree_1.children[0]
|
54
|
+
assert_equal(:a, call_tree.target.method_name)
|
55
|
+
assert_in_delta(4.1, call_tree.total_time, 0.00001)
|
56
|
+
assert_in_delta(0, call_tree.self_time, 0.00001)
|
57
|
+
assert_in_delta(0.0, call_tree.wait_time, 0.00001)
|
58
|
+
assert_in_delta(4.1, call_tree.children_time, 0.00001)
|
59
|
+
|
60
|
+
# aa
|
61
|
+
call_tree = call_tree_1.children[0].children[0]
|
62
|
+
assert_equal(:aa, call_tree.target.method_name)
|
63
|
+
assert_in_delta(1.5, call_tree.total_time, 0.00001)
|
64
|
+
assert_in_delta(1.5, call_tree.self_time, 0.00001)
|
65
|
+
assert_in_delta(0.0, call_tree.wait_time, 0.00001)
|
66
|
+
assert_in_delta(0.0, call_tree.children_time, 0.00001)
|
67
|
+
|
68
|
+
# ab
|
69
|
+
call_tree = call_tree_1.children[0].children[1]
|
70
|
+
assert_equal(:ab, call_tree.target.method_name)
|
71
|
+
assert_in_delta(2.6, call_tree.total_time, 0.00001)
|
72
|
+
assert_in_delta(2.6, call_tree.self_time, 0.00001)
|
73
|
+
assert_in_delta(0.0, call_tree.wait_time, 0.00001)
|
74
|
+
assert_in_delta(0.0, call_tree.children_time, 0.00001)
|
75
|
+
|
76
|
+
# # b
|
77
|
+
# call_tree = call_tree_1.children[1]
|
78
|
+
# assert_equal(:b, call_tree.target.method_name)
|
79
|
+
# assert_in_delta(7.5, call_tree.total_time, 0.00001)
|
80
|
+
# assert_in_delta(0, call_tree.self_time, 0.00001)
|
81
|
+
# assert_in_delta(0.0, call_tree.wait_time, 0.00001)
|
82
|
+
# assert_in_delta(7.5, call_tree.children_time, 0.00001)
|
83
|
+
|
84
|
+
# bb
|
85
|
+
# call_tree = call_tree_1.children[1].children[0]
|
86
|
+
# assert_equal(:bb, call_tree.target.method_name)
|
87
|
+
# assert_in_delta(6.6, call_tree.total_time, 0.00001)
|
88
|
+
# assert_in_delta(6.6, call_tree.self_time, 0.00001)
|
89
|
+
# assert_in_delta(0.0, call_tree.wait_time, 0.00001)
|
90
|
+
# assert_in_delta(0.0, call_tree.children_time, 0.00001)
|
91
|
+
|
92
|
+
# ba
|
93
|
+
call_tree = call_tree_1.children[1].children[1]
|
94
|
+
assert_equal(:ba, call_tree.target.method_name)
|
95
|
+
assert_in_delta(0.9, call_tree.total_time, 0.00001)
|
96
|
+
assert_in_delta(0.7, call_tree.self_time, 0.00001)
|
97
|
+
assert_in_delta(0.2, call_tree.wait_time, 0.00001)
|
98
|
+
assert_in_delta(0.0, call_tree.children_time, 0.00001)
|
99
|
+
end
|
100
|
+
|
101
|
+
def test_thread_count
|
102
|
+
result = RubyProf::Profile.profile(measure_mode: RubyProf::WALL_TIME) do
|
103
|
+
thread = Thread.new do
|
104
|
+
sleep(1)
|
105
|
+
end
|
106
|
+
|
107
|
+
thread.join
|
108
|
+
end
|
109
|
+
assert_equal(2, result.threads.length)
|
110
|
+
end
|
111
|
+
|
112
|
+
def test_thread_identity
|
113
|
+
profile = RubyProf::Profile.new(measure_mode: RubyProf::WALL_TIME)
|
114
|
+
profile.start
|
115
|
+
|
116
|
+
sleep_thread = Thread.new do
|
117
|
+
sleep(1)
|
118
|
+
end
|
119
|
+
sleep_thread.join
|
120
|
+
result = profile.stop
|
121
|
+
|
122
|
+
thread_ids = result.threads.map {|thread| thread.id}.sort
|
123
|
+
threads = [Thread.current, sleep_thread]
|
124
|
+
assert_equal(2, result.threads.length)
|
125
|
+
|
126
|
+
assert(thread_ids.include?(threads[0].object_id))
|
127
|
+
assert(thread_ids.include?(threads[1].object_id))
|
128
|
+
|
129
|
+
assert_instance_of(Thread, ObjectSpace._id2ref(thread_ids[0]))
|
130
|
+
assert(threads.include?(ObjectSpace._id2ref(thread_ids[0])))
|
131
|
+
|
132
|
+
assert_instance_of(Thread, ObjectSpace._id2ref(thread_ids[1]))
|
133
|
+
assert(threads.include?(ObjectSpace._id2ref(thread_ids[1])))
|
134
|
+
end
|
135
|
+
|
136
|
+
def test_thread_timings
|
137
|
+
profile = RubyProf::Profile.new(measure_mode: RubyProf::WALL_TIME)
|
138
|
+
profile.start
|
139
|
+
|
140
|
+
thread = Thread.new do
|
141
|
+
sleep 0
|
142
|
+
# force it to hit thread.join, below, first
|
143
|
+
# thus forcing sleep(1), below, to be counted as (wall) self_time
|
144
|
+
# since we currently count time "in some other thread" as self.wait_time
|
145
|
+
sleep(1)
|
146
|
+
end
|
147
|
+
thread.join
|
148
|
+
result = profile.stop
|
149
|
+
|
150
|
+
# Check background thread
|
151
|
+
assert_equal(2, result.threads.length)
|
152
|
+
|
153
|
+
rp_thread = result.threads.detect {|t| t.id == thread.object_id}
|
154
|
+
methods = rp_thread.methods.sort.reverse
|
155
|
+
|
156
|
+
method = methods[0]
|
157
|
+
assert_equal('ThreadTest#test_thread_timings', method.full_name)
|
158
|
+
assert_equal(1, method.called)
|
159
|
+
assert_in_delta(1, method.total_time, 0.1)
|
160
|
+
assert_in_delta(0, method.self_time, 0.05)
|
161
|
+
assert_in_delta(0, method.wait_time, 0.05)
|
162
|
+
assert_in_delta(1, method.children_time, 0.1)
|
163
|
+
assert_equal(0, method.call_trees.callers.length)
|
164
|
+
|
165
|
+
method = methods[1]
|
166
|
+
assert_equal('Kernel#sleep', method.full_name)
|
167
|
+
assert_equal(2, method.called)
|
168
|
+
assert_in_delta(1, method.total_time, 0.05)
|
169
|
+
assert_in_delta(1.0, method.self_time, 0.05)
|
170
|
+
assert_in_delta(0, method.wait_time, 0.05)
|
171
|
+
assert_in_delta(0, method.children_time, 0.05)
|
172
|
+
|
173
|
+
assert_equal(1, method.call_trees.callers.length)
|
174
|
+
assert_equal(0, method.call_trees.callees.length)
|
175
|
+
|
176
|
+
# Check foreground thread
|
177
|
+
rp_thread = result.threads.detect {|athread| athread.id == Thread.current.object_id}
|
178
|
+
methods = rp_thread.methods.sort.reverse
|
179
|
+
assert_equal(4, methods.length)
|
180
|
+
methods = methods.sort.reverse
|
181
|
+
|
182
|
+
method = methods[0]
|
183
|
+
assert_equal('ThreadTest#test_thread_timings', method.full_name)
|
184
|
+
# the sub calls to Object#new, when popped,
|
185
|
+
# cause the parent frame to be created for method #test_thread_timings, which means a +1 when it's popped in the end
|
186
|
+
# xxxx a test that shows it the other way, too (never creates parent frame--if that's even possible)
|
187
|
+
assert_equal(1, method.called)
|
188
|
+
assert_in_delta(1, method.total_time, 0.05)
|
189
|
+
assert_in_delta(0, method.self_time, 0.05)
|
190
|
+
assert_in_delta(0, method.wait_time, 0.05)
|
191
|
+
assert_in_delta(1, method.children_time, 0.05)
|
192
|
+
|
193
|
+
assert_equal(0, method.call_trees.callers.length)
|
194
|
+
assert_equal(2, method.call_trees.callees.length)
|
195
|
+
|
196
|
+
method = methods[1]
|
197
|
+
assert_equal('Thread#join', method.full_name)
|
198
|
+
assert_equal(1, method.called)
|
199
|
+
assert_in_delta(1, method.total_time, 0.05)
|
200
|
+
assert_in_delta(0, method.self_time, 0.05)
|
201
|
+
assert_in_delta(1.0, method.wait_time, 0.05)
|
202
|
+
assert_in_delta(0, method.children_time, 0.05)
|
203
|
+
|
204
|
+
assert_equal(1, method.call_trees.callers.length)
|
205
|
+
assert_equal(0, method.call_trees.callees.length)
|
206
|
+
|
207
|
+
method = methods[2]
|
208
|
+
assert_equal('<Class::Thread>#new', method.full_name)
|
209
|
+
assert_equal(1, method.called)
|
210
|
+
assert_in_delta(0, method.total_time, 0.05)
|
211
|
+
assert_in_delta(0, method.self_time, 0.05)
|
212
|
+
assert_in_delta(0, method.wait_time, 0.05)
|
213
|
+
assert_in_delta(0, method.children_time, 0.05)
|
214
|
+
|
215
|
+
assert_equal(1, method.call_trees.callers.length)
|
216
|
+
assert_equal(1, method.call_trees.callees.length)
|
217
|
+
|
218
|
+
method = methods[3]
|
219
|
+
assert_equal('Thread#initialize', method.full_name)
|
220
|
+
assert_equal(1, method.called)
|
221
|
+
assert_in_delta(0, method.total_time, 0.05)
|
222
|
+
assert_in_delta(0, method.self_time, 0.05)
|
223
|
+
assert_in_delta(0, method.wait_time, 0.05)
|
224
|
+
assert_in_delta(0, method.children_time, 0.05)
|
225
|
+
|
226
|
+
assert_equal(1, method.call_trees.callers.length)
|
227
|
+
assert_equal(0, method.call_trees.callees.length)
|
228
|
+
end
|
229
|
+
end
|
@@ -79,14 +79,9 @@ class UniqueCallPathTest < TestCase
|
|
79
79
|
array
|
80
80
|
end
|
81
81
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
else
|
86
|
-
assert_equal(2, call_info_a.children.length)
|
87
|
-
assert_equal("Integer#==", call_info_a.children[0].target.full_name)
|
88
|
-
assert_equal("UniqueCallPath#method_b", call_info_a.children[1].target.full_name)
|
89
|
-
end
|
82
|
+
assert_equal(2, call_info_a.children.length)
|
83
|
+
assert_equal("Integer#==", call_info_a.children[0].target.full_name)
|
84
|
+
assert_equal("UniqueCallPath#method_b", call_info_a.children[1].target.full_name)
|
90
85
|
end
|
91
86
|
|
92
87
|
def test_unique_path
|
@@ -116,21 +111,13 @@ class UniqueCallPathTest < TestCase
|
|
116
111
|
c1.target.full_name <=> c2.target.full_name
|
117
112
|
end
|
118
113
|
|
119
|
-
|
120
|
-
|
121
|
-
assert_equal(1, children_of_a.length)
|
114
|
+
assert_equal(2, call_info_a.children.length)
|
115
|
+
assert_equal(2, children_of_a.length)
|
122
116
|
|
123
|
-
|
124
|
-
|
125
|
-
else
|
126
|
-
assert_equal(2, call_info_a.children.length)
|
127
|
-
assert_equal(2, children_of_a.length)
|
117
|
+
assert_equal(1, children_of_a[0].called)
|
118
|
+
assert_equal("Integer#==", children_of_a[0].target.full_name)
|
128
119
|
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
assert_equal(1, children_of_a[1].called)
|
133
|
-
assert_equal("UniqueCallPath#method_b", children_of_a[1].target.full_name)
|
134
|
-
end
|
120
|
+
assert_equal(1, children_of_a[1].called)
|
121
|
+
assert_equal("UniqueCallPath#method_b", children_of_a[1].target.full_name)
|
135
122
|
end
|
136
123
|
end
|
data/test/yarv_test.rb
CHANGED
@@ -25,11 +25,7 @@ class YarvTest < TestCase
|
|
25
25
|
a = self.array_push_optimized
|
26
26
|
end
|
27
27
|
assert_equal(2, a.length)
|
28
|
-
|
29
|
-
assert_equal(["YarvTest#test_array_push_optimized", "YarvTest#array_push_optimized", "Array#push"], result.threads.first.methods.map(&:full_name))
|
30
|
-
else
|
31
|
-
assert_equal(["YarvTest#test_array_push_optimized", "YarvTest#array_push_optimized", "Array#<<", "Array#push"], result.threads.first.methods.map(&:full_name))
|
32
|
-
end
|
28
|
+
assert_equal(["YarvTest#test_array_push_optimized", "YarvTest#array_push_optimized", "Array#<<", "Array#push"], result.threads.first.methods.map(&:full_name))
|
33
29
|
end
|
34
30
|
|
35
31
|
private
|