ruby-prof 1.4.3 → 1.6.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES +59 -9
  3. data/{README.rdoc → README.md} +2 -2
  4. data/Rakefile +4 -4
  5. data/bin/ruby-prof +100 -87
  6. data/ext/ruby_prof/rp_allocation.c +140 -85
  7. data/ext/ruby_prof/rp_allocation.h +8 -6
  8. data/ext/ruby_prof/rp_call_tree.c +502 -369
  9. data/ext/ruby_prof/rp_call_tree.h +47 -43
  10. data/ext/ruby_prof/rp_call_trees.c +16 -8
  11. data/ext/ruby_prof/rp_measure_allocations.c +10 -13
  12. data/ext/ruby_prof/rp_measure_memory.c +8 -4
  13. data/ext/ruby_prof/rp_measure_process_time.c +7 -6
  14. data/ext/ruby_prof/rp_measurement.c +147 -20
  15. data/ext/ruby_prof/rp_measurement.h +4 -1
  16. data/ext/ruby_prof/rp_method.c +142 -83
  17. data/ext/ruby_prof/rp_method.h +63 -62
  18. data/ext/ruby_prof/rp_profile.c +933 -900
  19. data/ext/ruby_prof/rp_profile.h +1 -0
  20. data/ext/ruby_prof/rp_thread.c +433 -362
  21. data/ext/ruby_prof/rp_thread.h +39 -39
  22. data/ext/ruby_prof/ruby_prof.c +0 -2
  23. data/ext/ruby_prof/ruby_prof.h +8 -0
  24. data/ext/ruby_prof/vc/ruby_prof.vcxproj +11 -8
  25. data/lib/ruby-prof/assets/call_stack_printer.html.erb +2 -1
  26. data/lib/ruby-prof/compatibility.rb +14 -0
  27. data/lib/ruby-prof/method_info.rb +8 -1
  28. data/lib/ruby-prof/printers/abstract_printer.rb +2 -1
  29. data/lib/ruby-prof/printers/call_tree_printer.rb +4 -10
  30. data/lib/ruby-prof/printers/graph_html_printer.rb +1 -1
  31. data/lib/ruby-prof/printers/multi_printer.rb +17 -17
  32. data/lib/ruby-prof/profile.rb +70 -37
  33. data/lib/ruby-prof/rack.rb +31 -21
  34. data/lib/ruby-prof/version.rb +1 -1
  35. data/lib/ruby-prof.rb +1 -1
  36. data/ruby-prof.gemspec +2 -3
  37. data/test/abstract_printer_test.rb +1 -0
  38. data/test/alias_test.rb +97 -106
  39. data/test/call_tree_builder.rb +126 -0
  40. data/test/call_tree_test.rb +94 -0
  41. data/test/call_tree_visitor_test.rb +1 -6
  42. data/test/call_trees_test.rb +6 -6
  43. data/test/{basic_test.rb → compatibility_test.rb} +8 -2
  44. data/test/duplicate_names_test.rb +5 -5
  45. data/test/dynamic_method_test.rb +24 -15
  46. data/test/enumerable_test.rb +1 -1
  47. data/test/exceptions_test.rb +2 -2
  48. data/test/exclude_methods_test.rb +3 -8
  49. data/test/exclude_threads_test.rb +4 -9
  50. data/test/fiber_test.rb +74 -8
  51. data/test/gc_test.rb +11 -9
  52. data/test/inverse_call_tree_test.rb +33 -34
  53. data/test/line_number_test.rb +37 -61
  54. data/test/marshal_test.rb +16 -3
  55. data/test/measure_allocations.rb +1 -5
  56. data/test/measure_allocations_test.rb +642 -357
  57. data/test/{measure_memory_trace_test.rb → measure_memory_test.rb} +180 -616
  58. data/test/measure_process_time_test.rb +1566 -741
  59. data/test/measure_wall_time_test.rb +179 -193
  60. data/test/measurement_test.rb +82 -0
  61. data/test/merge_test.rb +146 -0
  62. data/test/method_info_test.rb +95 -0
  63. data/test/multi_printer_test.rb +0 -5
  64. data/test/no_method_class_test.rb +1 -1
  65. data/test/pause_resume_test.rb +12 -16
  66. data/test/printer_call_stack_test.rb +2 -2
  67. data/test/printer_call_tree_test.rb +4 -4
  68. data/test/printer_flat_test.rb +1 -1
  69. data/test/printer_graph_html_test.rb +2 -2
  70. data/test/printer_graph_test.rb +2 -2
  71. data/test/printers_test.rb +14 -20
  72. data/test/printing_recursive_graph_test.rb +2 -2
  73. data/test/profile_test.rb +85 -0
  74. data/test/recursive_test.rb +374 -155
  75. data/test/scheduler.rb +363 -0
  76. data/test/singleton_test.rb +1 -1
  77. data/test/stack_printer_test.rb +5 -8
  78. data/test/start_stop_test.rb +11 -14
  79. data/test/test_helper.rb +11 -8
  80. data/test/thread_test.rb +106 -15
  81. data/test/unique_call_path_test.rb +28 -12
  82. data/test/yarv_test.rb +11 -7
  83. metadata +17 -29
  84. data/ext/ruby_prof/rp_aggregate_call_tree.c +0 -59
  85. data/ext/ruby_prof/rp_aggregate_call_tree.h +0 -13
  86. data/test/measure_allocations_trace_test.rb +0 -375
  87. data/test/temp.rb +0 -20
