ruby-prof 1.7.2 → 2.0.1

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.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/{CHANGES → CHANGELOG.md} +115 -178
  3. data/README.md +5 -5
  4. data/bin/ruby-prof +1 -4
  5. data/bin/ruby-prof-check-trace +45 -45
  6. data/docs/advanced-usage.md +132 -0
  7. data/docs/alternatives.md +98 -0
  8. data/docs/architecture.md +122 -0
  9. data/docs/best-practices.md +27 -0
  10. data/docs/getting-started.md +130 -0
  11. data/docs/history.md +11 -0
  12. data/docs/index.md +45 -0
  13. data/docs/profiling-rails.md +64 -0
  14. data/docs/public/examples/example.rb +33 -0
  15. data/docs/public/examples/generate_reports.rb +92 -0
  16. data/docs/public/examples/reports/call_info.txt +27 -0
  17. data/docs/public/examples/reports/call_stack.html +835 -0
  18. data/docs/public/examples/reports/callgrind.out +150 -0
  19. data/docs/public/examples/reports/flame_graph.html +408 -0
  20. data/docs/public/examples/reports/flat.txt +45 -0
  21. data/docs/public/examples/reports/graph.dot +129 -0
  22. data/docs/public/examples/reports/graph.html +1319 -0
  23. data/docs/public/examples/reports/graph.txt +100 -0
  24. data/docs/public/examples/reports/graphviz_viewer.html +1 -0
  25. data/docs/public/images/call_stack.png +0 -0
  26. data/docs/public/images/class_diagram.png +0 -0
  27. data/docs/public/images/dot_printer.png +0 -0
  28. data/docs/public/images/flame_graph.png +0 -0
  29. data/docs/public/images/flat.png +0 -0
  30. data/docs/public/images/graph.png +0 -0
  31. data/docs/public/images/graph_html.png +0 -0
  32. data/docs/public/images/ruby-prof-logo.svg +1 -0
  33. data/docs/reports.md +150 -0
  34. data/docs/stylesheets/extra.css +80 -0
  35. data/ext/ruby_prof/rp_allocation.c +0 -15
  36. data/ext/ruby_prof/rp_allocation.h +29 -33
  37. data/ext/ruby_prof/rp_call_tree.c +3 -0
  38. data/ext/ruby_prof/rp_call_tree.h +1 -4
  39. data/ext/ruby_prof/rp_call_trees.h +1 -4
  40. data/ext/ruby_prof/rp_measurement.c +0 -5
  41. data/ext/ruby_prof/rp_measurement.h +49 -53
  42. data/ext/ruby_prof/rp_method.c +3 -0
  43. data/ext/ruby_prof/rp_method.h +1 -4
  44. data/ext/ruby_prof/rp_profile.c +1 -1
  45. data/ext/ruby_prof/rp_profile.h +1 -5
  46. data/ext/ruby_prof/rp_stack.h +50 -53
  47. data/ext/ruby_prof/rp_thread.h +1 -4
  48. data/ext/ruby_prof/ruby_prof.h +1 -4
  49. data/ext/ruby_prof/vc/ruby_prof.vcxproj +7 -8
  50. data/lib/ruby-prof/assets/call_stack_printer.html.erb +746 -711
  51. data/lib/ruby-prof/assets/flame_graph_printer.html.erb +412 -0
  52. data/lib/ruby-prof/assets/graph_printer.html.erb +355 -355
  53. data/lib/ruby-prof/call_tree.rb +57 -57
  54. data/lib/ruby-prof/call_tree_visitor.rb +36 -36
  55. data/lib/ruby-prof/measurement.rb +17 -17
  56. data/lib/ruby-prof/printers/abstract_printer.rb +19 -33
  57. data/lib/ruby-prof/printers/call_info_printer.rb +53 -53
  58. data/lib/ruby-prof/printers/call_stack_printer.rb +168 -180
  59. data/lib/ruby-prof/printers/call_tree_printer.rb +132 -145
  60. data/lib/ruby-prof/printers/dot_printer.rb +177 -132
  61. data/lib/ruby-prof/printers/flame_graph_printer.rb +79 -0
  62. data/lib/ruby-prof/printers/flat_printer.rb +52 -52
  63. data/lib/ruby-prof/printers/graph_html_printer.rb +62 -63
  64. data/lib/ruby-prof/printers/graph_printer.rb +112 -113
  65. data/lib/ruby-prof/printers/multi_printer.rb +134 -127
  66. data/lib/ruby-prof/profile.rb +13 -0
  67. data/lib/ruby-prof/rack.rb +114 -105
  68. data/lib/ruby-prof/task.rb +147 -147
  69. data/lib/ruby-prof/thread.rb +20 -20
  70. data/lib/ruby-prof/version.rb +1 -1
  71. data/lib/ruby-prof.rb +50 -52
  72. data/lib/unprof.rb +10 -10
  73. data/ruby-prof.gemspec +66 -66
  74. data/test/abstract_printer_test.rb +25 -27
  75. data/test/alias_test.rb +203 -117
  76. data/test/call_tree_builder.rb +9 -9
  77. data/test/call_tree_visitor_test.rb +27 -27
  78. data/test/call_trees_test.rb +66 -66
  79. data/test/duplicate_names_test.rb +32 -32
  80. data/test/dynamic_method_test.rb +50 -50
  81. data/test/exceptions_test.rb +1 -1
  82. data/test/exclude_threads_test.rb +48 -48
  83. data/test/fiber_test.rb +72 -72
  84. data/test/inverse_call_tree_test.rb +174 -174
  85. data/test/line_number_test.rb +138 -1
  86. data/test/marshal_test.rb +2 -3
  87. data/test/measure_allocations.rb +26 -26
  88. data/test/measure_allocations_test.rb +340 -1
  89. data/test/measure_process_time_test.rb +3098 -3142
  90. data/test/measure_times.rb +56 -56
  91. data/test/measure_wall_time_test.rb +511 -372
  92. data/test/measurement_test.rb +82 -82
  93. data/test/merge_test.rb +48 -48
  94. data/test/multi_printer_test.rb +52 -66
  95. data/test/no_method_class_test.rb +15 -15
  96. data/test/pause_resume_test.rb +171 -171
  97. data/test/prime.rb +54 -54
  98. data/test/prime_script.rb +5 -5
  99. data/test/printer_call_stack_test.rb +4 -3
  100. data/test/printer_call_tree_test.rb +30 -30
  101. data/test/printer_flame_graph_test.rb +82 -0
  102. data/test/printer_flat_test.rb +3 -3
  103. data/test/printer_graph_html_test.rb +12 -9
  104. data/test/printer_graph_test.rb +5 -3
  105. data/test/printers_test.rb +162 -178
  106. data/test/printing_recursive_graph_test.rb +4 -4
  107. data/test/profile_test.rb +2 -2
  108. data/test/rack_test.rb +15 -5
  109. data/test/recursive_test.rb +139 -139
  110. data/test/scheduler.rb +367 -363
  111. data/test/singleton_test.rb +2 -1
  112. data/test/stack_printer_test.rb +61 -61
  113. data/test/start_stop_test.rb +106 -106
  114. data/test/test_helper.rb +4 -0
  115. data/test/thread_test.rb +229 -229
  116. data/test/unique_call_path_test.rb +123 -123
  117. data/test/yarv_test.rb +2 -2
  118. metadata +53 -11
  119. data/ext/ruby_prof/rp_measure_memory.c +0 -46
  120. data/lib/ruby-prof/compatibility.rb +0 -113
  121. data/test/compatibility_test.rb +0 -49
  122. data/test/measure_memory_test.rb +0 -1193
