ruby-prof 0.10.8 → 0.11.0.rc1
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.
- data/CHANGES +38 -18
- data/LICENSE +4 -3
- data/README.rdoc +30 -66
- data/Rakefile +47 -54
- data/bin/ruby-prof +24 -4
- data/ext/ruby_prof/extconf.rb +9 -16
- data/ext/ruby_prof/rp_call_info.c +369 -0
- data/ext/ruby_prof/rp_call_info.h +46 -0
- data/ext/ruby_prof/rp_measure.c +48 -0
- data/ext/ruby_prof/rp_measure.h +45 -0
- data/ext/ruby_prof/rp_measure_allocations.c +86 -0
- data/ext/ruby_prof/rp_measure_cpu_time.c +112 -0
- data/ext/ruby_prof/rp_measure_gc_runs.c +87 -0
- data/ext/ruby_prof/rp_measure_gc_time.c +73 -0
- data/ext/ruby_prof/rp_measure_memory.c +81 -0
- data/ext/ruby_prof/rp_measure_process_time.c +71 -0
- data/ext/ruby_prof/rp_measure_wall_time.c +42 -0
- data/ext/ruby_prof/rp_method.c +363 -0
- data/ext/ruby_prof/rp_method.h +55 -0
- data/ext/ruby_prof/rp_stack.c +61 -0
- data/ext/ruby_prof/rp_stack.h +40 -0
- data/ext/ruby_prof/rp_thread.c +113 -0
- data/ext/ruby_prof/rp_thread.h +20 -0
- data/ext/ruby_prof/ruby_prof.c +259 -1398
- data/ext/ruby_prof/ruby_prof.h +54 -190
- data/ext/ruby_prof/version.h +6 -3
- data/lib/1.8/ruby_prof.so +0 -0
- data/lib/1.9/ruby_prof.exp +0 -0
- data/lib/1.9/ruby_prof.ilk +0 -0
- data/lib/1.9/ruby_prof.lib +0 -0
- data/lib/1.9/ruby_prof.pdb +0 -0
- data/lib/1.9/ruby_prof.so +0 -0
- data/lib/ruby-prof.rb +14 -11
- data/lib/ruby-prof/abstract_printer.rb +10 -0
- data/lib/ruby-prof/aggregate_call_info.rb +2 -0
- data/lib/ruby-prof/call_info.rb +2 -0
- data/lib/ruby-prof/call_stack_printer.rb +2 -4
- data/lib/ruby-prof/call_tree_printer.rb +1 -0
- data/lib/ruby-prof/compatibility.rb +134 -0
- data/lib/ruby-prof/dot_printer.rb +7 -7
- data/lib/ruby-prof/flat_printer.rb +7 -7
- data/lib/ruby-prof/flat_printer_with_line_numbers.rb +2 -5
- data/lib/ruby-prof/graph_html_printer.rb +4 -2
- data/lib/ruby-prof/graph_printer.rb +4 -3
- data/lib/ruby-prof/method_info.rb +2 -0
- data/lib/ruby-prof/multi_printer.rb +2 -0
- data/lib/ruby-prof/{result.rb → profile.rb} +3 -1
- data/lib/ruby-prof/rack.rb +1 -0
- data/lib/ruby-prof/symbol_to_proc.rb +2 -0
- data/lib/ruby-prof/task.rb +1 -0
- data/lib/ruby-prof/test.rb +2 -0
- data/lib/ruby_prof.exp +0 -0
- data/lib/ruby_prof.ilk +0 -0
- data/lib/ruby_prof.lib +0 -0
- data/lib/ruby_prof.pdb +0 -0
- data/lib/ruby_prof.so +0 -0
- data/lib/unprof.rb +2 -0
- data/test/aggregate_test.rb +8 -8
- data/test/basic_test.rb +3 -251
- data/test/bug_test.rb +6 -0
- data/test/duplicate_names_test.rb +2 -2
- data/test/dynamic_method_test.rb +61 -0
- data/test/enumerable_test.rb +2 -2
- data/test/exceptions_test.rb +4 -3
- data/test/exclude_threads_test.rb +2 -2
- data/test/exec_test.rb +3 -3
- data/test/line_number_test.rb +5 -5
- data/test/measure_allocations_test.rb +25 -0
- data/test/measure_cpu_time_test.rb +212 -0
- data/test/measure_gc_runs_test.rb +29 -0
- data/test/measure_gc_time_test.rb +29 -0
- data/test/measure_memory_test.rb +36 -0
- data/test/measure_process_time_test.rb +205 -0
- data/test/measure_wall_time_test.rb +209 -0
- data/test/method_elimination_test.rb +2 -2
- data/test/module_test.rb +3 -2
- data/test/multi_printer_test.rb +2 -2
- data/test/no_method_class_test.rb +3 -1
- data/test/prime_test.rb +3 -3
- data/test/printers_test.rb +106 -8
- data/test/recursive_test.rb +7 -6
- data/test/singleton_test.rb +2 -2
- data/test/stack_printer_test.rb +2 -3
- data/test/stack_test.rb +2 -2
- data/test/start_stop_test.rb +2 -2
- data/test/test_helper.rb +81 -0
- data/test/test_suite.rb +34 -29
- data/test/thread_test.rb +24 -23
- data/test/unique_call_path_test.rb +2 -2
- metadata +101 -69
- data/ext/ruby_prof/measure_allocations.h +0 -83
- data/ext/ruby_prof/measure_cpu_time.h +0 -152
- data/ext/ruby_prof/measure_gc_runs.h +0 -76
- data/ext/ruby_prof/measure_gc_time.h +0 -57
- data/ext/ruby_prof/measure_memory.h +0 -101
- data/ext/ruby_prof/measure_process_time.h +0 -63
- data/ext/ruby_prof/measure_wall_time.h +0 -53
- data/ext/ruby_prof/mingw/Rakefile +0 -23
- data/ext/ruby_prof/mingw/build.rake +0 -38
- data/rails/environment/profile.rb +0 -24
- data/rails/example/example_test.rb +0 -9
- data/rails/profile_test_helper.rb +0 -21
- data/test/current_failures_windows +0 -8
- data/test/measurement_test.rb +0 -132
- data/test/ruby-prof-bin +0 -20
data/test/module_test.rb
CHANGED
data/test/multi_printer_test.rb
CHANGED
data/test/prime_test.rb
CHANGED
data/test/printers_test.rb
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
require File.
|
|
2
|
+
# encoding: UTF-8
|
|
3
|
+
|
|
4
|
+
require File.expand_path('../test_helper', __FILE__)
|
|
5
5
|
require 'stringio'
|
|
6
6
|
require 'fileutils'
|
|
7
|
-
require 'rubygems'
|
|
8
7
|
|
|
9
8
|
# -- Tests ----
|
|
10
9
|
class PrintersTest < Test::Unit::TestCase
|
|
@@ -45,12 +44,12 @@ class PrintersTest < Test::Unit::TestCase
|
|
|
45
44
|
printer = RubyProf::CallTreePrinter.new(@result)
|
|
46
45
|
printer.print(output)
|
|
47
46
|
output_dir = 'examples2'
|
|
48
|
-
|
|
47
|
+
|
|
49
48
|
if ENV['SAVE_NEW_PRINTER_EXAMPLES']
|
|
50
49
|
output_dir = 'examples'
|
|
51
50
|
end
|
|
52
51
|
FileUtils.mkdir_p output_dir
|
|
53
|
-
|
|
52
|
+
|
|
54
53
|
printer = RubyProf::DotPrinter.new(@result)
|
|
55
54
|
File.open("#{output_dir}/graph.dot", "w") {|f| printer.print(f)}
|
|
56
55
|
|
|
@@ -135,7 +134,6 @@ class PrintersTest < Test::Unit::TestCase
|
|
|
135
134
|
end
|
|
136
135
|
|
|
137
136
|
def test_all_with_small_percentiles
|
|
138
|
-
|
|
139
137
|
result = RubyProf.profile do
|
|
140
138
|
sleep 2
|
|
141
139
|
do_nothing
|
|
@@ -147,12 +145,112 @@ class PrintersTest < Test::Unit::TestCase
|
|
|
147
145
|
for klass in [ RubyProf::GraphPrinter, RubyProf::GraphHtmlPrinter]
|
|
148
146
|
printer = klass.new(result)
|
|
149
147
|
out = ''
|
|
150
|
-
|
|
148
|
+
printer.print(out, :min_percent => 0.00000001 )
|
|
151
149
|
assert_match(/do_nothing/, out)
|
|
152
150
|
end
|
|
153
151
|
|
|
154
152
|
end
|
|
155
153
|
|
|
154
|
+
def test_flat_result_sorting_by_self_time_is_default
|
|
155
|
+
printer = RubyProf::FlatPrinter.new(@result)
|
|
156
|
+
|
|
157
|
+
printer.print(output = '')
|
|
158
|
+
self_times = flat_output_nth_column_values(output, 3)
|
|
159
|
+
|
|
160
|
+
assert_sorted self_times
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
def test_flat_result_sorting
|
|
164
|
+
printer = RubyProf::FlatPrinter.new(@result)
|
|
165
|
+
|
|
166
|
+
sort_method_with_column_number = {:total_time => 2, :self_time => 3, :wait_time => 4, :children_time => 5}
|
|
167
|
+
|
|
168
|
+
sort_method_with_column_number.each_pair do |sort_method, n|
|
|
169
|
+
printer.print(output = '', :sort_method => sort_method)
|
|
170
|
+
times = flat_output_nth_column_values(output, n)
|
|
171
|
+
assert_sorted times
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
def test_flat_result_with_line_numbers_sorting_by_self_time_is_default
|
|
176
|
+
printer = RubyProf::FlatPrinterWithLineNumbers.new(@result)
|
|
177
|
+
|
|
178
|
+
printer.print(output = '')
|
|
179
|
+
self_times = flat_output_nth_column_values(output, 3)
|
|
180
|
+
|
|
181
|
+
assert_sorted self_times
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
def test_flat_with_line_numbers_result_sorting
|
|
185
|
+
printer = RubyProf::FlatPrinterWithLineNumbers.new(@result)
|
|
186
|
+
|
|
187
|
+
sort_method_with_column_number = {:total_time => 2, :self_time => 3, :wait_time => 4, :children_time => 5}
|
|
188
|
+
|
|
189
|
+
sort_method_with_column_number.each_pair do |sort_method, n|
|
|
190
|
+
printer.print(output = '', :sort_method => sort_method)
|
|
191
|
+
times = flat_output_nth_column_values(output, n)
|
|
192
|
+
assert_sorted times
|
|
193
|
+
end
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
def test_graph_result_sorting_by_total_time_is_default
|
|
197
|
+
printer = RubyProf::GraphPrinter.new(@result)
|
|
198
|
+
printer.print(output = '')
|
|
199
|
+
total_times = graph_output_nth_column_values(output, 3)
|
|
156
200
|
|
|
201
|
+
assert_sorted total_times
|
|
202
|
+
end
|
|
157
203
|
|
|
204
|
+
def test_graph_results_sorting
|
|
205
|
+
printer = RubyProf::GraphPrinter.new(@result)
|
|
206
|
+
|
|
207
|
+
sort_method_with_column_number = {:total_time => 3, :self_time => 4, :wait_time => 5, :children_time => 6}
|
|
208
|
+
|
|
209
|
+
sort_method_with_column_number.each_pair do |sort_method, n|
|
|
210
|
+
printer.print(output = '', :sort_method => sort_method)
|
|
211
|
+
times = graph_output_nth_column_values(output, n)
|
|
212
|
+
assert_sorted times
|
|
213
|
+
end
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
def test_graph_html_result_sorting_by_total_time_is_default
|
|
217
|
+
printer = RubyProf::GraphHtmlPrinter.new(@result)
|
|
218
|
+
printer.print(output = '')
|
|
219
|
+
total_times = graph_html_output_nth_column_values(output, 3)
|
|
220
|
+
|
|
221
|
+
assert_sorted total_times
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
def test_graph_html_result_sorting
|
|
225
|
+
printer = RubyProf::GraphHtmlPrinter.new(@result)
|
|
226
|
+
|
|
227
|
+
sort_method_with_column_number = {:total_time => 3, :self_time => 4, :wait_time => 5, :children_time => 6}
|
|
228
|
+
|
|
229
|
+
sort_method_with_column_number.each_pair do |sort_method, n|
|
|
230
|
+
printer.print(output = '', :sort_method => sort_method)
|
|
231
|
+
times = graph_html_output_nth_column_values(output, n)
|
|
232
|
+
assert_sorted times
|
|
233
|
+
end
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
private
|
|
237
|
+
def flat_output_nth_column_values(output, n)
|
|
238
|
+
only_method_calls = output.split("\n").select { |line| line =~ /^ +\d+/ }
|
|
239
|
+
only_method_calls.collect { |line| line.split(/ +/)[n] }
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
def graph_output_nth_column_values(output, n)
|
|
243
|
+
only_root_calls = output.split("\n").select { |line| line =~ /^ +[\d\.]+%/ }
|
|
244
|
+
only_root_calls.collect { |line| line.split(/ +/)[n] }
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
def graph_html_output_nth_column_values(output, n)
|
|
248
|
+
only_root_calls = output.split('<tr class="method">')
|
|
249
|
+
only_root_calls.delete_at(0)
|
|
250
|
+
only_root_calls.collect {|line| line.scan(/[\d\.]+/)[n - 1] }
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
def assert_sorted array
|
|
254
|
+
assert_equal array, array.sort.reverse, "Array #{array.inspect} is not sorted"
|
|
255
|
+
end
|
|
158
256
|
end
|
data/test/recursive_test.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
# encoding: UTF-8
|
|
3
|
+
|
|
4
|
+
require File.expand_path('../test_helper', __FILE__)
|
|
4
5
|
|
|
5
6
|
def simple(n)
|
|
6
7
|
sleep(1)
|
|
@@ -57,10 +58,10 @@ class RecursiveTest < Test::Unit::TestCase
|
|
|
57
58
|
method = methods[1]
|
|
58
59
|
assert_equal('Object#simple', method.full_name)
|
|
59
60
|
assert_equal(2, method.called)
|
|
60
|
-
assert_in_delta(2, method.total_time, 0.
|
|
61
|
-
assert_in_delta(0, method.self_time, 0.
|
|
62
|
-
assert_in_delta(0, method.wait_time, 0.
|
|
63
|
-
assert_in_delta(2, method.children_time, 0.
|
|
61
|
+
assert_in_delta(2, method.total_time, 0.05)
|
|
62
|
+
assert_in_delta(0, method.self_time, 0.05)
|
|
63
|
+
assert_in_delta(0, method.wait_time, 0.05)
|
|
64
|
+
assert_in_delta(2, method.children_time, 0.05)
|
|
64
65
|
|
|
65
66
|
assert_equal(2, method.call_infos.length)
|
|
66
67
|
call_info = method.call_infos[0]
|
data/test/singleton_test.rb
CHANGED
data/test/stack_printer_test.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
|
+
# encoding: UTF-8
|
|
2
3
|
|
|
3
|
-
require '
|
|
4
|
-
require 'ruby-prof'
|
|
4
|
+
require File.expand_path('../test_helper', __FILE__)
|
|
5
5
|
require 'tmpdir'
|
|
6
6
|
|
|
7
7
|
# Test data
|
|
@@ -45,7 +45,6 @@ class StackPrinterTest < Test::Unit::TestCase
|
|
|
45
45
|
assert_nothing_raised { file_contents = print(result) }
|
|
46
46
|
assert file_contents =~ /Thread: (\d+) \(100\.00% ~ ([.0-9]+)\)/
|
|
47
47
|
actual_time = $2.to_f
|
|
48
|
-
difference = (expected_time-actual_time).abs
|
|
49
48
|
assert_in_delta(expected_time, actual_time, 0.01)
|
|
50
49
|
end
|
|
51
50
|
|
data/test/stack_test.rb
CHANGED
data/test/start_stop_test.rb
CHANGED
data/test/test_helper.rb
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
|
|
3
|
+
# Make RubyMine happy
|
|
4
|
+
if ENV["RM_INFO"] || ENV["TEAMCITY_VERSION"]
|
|
5
|
+
gem 'win32console'
|
|
6
|
+
gem 'minitest-reporters'
|
|
7
|
+
require 'minitest/reporters'
|
|
8
|
+
MiniTest::Unit.runner = MiniTest::SuiteRunner.new
|
|
9
|
+
MiniTest::Unit.runner.reporters << MiniTest::Reporters::RubyMineReporter.new
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# To make testing/debugging easier, test within this source tree versus an installed gem
|
|
13
|
+
|
|
14
|
+
dir = File.dirname(__FILE__)
|
|
15
|
+
root = File.expand_path(File.join(dir, '..'))
|
|
16
|
+
lib = File.expand_path(File.join(root, 'lib'))
|
|
17
|
+
ext = File.expand_path(File.join(root, 'ext', 'ruby_prof'))
|
|
18
|
+
|
|
19
|
+
$LOAD_PATH << lib
|
|
20
|
+
$LOAD_PATH << ext
|
|
21
|
+
|
|
22
|
+
require 'ruby-prof'
|
|
23
|
+
require 'test/unit'
|
|
24
|
+
require File.expand_path('../prime', __FILE__)
|
|
25
|
+
|
|
26
|
+
# Some classes used in measurement tests
|
|
27
|
+
module RubyProf
|
|
28
|
+
class C1
|
|
29
|
+
def C1.hello
|
|
30
|
+
sleep(0.1)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def hello
|
|
34
|
+
sleep(0.2)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
module M1
|
|
39
|
+
def hello
|
|
40
|
+
sleep(0.3)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
class C2
|
|
45
|
+
include M1
|
|
46
|
+
extend M1
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
class C3
|
|
50
|
+
def hello
|
|
51
|
+
sleep(0.4)
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
module M4
|
|
56
|
+
def hello
|
|
57
|
+
sleep(0.5)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
module M5
|
|
62
|
+
include M4
|
|
63
|
+
def goodbye
|
|
64
|
+
hello
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
class C6
|
|
69
|
+
include M5
|
|
70
|
+
def test
|
|
71
|
+
goodbye
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
if RUBY_VERSION < '1.9'
|
|
76
|
+
PARENT = Object
|
|
77
|
+
else
|
|
78
|
+
PARENT = BasicObject
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
end
|
data/test/test_suite.rb
CHANGED
|
@@ -1,32 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
rescue LoadError
|
|
5
|
-
end
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
require File.expand_path("../test_helper", __FILE__)
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
%w(aggregate_test
|
|
6
|
+
basic_test
|
|
7
|
+
duplicate_names_test
|
|
8
|
+
dynamic_method_test
|
|
9
|
+
enumerable_test
|
|
10
|
+
exceptions_test
|
|
11
|
+
exclude_threads_test
|
|
12
|
+
line_number_test
|
|
8
13
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
14
|
+
measure_allocations_test
|
|
15
|
+
measure_cpu_time_test
|
|
16
|
+
measure_gc_runs_test
|
|
17
|
+
measure_gc_time_test
|
|
18
|
+
measure_memory_test
|
|
19
|
+
measure_process_time_test
|
|
20
|
+
measure_wall_time_test
|
|
21
|
+
|
|
22
|
+
method_elimination_test
|
|
23
|
+
module_test
|
|
24
|
+
multi_printer_test
|
|
25
|
+
no_method_class_test
|
|
26
|
+
prime_test
|
|
27
|
+
printers_test
|
|
28
|
+
recursive_test
|
|
29
|
+
singleton_test
|
|
30
|
+
stack_test
|
|
31
|
+
stack_printer_test
|
|
32
|
+
start_stop_test
|
|
33
|
+
thread_test
|
|
34
|
+
unique_call_path_test).each do |test|
|
|
35
|
+
require File.expand_path("../#{test}", __FILE__)
|
|
36
|
+
end
|
|
28
37
|
|
|
29
|
-
# Can't use this one here cause it breaks
|
|
30
|
-
# the rest of the unit tets (Ruby Prof gets
|
|
31
|
-
# started twice).
|
|
32
|
-
#require 'profile_unit_test'
|
data/test/thread_test.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
# encoding: UTF-8
|
|
3
|
+
|
|
4
|
+
require File.expand_path('../test_helper', __FILE__)
|
|
4
5
|
require 'timeout'
|
|
5
6
|
|
|
6
7
|
# -- Tests ----
|
|
@@ -65,9 +66,9 @@ class ThreadTest < Test::Unit::TestCase
|
|
|
65
66
|
assert_equal('ThreadTest#test_thread_timings', method.full_name)
|
|
66
67
|
assert_equal(1, method.called)
|
|
67
68
|
assert_in_delta(1, method.total_time, 0.05)
|
|
68
|
-
assert_in_delta(0, method.self_time, 0.
|
|
69
|
-
assert_in_delta(0, method.wait_time, 0.
|
|
70
|
-
assert_in_delta(1, method.children_time, 0.
|
|
69
|
+
assert_in_delta(0, method.self_time, 0.05)
|
|
70
|
+
assert_in_delta(0, method.wait_time, 0.05)
|
|
71
|
+
assert_in_delta(1, method.children_time, 0.05)
|
|
71
72
|
assert_equal(1, method.call_infos.length)
|
|
72
73
|
call_info = method.call_infos[0]
|
|
73
74
|
assert_equal('ThreadTest#test_thread_timings', call_info.call_sequence)
|
|
@@ -76,10 +77,10 @@ class ThreadTest < Test::Unit::TestCase
|
|
|
76
77
|
method = methods[1]
|
|
77
78
|
assert_equal('Kernel#sleep', method.full_name)
|
|
78
79
|
assert_equal(2, method.called)
|
|
79
|
-
assert_in_delta(1, method.total_time, 0.
|
|
80
|
-
assert_in_delta(1.0, method.self_time, 0.
|
|
81
|
-
assert_in_delta(0, method.wait_time, 0.
|
|
82
|
-
assert_in_delta(0, method.children_time, 0.
|
|
80
|
+
assert_in_delta(1, method.total_time, 0.05)
|
|
81
|
+
assert_in_delta(1.0, method.self_time, 0.05)
|
|
82
|
+
assert_in_delta(0, method.wait_time, 0.05)
|
|
83
|
+
assert_in_delta(0, method.children_time, 0.05)
|
|
83
84
|
|
|
84
85
|
assert_equal(1, method.call_infos.length)
|
|
85
86
|
call_info = method.call_infos[0]
|
|
@@ -97,10 +98,10 @@ class ThreadTest < Test::Unit::TestCase
|
|
|
97
98
|
# cause the parent frame to be created for method #test_thread_timings, which means a +1 when it's popped in the end
|
|
98
99
|
# xxxx a test that shows it the other way, too (never creates parent frame--if that's even possible)
|
|
99
100
|
assert_equal(1, method.called)
|
|
100
|
-
assert_in_delta(1, method.total_time, 0.
|
|
101
|
+
assert_in_delta(1, method.total_time, 0.05)
|
|
101
102
|
assert_in_delta(0, method.self_time, 0.05)
|
|
102
103
|
assert_in_delta(0, method.wait_time, 0.05)
|
|
103
|
-
assert_in_delta(1, method.children_time, 0.
|
|
104
|
+
assert_in_delta(1, method.children_time, 0.05)
|
|
104
105
|
|
|
105
106
|
assert_equal(1, method.call_infos.length)
|
|
106
107
|
call_info = method.call_infos[0]
|
|
@@ -110,10 +111,10 @@ class ThreadTest < Test::Unit::TestCase
|
|
|
110
111
|
method = methods[1]
|
|
111
112
|
assert_equal('Thread#join', method.full_name)
|
|
112
113
|
assert_equal(1, method.called)
|
|
113
|
-
assert_in_delta(1, method.total_time, 0.
|
|
114
|
-
assert_in_delta(0, method.self_time, 0.
|
|
115
|
-
assert_in_delta(1.0, method.wait_time, 0.
|
|
116
|
-
assert_in_delta(0, method.children_time, 0.
|
|
114
|
+
assert_in_delta(1, method.total_time, 0.05)
|
|
115
|
+
assert_in_delta(0, method.self_time, 0.05)
|
|
116
|
+
assert_in_delta(1.0, method.wait_time, 0.05)
|
|
117
|
+
assert_in_delta(0, method.children_time, 0.05)
|
|
117
118
|
|
|
118
119
|
assert_equal(1, method.call_infos.length)
|
|
119
120
|
call_info = method.call_infos[0]
|
|
@@ -123,10 +124,10 @@ class ThreadTest < Test::Unit::TestCase
|
|
|
123
124
|
method = methods[2]
|
|
124
125
|
assert_equal('<Class::Thread>#new', method.full_name)
|
|
125
126
|
assert_equal(1, method.called)
|
|
126
|
-
assert_in_delta(0, method.total_time, 0.
|
|
127
|
-
assert_in_delta(0, method.self_time, 0.
|
|
128
|
-
assert_in_delta(0, method.wait_time, 0.
|
|
129
|
-
assert_in_delta(0, method.children_time, 0.
|
|
127
|
+
assert_in_delta(0, method.total_time, 0.05)
|
|
128
|
+
assert_in_delta(0, method.self_time, 0.05)
|
|
129
|
+
assert_in_delta(0, method.wait_time, 0.05)
|
|
130
|
+
assert_in_delta(0, method.children_time, 0.05)
|
|
130
131
|
|
|
131
132
|
assert_equal(1, method.call_infos.length)
|
|
132
133
|
call_info = method.call_infos[0]
|
|
@@ -136,10 +137,10 @@ class ThreadTest < Test::Unit::TestCase
|
|
|
136
137
|
method = methods[3]
|
|
137
138
|
assert_equal('Thread#initialize', method.full_name)
|
|
138
139
|
assert_equal(1, method.called)
|
|
139
|
-
assert_in_delta(0, method.total_time, 0.
|
|
140
|
-
assert_in_delta(0, method.self_time, 0.
|
|
141
|
-
assert_in_delta(0, method.wait_time, 0.
|
|
142
|
-
assert_in_delta(0, method.children_time, 0.
|
|
140
|
+
assert_in_delta(0, method.total_time, 0.05)
|
|
141
|
+
assert_in_delta(0, method.self_time, 0.05)
|
|
142
|
+
assert_in_delta(0, method.wait_time, 0.05)
|
|
143
|
+
assert_in_delta(0, method.children_time, 0.05)
|
|
143
144
|
|
|
144
145
|
assert_equal(1, method.call_infos.length)
|
|
145
146
|
call_info = method.call_infos[0]
|