@@ -30,7 +30,7 @@ class UniqueCallPathTest < TestCase
30
30
  def test_root
31
31
  unique_call_path = UniqueCallPath.new
32
32
 
33
- result = RubyProf.profile do
33
+ result = RubyProf::Profile.profile do
34
34
  unique_call_path.method_a(1)
35
35
  end
36
36
 
@@ -41,7 +41,7 @@ class UniqueCallPathTest < TestCase
41
41
  def test_root_children
42
42
  unique_call_path = UniqueCallPath.new
43
43
 
44
- result = RubyProf.profile do
44
+ result = RubyProf::Profile.profile do
45
45
  unique_call_path.method_a(1)
46
46
  unique_call_path.method_k(2)
47
47
  end
@@ -59,7 +59,7 @@ class UniqueCallPathTest < TestCase
59
59
  def test_children_of
60
60
  unique_call_path = UniqueCallPath.new
61
61
 
62
- result = RubyProf.profile do
62
+ result = RubyProf::Profile.profile do
63
63
  unique_call_path.method_a(1)
64
64
  unique_call_path.method_k(2)
65
65
  end
@@ -79,14 +79,20 @@ class UniqueCallPathTest < TestCase
79
79
  array
80
80
  end
81
81
 
82
- assert_equal(1, call_info_a.children.length)
83
- assert_equal("UniqueCallPath#method_b", call_info_a.children.first.target.full_name)
82
+ if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.1')
83
+ assert_equal(1, call_info_a.children.length)
84
+ assert_equal("UniqueCallPath#method_b", call_info_a.children[0].target.full_name)
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
84
90
  end
85
91
 
86
92
  def test_unique_path
87
93
  unique_call_path = UniqueCallPath.new
88
94
 
89
- result = RubyProf.profile do
95
+ result = RubyProf::Profile.profile do
90
96
  unique_call_path.method_a(1)
91
97
  unique_call_path.method_k(1)
92
98
  end
@@ -106,15 +112,25 @@ class UniqueCallPathTest < TestCase
106
112
  array
107
113
  end
108
114
 
109
- assert_equal(1, call_info_a.children.length)
110
- assert_equal(1, children_of_a.length)
111
-
112
115
  children_of_a = children_of_a.sort do |c1, c2|
113
116
  c1.target.full_name <=> c2.target.full_name
114
117
  end
115
118
 
116
- assert_equal(1, children_of_a.length)
117
- assert_equal(1, children_of_a[0].called)
118
- assert_equal("UniqueCallPath#method_b", children_of_a[0].target.full_name)
119
+ if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.1')
120
+ assert_equal(1, call_info_a.children.length)
121
+ assert_equal(1, children_of_a.length)
122
+
123
+ assert_equal(1, children_of_a[0].called)
124
+ assert_equal("UniqueCallPath#method_b", children_of_a[0].target.full_name)
125
+ else
126
+ assert_equal(2, call_info_a.children.length)
127
+ assert_equal(2, children_of_a.length)
128
+
129
+ assert_equal(1, children_of_a[0].called)
130
+ assert_equal("Integer#==", children_of_a[0].target.full_name)
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
119
135
  end
120
136
  end
data/test/yarv_test.rb CHANGED
@@ -4,28 +4,32 @@
4
4
  require File.expand_path('../test_helper', __FILE__)
5
5
 
6
6
  # tests for bugs reported by users
7
- class BugsTest < TestCase
7
+ class YarvTest < TestCase
8
8
  def setup
9
- RubyProf::measure_mode = RubyProf::WALL_TIME
9
+ super
10
10
  define_methods
11
11
  end
12
12
 
13
13
  def test_array_push_unoptimized
14
14
  a = nil
15
- result = RubyProf.profile do
15
+ result = RubyProf::Profile.profile(measure_mode: RubyProf::WALL_TIME) do
16
16
  a = self.array_push_unoptimized
17
17
  end
18
18
  assert_equal 2, a.length