@@ -1,66 +1,66 @@
1
- #!/usr/bin/env ruby
2
- # encoding: UTF-8
3
-
4
- require File.expand_path('../test_helper', __FILE__)
5
-
6
- # -- Tests ----
7
- class CallTreesTest < TestCase
8
- def some_method_1
9
- some_method_2
10
- end
11
-
12
- def some_method_2
13
- end
14
-
15
- def test_call_infos
16
- result = RubyProf::Profile.profile do
17
- some_method_1
18
- end
19
-
20
- thread = result.threads.first
21
- assert_equal(3, thread.methods.length)
22
-
23
- method = thread.methods[0]
24
- assert_equal('CallTreesTest#test_call_infos', method.full_name)
25
-
26
- call_trees = method.call_trees
27
- assert_empty(call_trees.callers)
28
- assert_equal(1, call_trees.callees.length)
29
- assert_kind_of(RubyProf::CallTree, call_trees.callees[0])
30
- assert_equal('CallTreesTest#some_method_1', call_trees.callees[0].target.full_name)
31
-
32
- method = thread.methods[1]
33
- assert_equal('CallTreesTest#some_method_1', method.full_name)
34
-
35
- call_trees = method.call_trees
36
- assert_equal(1, call_trees.callers.length)
37
- assert_kind_of(RubyProf::CallTree, call_trees.callers[0])
38
- assert_equal('CallTreesTest#test_call_infos', call_trees.callers[0].parent.target.full_name)
39
- assert_equal(1, call_trees.callees.length)
40
- assert_kind_of(RubyProf::CallTree, call_trees.callees[0])
41
- assert_equal('CallTreesTest#some_method_2', call_trees.callees[0].target.full_name)
42
-
43
- method = thread.methods[2]
44
- assert_equal('CallTreesTest#some_method_2', method.full_name)
45
-
46
- call_trees = method.call_trees
47
- assert_equal(1, call_trees.callers.length)
48
- assert_kind_of(RubyProf::CallTree, call_trees.callers[0])
49
- assert_equal('CallTreesTest#some_method_1', call_trees.callers[0].parent.target.full_name)
50
- assert_empty(call_trees.callees)
51
- end
52
-
53
- def test_gc
54
- result = RubyProf::Profile.profile do
55
- some_method_1
56
- end
57
-
58
- method = result.threads.first.methods[1]
59
-
60
- 100.times do |i|
61
- method.call_trees.callers
62
- GC.start
63
- end
64
- assert(true)
65
- end
66
- end
1
+ #!/usr/bin/env ruby
2
+ # encoding: UTF-8
3
+
4
+ require File.expand_path('../test_helper', __FILE__)
5
+
6
+ # -- Tests ----
7
+ class CallTreesTest < TestCase
8
+ def some_method_1
9
+ some_method_2
10
+ end
11
+
12
+ def some_method_2
13
+ end
14
+
15
+ def test_call_infos
16
+ result = RubyProf::Profile.profile do
17
+ some_method_1
18
+ end
19
+
20
+ thread = result.threads.first
21
+ assert_equal(3, thread.methods.length)
22
+
23
+ method = thread.methods[0]
24
+ assert_equal('CallTreesTest#test_call_infos', method.full_name)
25
+
26
+ call_trees = method.call_trees
27
+ assert_empty(call_trees.callers)
28
+ assert_equal(1, call_trees.callees.length)
29
+ assert_kind_of(RubyProf::CallTree, call_trees.callees[0])
30
+ assert_equal('CallTreesTest#some_method_1', call_trees.callees[0].target.full_name)
31
+
32
+ method = thread.methods[1]
33
+ assert_equal('CallTreesTest#some_method_1', method.full_name)
34
+
35
+ call_trees = method.call_trees
36
+ assert_equal(1, call_trees.callers.length)
37
+ assert_kind_of(RubyProf::CallTree, call_trees.callers[0])
38
+ assert_equal('CallTreesTest#test_call_infos', call_trees.callers[0].parent.target.full_name)
39
+ assert_equal(1, call_trees.callees.length)
40
+ assert_kind_of(RubyProf::CallTree, call_trees.callees[0])
41
+ assert_equal('CallTreesTest#some_method_2', call_trees.callees[0].target.full_name)
42
+
43
+ method = thread.methods[2]
44
+ assert_equal('CallTreesTest#some_method_2', method.full_name)
45
+
46
+ call_trees = method.call_trees
47
+ assert_equal(1, call_trees.callers.length)
48
+ assert_kind_of(RubyProf::CallTree, call_trees.callers[0])
49
+ assert_equal('CallTreesTest#some_method_1', call_trees.callers[0].parent.target.full_name)
50
+ assert_empty(call_trees.callees)
51
+ end
52
+
53
+ def test_gc
54
+ result = RubyProf::Profile.profile do
55
+ some_method_1
56
+ end
57
+
58
+ method = result.threads.first.methods[1]
59
+
60
+ 100.times do |i|
61
+ method.call_trees.callers
62
+ GC.start
63
+ end
64
+ assert(true)
65
+ end
66
+ end
@@ -1,32 +1,32 @@
1
- #!/usr/bin/env ruby
2
- # encoding: UTF-8
3
-
4
- require File.expand_path('../test_helper', __FILE__)
5
-
6
- class DuplicateNamesTest < TestCase
7
- def test_names
8
- result = RubyProf::Profile.profile do
9
- str = %{module Foo; class Bar; def foo; end end end}
10
-
11
- eval str
12
- Foo::Bar.new.foo
13
- DuplicateNamesTest.class_eval {remove_const :Foo}
14
-
15
- eval str
16
- Foo::Bar.new.foo
17
- DuplicateNamesTest.class_eval {remove_const :Foo}
18
-
19
- eval str
20
- Foo::Bar.new.foo
21
- end
22
-
23
- # There should be 3 foo methods
24
- methods = result.threads.first.methods.sort.reverse
25
-
26
- methods = methods.select do |method|
27
- method.full_name == 'DuplicateNamesTest::Foo::Bar#foo'
28
- end
29
-
30
- assert_equal(3, methods.length)
31
- end
32
- end
1
+ #!/usr/bin/env ruby
2
+ # encoding: UTF-8
3
+
4
+ require File.expand_path('../test_helper', __FILE__)
5
+
6
+ class DuplicateNamesTest < TestCase
7
+ def test_names
8
+ result = RubyProf::Profile.profile do
9
+ str = %{module Foo; class Bar; def foo; end end end}
10
+
11
+ eval str
12
+ Foo::Bar.new.foo
13
+ DuplicateNamesTest.class_eval {remove_const :Foo}
14
+
15
+ eval str
16
+ Foo::Bar.new.foo
17
+ DuplicateNamesTest.class_eval {remove_const :Foo}
18
+
19
+ eval str
20
+ Foo::Bar.new.foo
21
+ end
22
+
23
+ # There should be 3 foo methods
24
+ methods = result.threads.first.methods.sort.reverse
25
+
26
+ methods = methods.select do |method|
27
+ method.full_name == 'DuplicateNamesTest::Foo::Bar#foo'
28
+ end
29
+
30
+ assert_equal(3, methods.length)
31
+ end
32
+ end
@@ -1,50 +1,50 @@
1
- #!/usr/bin/env ruby
2
- # encoding: UTF-8
3
-
4
- require File.expand_path("../test_helper", __FILE__)
5
-
6
- class DynamicMethodTest < TestCase
7
-
8
- class FruitMedley
9
- define_method(:apple) do
10
- sleep(0.1)
11
- "I'm a peach"
12
- end
13
-
14
- define_method(:orange) do
15
- sleep(0.2)
16
- "I'm an orange"
17
- end
18
-
19
- [:banana, :peach].each_with_index do |fruit,i|
20
- define_method(fruit) do
21
- sleep(i == 0 ? 0.3 : 0.4)
22
- "I'm a #{fruit}"
23
- end
24
- end
25
- end
26
-
27
- def test_dynamic_method
28
- medley = FruitMedley.new
29
- result = RubyProf::Profile.profile(measure_mode: RubyProf::WALL_TIME) do
30
- medley.apple
31
- medley.orange
32
- medley.banana
33
- medley.peach
34
- end
35
-
36
- methods = result.threads.first.methods.sort.reverse
37
-
38
- expected_method_names = %w(
39
- DynamicMethodTest#test_dynamic_method
40
- Kernel#sleep
41
- DynamicMethodTest::FruitMedley#peach
42
- DynamicMethodTest::FruitMedley#banana
43
- DynamicMethodTest::FruitMedley#orange
44
- DynamicMethodTest::FruitMedley#apple
45
- Integer#==
46
- )
47
-
48
- assert_equal expected_method_names.join("\n"), methods.map(&:full_name).join("\n")
49
- end
50
- end
1
+ #!/usr/bin/env ruby
2
+ # encoding: UTF-8
3
+
4
+ require File.expand_path("../test_helper", __FILE__)
5
+
6
+ class DynamicMethodTest < TestCase
7
+
8
+ class FruitMedley
9
+ define_method(:apple) do
10
+ sleep(0.1)
11
+ "I'm a peach"
12
+ end
13
+
14
+ define_method(:orange) do
15
+ sleep(0.2)
16
+ "I'm an orange"
17
+ end
18
+
19
+ [:banana, :peach].each_with_index do |fruit,i|
20
+ define_method(fruit) do
21
+ sleep(i == 0 ? 0.3 : 0.4)
22
+ "I'm a #{fruit}"
23
+ end
24
+ end
25
+ end
26
+
27
+ def test_dynamic_method
28
+ medley = FruitMedley.new
29
+ result = RubyProf::Profile.profile(measure_mode: RubyProf::WALL_TIME) do
30
+ medley.apple
31
+ medley.orange
32
+ medley.banana
33
+ medley.peach
34
+ end
35
+
36
+ methods = result.threads.first.methods.sort.reverse
37
+
38
+ expected_method_names = %w(
39
+ DynamicMethodTest#test_dynamic_method
40
+ Kernel#sleep
41
+ DynamicMethodTest::FruitMedley#peach
42
+ DynamicMethodTest::FruitMedley#banana
43
+ DynamicMethodTest::FruitMedley#orange
44
+ DynamicMethodTest::FruitMedley#apple
45
+ Integer#==
46
+ )
47
+
48
+ assert_equal expected_method_names.join("\n"), methods.map(&:full_name).join("\n")
49
+ end
50
+ end
@@ -16,7 +16,7 @@ class ExceptionsTest < TestCase
16
16
 
17
17
  def test_profile_allows_exceptions
18
18
  assert_raises(RuntimeError) do
19
- RubyProf::Profile.profile(:allow_exceptions => true) do
19
+ RubyProf::Profile.profile(allow_exceptions: true) do
20
20
  raise(RuntimeError, 'Test error')
21
21
  end
22
22
  end
@@ -1,48 +1,48 @@
1
- #!/usr/bin/env ruby
2
- # encoding: UTF-8
3
-
4
- require File.expand_path('../test_helper', __FILE__)
5
-
6
-
7
- # -- Tests ----
8
- class ExcludeThreadsTest < TestCase
9
- def test_exclude_threads
10
-
11
- def thread1_proc
12
- sleep(0.5)
13
- sleep(2)
14
- end
15
-
16
- def thread2_proc
17
- sleep(0.5)
18
- sleep(2)
19
- end
20
-
21
- thread1 = Thread.new do
22
- thread1_proc
23
- end
24
-
25
- thread2 = Thread.new do
26
- thread2_proc
27
- end
28
-
29
- result = RubyProf::Profile.profile(exclude_threads: [thread2]) do
30
- thread1.join
31
- thread2.join
32
- end
33
-
34
- assert_equal(2, result.threads.length)
35
-
36
- output = Array.new
37
- result.threads.each do |thread|
38
- thread.methods.each do | m |
39
- if m.full_name.index("ExcludeThreadsTest#thread") == 0
40
- output.push(m.full_name)
41
- end
42
- end
43
- end
44
-
45
- assert_equal(1, output.length)
46
- assert_equal("ExcludeThreadsTest#thread1_proc", output[0])
47
- end
48
- end
1
+ #!/usr/bin/env ruby
2
+ # encoding: UTF-8
3
+
4
+ require File.expand_path('../test_helper', __FILE__)
5
+
6
+
7
+ # -- Tests ----
8
+ class ExcludeThreadsTest < TestCase
9
+ def test_exclude_threads
10
+
11
+ def thread1_proc
12
+ sleep(0.5)
13
+ sleep(2)
14
+ end
15
+
16
+ def thread2_proc
17
+ sleep(0.5)
18
+ sleep(2)
19
+ end
20
+
21
+ thread1 = Thread.new do
22
+ thread1_proc
23
+ end
24
+
25
+ thread2 = Thread.new do
26
+ thread2_proc
27
+ end
28
+
29
+ result = RubyProf::Profile.profile(exclude_threads: [thread2]) do
30
+ thread1.join
31
+ thread2.join
32
+ end
33
+
34
+ assert_equal(2, result.threads.length)
35
+
36
+ output = Array.new
37
+ result.threads.each do |thread|
38
+ thread.methods.each do | m |
39
+ if m.full_name.index("ExcludeThreadsTest#thread") == 0
40
+ output.push(m.full_name)
41
+ end
42
+ end
43
+ end
44
+
45
+ assert_equal(1, output.length)
46
+ assert_equal("ExcludeThreadsTest#thread1_proc", output[0])
47
+ end
48
+ end
data/test/fiber_test.rb CHANGED
@@ -41,82 +41,82 @@ class FiberTest < TestCase
41
41
  method = methods[0]