19
- assert_equal ["BugsTest#test_array_push_unoptimized", "BugsTest#array_push_unoptimized", 'Array#<<', "Array#push"], result.threads.first.methods.map(&:full_name)
19
+ assert_equal ["YarvTest#test_array_push_unoptimized", "YarvTest#array_push_unoptimized", 'Array#<<', "Array#push"], result.threads.first.methods.map(&:full_name)
20
20
  end
21
21
 
22
22
  def test_array_push_optimized
23
23
  a = nil
24
- result = RubyProf.profile do
24
+ result = RubyProf::Profile.profile(measure_mode: RubyProf::WALL_TIME) do
25
25
  a = self.array_push_optimized
26
26
  end
27
- assert_equal 2, a.length
28
- assert_equal ["BugsTest#test_array_push_optimized", "BugsTest#array_push_optimized", "Array#push"], result.threads.first.methods.map(&:full_name)
27
+ assert_equal(2, a.length)
28
+ if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.1')
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
29
33
  end
30
34
 
31
35
  private
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-prof
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.3
4
+ version: 1.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shugo Maeda, Charlie Savage, Roger Pack, Stefan Kaes
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-15 00:00:00.000000000 Z
11
+ date: 2023-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -38,20 +38,6 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: rdoc
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
41
  description: |
56
42
  ruby-prof is a fast code profiler for Ruby. It is a C extension and
57
43
  therefore is many times faster than the standard Ruby profiler. It
@@ -69,13 +55,11 @@ extra_rdoc_files: []
69
55
  files:
70
56
  - CHANGES
71
57
  - LICENSE
72
- - README.rdoc
58
+ - README.md
73
59
  - Rakefile
74
60
  - bin/ruby-prof
75
61
  - bin/ruby-prof-check-trace
76
62
  - ext/ruby_prof/extconf.rb
77
- - ext/ruby_prof/rp_aggregate_call_tree.c
78
- - ext/ruby_prof/rp_aggregate_call_tree.h
79
63
  - ext/ruby_prof/rp_allocation.c
80
64
  - ext/ruby_prof/rp_allocation.h
81
65
  - ext/ruby_prof/rp_call_tree.c
@@ -128,9 +112,11 @@ files:
128
112
  - ruby-prof.gemspec
129
113
  - test/abstract_printer_test.rb
130
114
  - test/alias_test.rb
131
- - test/basic_test.rb
115
+ - test/call_tree_builder.rb
116
+ - test/call_tree_test.rb
132
117
  - test/call_tree_visitor_test.rb
133
118
  - test/call_trees_test.rb
119
+ - test/compatibility_test.rb
134
120
  - test/duplicate_names_test.rb
135
121
  - test/dynamic_method_test.rb
136
122
  - test/enumerable_test.rb
@@ -144,11 +130,13 @@ files:
144
130
  - test/marshal_test.rb
145
131
  - test/measure_allocations.rb
146
132
  - test/measure_allocations_test.rb
147
- - test/measure_allocations_trace_test.rb
148
- - test/measure_memory_trace_test.rb
133
+ - test/measure_memory_test.rb
149
134
  - test/measure_process_time_test.rb
150
135
  - test/measure_times.rb
151
136
  - test/measure_wall_time_test.rb
137
+ - test/measurement_test.rb
138
+ - test/merge_test.rb
139
+ - test/method_info_test.rb
152
140
  - test/multi_printer_test.rb
153
141
  - test/no_method_class_test.rb
154
142
  - test/pause_resume_test.rb
@@ -164,10 +152,10 @@ files:
164
152
  - test/profile_test.rb
165
153
  - test/rack_test.rb
166
154
  - test/recursive_test.rb
155
+ - test/scheduler.rb
167
156
  - test/singleton_test.rb
168
157
  - test/stack_printer_test.rb
169
158
  - test/start_stop_test.rb
170
- - test/temp.rb
171
159
  - test/test_helper.rb
172
160
  - test/thread_test.rb
173
161
  - test/unique_call_path_test.rb
@@ -179,8 +167,8 @@ metadata:
179
167
  bug_tracker_uri: https://github.com/ruby-prof/ruby-prof/issues
180
168
  changelog_uri: https://github.com/ruby-prof/ruby-prof/blob/master/CHANGES
181
169
  documentation_uri: https://ruby-prof.github.io/
182
- source_code_uri: https://github.com/ruby-prof/ruby-prof/tree/v1.4.3
183
- post_install_message:
170
+ source_code_uri: https://github.com/ruby-prof/ruby-prof/tree/v1.6.3
171
+ post_install_message:
184
172
  rdoc_options: []
185
173
  require_paths:
186
174
  - lib
@@ -188,15 +176,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
188
176
  requirements:
189
177
  - - ">="
190
178
  - !ruby/object:Gem::Version
191
- version: 2.5.0
179
+ version: 2.7.0
192
180
  required_rubygems_version: !ruby/object:Gem::Requirement
193
181
  requirements:
194
182
  - - ">="
195
183
  - !ruby/object:Gem::Version
196
184
  version: '0'
197
185
  requirements: []
198
- rubygems_version: 3.1.4
199
- signing_key:
186
+ rubygems_version: 3.4.8
187
+ signing_key:
200
188
  specification_version: 4
201
189
  summary: Fast Ruby profiler
202
190
  test_files:
@@ -1,59 +0,0 @@
1
- /* Copyright (C) 2005-2019 Shugo Maeda <shugo@ruby-lang.org> and Charlie Savage <cfis@savagexi.com>
2
- Please see the LICENSE file for copyright and distribution information */
3
-
4
- #include "rp_aggregate_call_tree.h"
5
-
6
- VALUE cRpAggregateCallTree;
7
-
8
- void prof_aggregate_call_tree_mark(void* data)
9
- {
10
- prof_call_tree_t* call_tree = (prof_call_tree_t*)data;
11
-
12
- if (call_tree->object != Qnil)
13
- rb_gc_mark(call_tree->object);
14
-
15
- if (call_tree->source_file != Qnil)
16
- rb_gc_mark(call_tree->source_file);
17
-
18
- prof_measurement_mark(call_tree->measurement);
19
- }
20
-
21
- static void prof_aggregate_call_tree_ruby_gc_free(void* data)
22
- {
23
- prof_call_tree_t* call_tree = (prof_call_tree_t*)data;
24
- prof_call_tree_free(call_tree);
25
- }
26
-
27
- size_t prof_aggregate_call_tree_size(const void* data)
28
- {
29
- return sizeof(prof_call_tree_t);
30
- }
31
-
32
- static const rb_data_type_t aggregate_call_tree_type =
33
- {
34
- .wrap_struct_name = "Aggregate_CallTree",
35
- .function =
36
- {
37
- .dmark = prof_aggregate_call_tree_mark,
38
- .dfree = prof_aggregate_call_tree_ruby_gc_free,
39
- .dsize = prof_aggregate_call_tree_size,
40
- },
41
- .data = NULL,
42
- .flags = RUBY_TYPED_FREE_IMMEDIATELY
43
- };
44
-
45
- VALUE prof_aggregate_call_tree_wrap(prof_call_tree_t* call_tree)
46
- {
47
- if (call_tree->object == Qnil)
48
- {
49
- call_tree->object = TypedData_Wrap_Struct(cRpAggregateCallTree, &aggregate_call_tree_type, call_tree);
50
- }
51
- return call_tree->object;
52
- }
53
-
54
- void rp_init_aggregate_call_tree()
55
- {
56
- // AggregateCallTree
57
- cRpAggregateCallTree = rb_define_class_under(mProf, "AggregateCallTree", cRpCallTree);
58
- rb_undef_method(CLASS_OF(cRpAggregateCallTree), "new");
59
- }
@@ -1,13 +0,0 @@
1
- /* Copyright (C) 2005-2019 Shugo Maeda <shugo@ruby-lang.org> and Charlie Savage <cfis@savagexi.com>
2
- Please see the LICENSE file for copyright and distribution information */
3
-
4
- #ifndef __RP_AGGREGATE_CALL_TREE_H__
5
- #define __RP_AGGREGATE_CALL_TREE_H__
6
-
7
- #include "ruby_prof.h"
8
- #include "rp_call_tree.h"
9
-
10
- void rp_init_aggregate_call_tree(void);
11
- VALUE prof_aggregate_call_tree_wrap(prof_call_tree_t* call_tree);
12
-
13
- #endif //__RP_AGGREGATE_CALL_TREE_H__
@@ -1,375 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # encoding: UTF-8
3
-
4
- require File.expand_path('../test_helper', __FILE__)
5
- require_relative './measure_allocations'
6
-
7
- class MeasureAllocationsTraceTest < TestCase
8
- def setup
9
- RubyProf::measure_mode = RubyProf::ALLOCATIONS
10
- end
11
-
12
- def test_allocations_mode
13
- RubyProf::measure_mode = RubyProf::ALLOCATIONS
14
- assert_equal(RubyProf::ALLOCATIONS, RubyProf::measure_mode)
15
- end
16
-
17
- def test_allocations
18
- result = RubyProf.profile(:track_allocations => true) do
19
- allocator = Allocator.new
20
- allocator.run
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('MeasureAllocationsTraceTest#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('MeasureAllocationsTraceTest#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('MeasureAllocationsTraceTest#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)
374
- end
375
- end