42
42
  assert_equal('FiberTest#test_fibers', method.full_name)
43
43
  assert_equal(1, method.called)
44
- assert_in_delta(0, method.total_time)
45
- assert_in_delta(0, method.self_time)
46
- assert_in_delta(0, method.wait_time)
47
- assert_in_delta(0, method.children_time)
44
+ assert_in_delta(0, method.total_time, 0.001 * delta_multiplier)
45
+ assert_in_delta(0, method.self_time, 0.001 * delta_multiplier)
46
+ assert_in_delta(0, method.wait_time, 0.001 * delta_multiplier)
47
+ assert_in_delta(0, method.children_time, 0.001 * delta_multiplier)
48
48
 
49
49
  method = methods[1]
50
50
  assert_equal('FiberTest#enumerator_with_fibers', method.full_name)
51
51
  assert_equal(1, method.called)
52
- assert_in_delta(0, method.total_time)
53
- assert_in_delta(0, method.self_time)
54
- assert_in_delta(0, method.wait_time)
55
- assert_in_delta(0, method.children_time)
52
+ assert_in_delta(0, method.total_time, 0.001 * delta_multiplier)
53
+ assert_in_delta(0, method.self_time, 0.001 * delta_multiplier)
54
+ assert_in_delta(0, method.wait_time, 0.001 * delta_multiplier)
55
+ assert_in_delta(0, method.children_time, 0.001 * delta_multiplier)
56
56
 
57
57
  method = methods[2]
58
58
  assert_equal('Enumerator#next', method.full_name)
59
59
  assert_equal(2, method.called)
60
- assert_in_delta(0, method.total_time)
61
- assert_in_delta(0, method.self_time)
62
- assert_in_delta(0, method.wait_time)
63
- assert_in_delta(0, method.children_time)
60
+ assert_in_delta(0, method.total_time, 0.001 * delta_multiplier)
61
+ assert_in_delta(0, method.self_time, 0.001 * delta_multiplier)
62
+ assert_in_delta(0, method.wait_time, 0.001 * delta_multiplier)
63
+ assert_in_delta(0, method.children_time, 0.001 * delta_multiplier)
64
64
 
65
65
  method = methods[3]
66
66
  assert_equal('Class#new', method.full_name)
67
67
  assert_equal(1, method.called)
68
- assert_in_delta(0, method.total_time)
69
- assert_in_delta(0, method.self_time)
70
- assert_in_delta(0, method.wait_time)
71
- assert_in_delta(0, method.children_time)
68
+ assert_in_delta(0, method.total_time, 0.001 * delta_multiplier)
69
+ assert_in_delta(0, method.self_time, 0.001 * delta_multiplier)
70
+ assert_in_delta(0, method.wait_time, 0.001 * delta_multiplier)
71
+ assert_in_delta(0, method.children_time, 0.001 * delta_multiplier)
72
72
 
73
73
  method = methods[4]
74
74
  assert_equal('Enumerator#initialize', method.full_name)
75
75
  assert_equal(1, method.called)
76
- assert_in_delta(0, method.total_time)
77
- assert_in_delta(0, method.self_time)
78
- assert_in_delta(0, method.wait_time)
79
- assert_in_delta(0, method.children_time)
76
+ assert_in_delta(0, method.total_time, 0.001 * delta_multiplier)
77
+ assert_in_delta(0, method.self_time, 0.001 * delta_multiplier)
78
+ assert_in_delta(0, method.wait_time, 0.001 * delta_multiplier)
79
+ assert_in_delta(0, method.children_time, 0.001 * delta_multiplier)
80
80
 
81
81
  thread2 = result.threads[1]
82
82
  methods = thread2.methods.sort.reverse
83
83
  assert_equal(4, methods.count)
84
- assert_in_delta(0, method.total_time)
85
- assert_in_delta(0, method.self_time)
86
- assert_in_delta(0, method.wait_time)
87
- assert_in_delta(0, method.children_time)
84
+ assert_in_delta(0, method.total_time, 0.001 * delta_multiplier)
85
+ assert_in_delta(0, method.self_time, 0.001 * delta_multiplier)
86
+ assert_in_delta(0, method.wait_time, 0.001 * delta_multiplier)
87
+ assert_in_delta(0, method.children_time, 0.001 * delta_multiplier)
88
88
 
89
89
  method = methods[0]
90
90
  assert_equal('Enumerator#each', method.full_name)
91
91
  assert_equal(1, method.called)
92
- assert_in_delta(0, method.total_time)
93
- assert_in_delta(0, method.self_time)
94
- assert_in_delta(0, method.wait_time)
95
- assert_in_delta(0, method.children_time)
92
+ assert_in_delta(0, method.total_time, 0.001 * delta_multiplier)
93
+ assert_in_delta(0, method.self_time, 0.001 * delta_multiplier)
94
+ assert_in_delta(0, method.wait_time, 0.001 * delta_multiplier)
95
+ assert_in_delta(0, method.children_time, 0.001 * delta_multiplier)
96
96
 
97
97
  method = methods[1]
98
98
  assert_equal('Enumerator::Generator#each', method.full_name)
99
99
  assert_equal(1, method.called)
100
- assert_in_delta(0, method.total_time)
101
- assert_in_delta(0, method.self_time)
102
- assert_in_delta(0, method.wait_time)
103
- assert_in_delta(0, method.children_time)
100
+ assert_in_delta(0, method.total_time, 0.001 * delta_multiplier)
101
+ assert_in_delta(0, method.self_time, 0.001 * delta_multiplier)
102
+ assert_in_delta(0, method.wait_time, 0.001 * delta_multiplier)
103
+ assert_in_delta(0, method.children_time, 0.001 * delta_multiplier)
104
104
 
105
105
  method = methods[2]
106
106
  assert_equal('Array#each', method.full_name)
107
107
  assert_equal(1, method.called)
108
- assert_in_delta(0, method.total_time)
109
- assert_in_delta(0, method.self_time)
110
- assert_in_delta(0, method.wait_time)
111
- assert_in_delta(0, method.children_time)
108
+ assert_in_delta(0, method.total_time, 0.001 * delta_multiplier)
109
+ assert_in_delta(0, method.self_time, 0.001 * delta_multiplier)
110
+ assert_in_delta(0, method.wait_time, 0.001 * delta_multiplier)
111
+ assert_in_delta(0, method.children_time, 0.001 * delta_multiplier)
112
112
 
113
113
  method = methods[3]
114
114
  assert_equal('Enumerator::Yielder#yield', method.full_name)
115
115
  assert_equal(2, method.called)
116
- assert_in_delta(0, method.total_time)
117
- assert_in_delta(0, method.self_time)
118
- assert_in_delta(0, method.wait_time)
119
- assert_in_delta(0, method.children_time)
116
+ assert_in_delta(0, method.total_time, 0.001 * delta_multiplier)
117
+ assert_in_delta(0, method.self_time, 0.001 * delta_multiplier)
118
+ assert_in_delta(0, method.wait_time, 0.001 * delta_multiplier)
119
+ assert_in_delta(0, method.children_time, 0.001 * delta_multiplier)
120
120
  end
121
121
 
122
122
  def test_fiber_resume
@@ -131,65 +131,65 @@ class FiberTest < TestCase
131
131
  method = methods[0]
132
132
  assert_equal('FiberTest#test_fiber_resume', method.full_name)
133
133
  assert_equal(1, method.called)
134
- assert_in_delta(0, method.total_time)
135
- assert_in_delta(0, method.self_time)
136
- assert_in_delta(0, method.wait_time)
137
- assert_in_delta(0, method.children_time)
134
+ assert_in_delta(0, method.total_time, 0.001 * delta_multiplier)
135
+ assert_in_delta(0, method.self_time, 0.001 * delta_multiplier)
136
+ assert_in_delta(0, method.wait_time, 0.001 * delta_multiplier)
137
+ assert_in_delta(0, method.children_time, 0.001 * delta_multiplier)
138
138
 
139
139
  method = methods[1]
140
140
  assert_equal('FiberTest#fiber_yield_resume', method.full_name)
141
141
  assert_equal(1, method.called)
142
- assert_in_delta(0, method.total_time)
143
- assert_in_delta(0, method.self_time)
144
- assert_in_delta(0, method.wait_time)
145
- assert_in_delta(0, method.children_time)
142
+ assert_in_delta(0, method.total_time, 0.001 * delta_multiplier)
143
+ assert_in_delta(0, method.self_time, 0.001 * delta_multiplier)
144
+ assert_in_delta(0, method.wait_time, 0.001 * delta_multiplier)
145
+ assert_in_delta(0, method.children_time, 0.001 * delta_multiplier)
146
146
 
147
147
  method = methods[2]
148
148
  assert_equal('Fiber#resume', method.full_name)
149
149
  assert_equal(2, method.called)
150
- assert_in_delta(0, method.total_time)
151
- assert_in_delta(0, method.self_time)
152
- assert_in_delta(0, method.wait_time)
153
- assert_in_delta(0, method.children_time)
150
+ assert_in_delta(0, method.total_time, 0.001 * delta_multiplier)
151
+ assert_in_delta(0, method.self_time, 0.001 * delta_multiplier)
152
+ assert_in_delta(0, method.wait_time, 0.001 * delta_multiplier)
153
+ assert_in_delta(0, method.children_time, 0.001 * delta_multiplier)
154
154
 
155
155
  method = methods[3]
156
156
  assert_equal('Class#new', method.full_name)
157
157
  assert_equal(1, method.called)
158
- assert_in_delta(0, method.total_time)
159
- assert_in_delta(0, method.self_time)
160
- assert_in_delta(0, method.wait_time)
161
- assert_in_delta(0, method.children_time)
158
+ assert_in_delta(0, method.total_time, 0.001 * delta_multiplier)
159
+ assert_in_delta(0, method.self_time, 0.001 * delta_multiplier)
160
+ assert_in_delta(0, method.wait_time, 0.001 * delta_multiplier)
161
+ assert_in_delta(0, method.children_time, 0.001 * delta_multiplier)
162
162
 
163
163
  method = methods[4]
164
164
  assert_equal('Fiber#initialize', method.full_name)
165
165
  assert_equal(1, method.called)
166
- assert_in_delta(0, method.total_time)
167
- assert_in_delta(0, method.self_time)
168
- assert_in_delta(0, method.wait_time)
169
- assert_in_delta(0, method.children_time)
166
+ assert_in_delta(0, method.total_time, 0.001 * delta_multiplier)
167
+ assert_in_delta(0, method.self_time, 0.001 * delta_multiplier)
168
+ assert_in_delta(0, method.wait_time, 0.001 * delta_multiplier)
169
+ assert_in_delta(0, method.children_time, 0.001 * delta_multiplier)
170
170
 
171
171
  thread1 = result.threads[1]
172
172
  methods = thread1.methods.sort.reverse
173
173
  assert_equal(2, methods.count)
174
- assert_in_delta(0, method.total_time)
175
- assert_in_delta(0, method.self_time)
176
- assert_in_delta(0, method.wait_time)
177
- assert_in_delta(0, method.children_time)
174
+ assert_in_delta(0, method.total_time, 0.001 * delta_multiplier)
175
+ assert_in_delta(0, method.self_time, 0.001 * delta_multiplier)
176
+ assert_in_delta(0, method.wait_time, 0.001 * delta_multiplier)
177
+ assert_in_delta(0, method.children_time, 0.001 * delta_multiplier)
178
178
 
179
179
  method = methods[0]
180
180
  assert_equal('FiberTest#fiber_yield_resume', method.full_name)
181
181
  assert_equal(1, method.called)
182
- assert_in_delta(0, method.total_time)
183
- assert_in_delta(0, method.self_time)
184
- assert_in_delta(0, method.wait_time)
185
- assert_in_delta(0, method.children_time)
182
+ assert_in_delta(0, method.total_time, 0.001 * delta_multiplier)
183
+ assert_in_delta(0, method.self_time, 0.001 * delta_multiplier)
184
+ assert_in_delta(0, method.wait_time, 0.001 * delta_multiplier)
185
+ assert_in_delta(0, method.children_time, 0.001 * delta_multiplier)
186
186
 
187
187
  method = methods[1]
188
188
  assert_equal('<Class::Fiber>#yield', method.full_name)
189
189
  assert_equal(2, method.called)
190
- assert_in_delta(0, method.total_time)
191
- assert_in_delta(0, method.self_time)
192
- assert_in_delta(0, method.wait_time)
193
- assert_in_delta(0, method.children_time)
190
+ assert_in_delta(0, method.total_time, 0.001 * delta_multiplier)
191
+ assert_in_delta(0, method.self_time, 0.001 * delta_multiplier)
192
+ assert_in_delta(0, method.wait_time, 0.001 * delta_multiplier)
193
+ assert_in_delta(0, method.children_time, 0.001 * delta_multiplier)
194
194
  end
195
195
  end