ruby-prof 1.4.2 → 1.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +29 -0
- data/README.md +5 -0
- data/Rakefile +3 -3
- data/ext/ruby_prof/extconf.rb +11 -5
- data/ext/ruby_prof/rp_allocation.c +1 -1
- data/ext/ruby_prof/rp_call_tree.c +0 -2
- data/ext/ruby_prof/rp_call_tree.h +1 -1
- data/ext/ruby_prof/rp_measure_allocations.c +10 -13
- data/ext/ruby_prof/rp_measure_memory.c +8 -4
- data/ext/ruby_prof/rp_measure_process_time.c +7 -6
- data/ext/ruby_prof/rp_measurement.c +2 -2
- data/ext/ruby_prof/rp_measurement.h +1 -1
- data/ext/ruby_prof/rp_method.c +2 -2
- data/ext/ruby_prof/rp_method.h +19 -19
- data/ext/ruby_prof/rp_profile.c +24 -17
- data/ext/ruby_prof/rp_stack.c +1 -1
- data/ext/ruby_prof/rp_thread.c +2 -2
- data/ext/ruby_prof/vc/ruby_prof.vcxproj +9 -7
- data/lib/ruby-prof/assets/call_stack_printer.html.erb +2 -1
- data/lib/ruby-prof/printers/abstract_printer.rb +1 -1
- data/lib/ruby-prof/printers/call_tree_printer.rb +3 -7
- data/lib/ruby-prof/printers/graph_html_printer.rb +1 -1
- data/lib/ruby-prof/version.rb +1 -1
- data/lib/ruby-prof.rb +1 -1
- data/ruby-prof.gemspec +2 -3
- data/test/alias_test.rb +97 -101
- data/test/duplicate_names_test.rb +4 -4
- data/test/dynamic_method_test.rb +23 -9
- data/test/gc_test.rb +12 -2
- data/test/marshal_test.rb +37 -5
- data/test/measure_allocations.rb +1 -5
- data/test/measure_allocations_test.rb +27 -69
- data/test/{measure_memory_trace_test.rb → measure_memory_test.rb} +57 -470
- data/test/measure_process_time_test.rb +1564 -735
- data/test/measure_wall_time_test.rb +6 -15
- data/test/printer_call_tree_test.rb +2 -2
- data/test/printer_flat_test.rb +1 -1
- data/test/printers_test.rb +2 -2
- data/test/recursive_test.rb +372 -148
- data/test/start_stop_test.rb +4 -4
- data/test/test_helper.rb +5 -5
- data/test/unique_call_path_test.rb +24 -8
- data/test/yarv_test.rb +8 -4
- metadata +10 -25
- data/README.rdoc +0 -5
- data/test/measure_allocations_trace_test.rb +0 -375
data/ruby-prof.gemspec
CHANGED
@@ -36,7 +36,7 @@ EOF
|
|
36
36
|
spec.files = Dir['CHANGES',
|
37
37
|
'LICENSE',
|
38
38
|
'Rakefile',
|
39
|
-
'README.
|
39
|
+
'README.md',
|
40
40
|
'ruby-prof.gemspec',
|
41
41
|
'bin/ruby-prof',
|
42
42
|
'bin/ruby-prof-check-trace',
|
@@ -56,10 +56,9 @@ EOF
|
|
56
56
|
'test/*.rb']
|
57
57
|
|
58
58
|
spec.test_files = Dir["test/test_*.rb"]
|
59
|
-
spec.required_ruby_version = '>= 2.
|
59
|
+
spec.required_ruby_version = '>= 2.7.0'
|
60
60
|
spec.date = Time.now.strftime('%Y-%m-%d')
|
61
61
|
spec.homepage = 'https://github.com/ruby-prof/ruby-prof'
|
62
62
|
spec.add_development_dependency('minitest')
|
63
63
|
spec.add_development_dependency('rake-compiler')
|
64
|
-
spec.add_development_dependency('rdoc')
|
65
64
|
end
|
data/test/alias_test.rb
CHANGED
@@ -20,107 +20,103 @@ class AliasTest < TestCase
|
|
20
20
|
RubyProf::measure_mode = RubyProf::WALL_TIME
|
21
21
|
end
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
def test_alias
|
27
|
-
result = RubyProf.profile do
|
28
|
-
TestMe.new.some_method
|
29
|
-
end
|
30
|
-
|
31
|
-
methods = result.threads.first.methods
|
32
|
-
assert_equal(6, methods.count)
|
33
|
-
|
34
|
-
# Method 0
|
35
|
-
method = methods[0]
|
36
|
-
assert_equal('AliasTest#test_alias', method.full_name)
|
37
|
-
assert_equal(28, method.line)
|
38
|
-
refute(method.recursive?)
|
39
|
-
|
40
|
-
assert_equal(0, method.call_trees.callers.count)
|
41
|
-
|
42
|
-
assert_equal(2, method.call_trees.callees.count)
|
43
|
-
call_tree = method.call_trees.callees[0]
|
44
|
-
assert_equal('Class#new', call_tree.target.full_name)
|
45
|
-
assert_equal(28, call_tree.line)
|
46
|
-
|
47
|
-
call_tree = method.call_trees.callees[1]
|
48
|
-
assert_equal('AliasTest::TestMe#some_method', call_tree.target.full_name)
|
49
|
-
assert_equal(28, call_tree.line)
|
50
|
-
|
51
|
-
# Method 1
|
52
|
-
method = methods[1]
|
53
|
-
assert_equal('Class#new', method.full_name)
|
54
|
-
assert_equal(0, method.line)
|
55
|
-
refute(method.recursive?)
|
56
|
-
|
57
|
-
assert_equal(1, method.call_trees.callers.count)
|
58
|
-
call_tree = method.call_trees.callers[0]
|
59
|
-
assert_equal('AliasTest#test_alias', call_tree.parent.target.full_name)
|
60
|
-
assert_equal(28, call_tree.line)
|
61
|
-
|
62
|
-
assert_equal(1, method.call_trees.callees.count)
|
63
|
-
call_tree = method.call_trees.callees[0]
|
64
|
-
assert_equal('BasicObject#initialize', call_tree.target.full_name)
|
65
|
-
assert_equal(0, call_tree.line)
|
66
|
-
|
67
|
-
# Method 2
|
68
|
-
method = methods[2]
|
69
|
-
assert_equal('BasicObject#initialize', method.full_name)
|
70
|
-
assert_equal(0, method.line)
|
71
|
-
refute(method.recursive?)
|
72
|
-
|
73
|
-
assert_equal(1, method.call_trees.callers.count)
|
74
|
-
call_tree = method.call_trees.callers[0]
|
75
|
-
assert_equal('Class#new', call_tree.parent.target.full_name)
|
76
|
-
assert_equal(0, call_tree.line)
|
77
|
-
|
78
|
-
assert_equal(0, method.call_trees.callees.count)
|
79
|
-
|
80
|
-
# Method 3
|
81
|
-
method = methods[3]
|
82
|
-
assert_equal('AliasTest::TestMe#some_method', method.full_name)
|
83
|
-
assert_equal(13, method.line)
|
84
|
-
refute(method.recursive?)
|
85
|
-
|
86
|
-
assert_equal(1, method.call_trees.callers.count)
|
87
|
-
call_tree = method.call_trees.callers[0]
|
88
|
-
assert_equal('AliasTest#test_alias', call_tree.parent.target.full_name)
|
89
|
-
assert_equal(28, call_tree.line)
|
90
|
-
|
91
|
-
assert_equal(1, method.call_trees.callees.count)
|
92
|
-
call_tree = method.call_trees.callees[0]
|
93
|
-
assert_equal('AliasTest::TestMe#some_method_original', call_tree.target.full_name)
|
94
|
-
assert_equal(14, call_tree.line)
|
95
|
-
|
96
|
-
# Method 4
|
97
|
-
method = methods[4]
|
98
|
-
assert_equal('AliasTest::TestMe#some_method_original', method.full_name)
|
99
|
-
assert_equal(8, method.line)
|
100
|
-
refute(method.recursive?)
|
101
|
-
|
102
|
-
assert_equal(1, method.call_trees.callers.count)
|
103
|
-
call_tree = method.call_trees.callers[0]
|
104
|
-
assert_equal('AliasTest::TestMe#some_method', call_tree.parent.target.full_name)
|
105
|
-
assert_equal(14, call_tree.line)
|
106
|
-
|
107
|
-
assert_equal(1, method.call_trees.callees.count)
|
108
|
-
call_tree = method.call_trees.callees[0]
|
109
|
-
assert_equal('Kernel#sleep', call_tree.target.full_name)
|
110
|
-
assert_equal(9, call_tree.line)
|
111
|
-
|
112
|
-
# Method 5
|
113
|
-
method = methods[5]
|
114
|
-
assert_equal('Kernel#sleep', method.full_name)
|
115
|
-
assert_equal(0, method.line)
|
116
|
-
refute(method.recursive?)
|
117
|
-
|
118
|
-
assert_equal(1, method.call_trees.callers.count)
|
119
|
-
call_tree = method.call_trees.callers[0]
|
120
|
-
assert_equal('AliasTest::TestMe#some_method_original', call_tree.parent.target.full_name)
|
121
|
-
assert_equal(9, call_tree.line)
|
122
|
-
|
123
|
-
assert_equal(0, method.call_trees.callees.count)
|
23
|
+
def test_alias
|
24
|
+
result = RubyProf.profile do
|
25
|
+
TestMe.new.some_method
|
124
26
|
end
|
27
|
+
|
28
|
+
methods = result.threads.first.methods
|
29
|
+
assert_equal(6, methods.count)
|
30
|
+
|
31
|
+
# Method 0
|
32
|
+
method = methods[0]
|
33
|
+
assert_equal('AliasTest#test_alias', method.full_name)
|
34
|
+
assert_equal(25, method.line)
|
35
|
+
refute(method.recursive?)
|
36
|
+
|
37
|
+
assert_equal(0, method.call_trees.callers.count)
|
38
|
+
|
39
|
+
assert_equal(2, method.call_trees.callees.count)
|
40
|
+
call_tree = method.call_trees.callees[0]
|
41
|
+
assert_equal('Class#new', call_tree.target.full_name)
|
42
|
+
assert_equal(25, call_tree.line)
|
43
|
+
|
44
|
+
call_tree = method.call_trees.callees[1]
|
45
|
+
assert_equal('AliasTest::TestMe#some_method', call_tree.target.full_name)
|
46
|
+
assert_equal(25, call_tree.line)
|
47
|
+
|
48
|
+
# Method 1
|
49
|
+
method = methods[1]
|
50
|
+
assert_equal('Class#new', method.full_name)
|
51
|
+
assert_equal(0, method.line)
|
52
|
+
refute(method.recursive?)
|
53
|
+
|
54
|
+
assert_equal(1, method.call_trees.callers.count)
|
55
|
+
call_tree = method.call_trees.callers[0]
|
56
|
+
assert_equal('AliasTest#test_alias', call_tree.parent.target.full_name)
|
57
|
+
assert_equal(25, call_tree.line)
|
58
|
+
|
59
|
+
assert_equal(1, method.call_trees.callees.count)
|
60
|
+
call_tree = method.call_trees.callees[0]
|
61
|
+
assert_equal('BasicObject#initialize', call_tree.target.full_name)
|
62
|
+
assert_equal(0, call_tree.line)
|
63
|
+
|
64
|
+
# Method 2
|
65
|
+
method = methods[2]
|
66
|
+
assert_equal('BasicObject#initialize', method.full_name)
|
67
|
+
assert_equal(0, method.line)
|
68
|
+
refute(method.recursive?)
|
69
|
+
|
70
|
+
assert_equal(1, method.call_trees.callers.count)
|
71
|
+
call_tree = method.call_trees.callers[0]
|
72
|
+
assert_equal('Class#new', call_tree.parent.target.full_name)
|
73
|
+
assert_equal(0, call_tree.line)
|
74
|
+
|
75
|
+
assert_equal(0, method.call_trees.callees.count)
|
76
|
+
|
77
|
+
# Method 3
|
78
|
+
method = methods[3]
|
79
|
+
assert_equal('AliasTest::TestMe#some_method', method.full_name)
|
80
|
+
assert_equal(13, method.line)
|
81
|
+
refute(method.recursive?)
|
82
|
+
|
83
|
+
assert_equal(1, method.call_trees.callers.count)
|
84
|
+
call_tree = method.call_trees.callers[0]
|
85
|
+
assert_equal('AliasTest#test_alias', call_tree.parent.target.full_name)
|
86
|
+
assert_equal(25, call_tree.line)
|
87
|
+
|
88
|
+
assert_equal(1, method.call_trees.callees.count)
|
89
|
+
call_tree = method.call_trees.callees[0]
|
90
|
+
assert_equal('AliasTest::TestMe#some_method_original', call_tree.target.full_name)
|
91
|
+
assert_equal(14, call_tree.line)
|
92
|
+
|
93
|
+
# Method 4
|
94
|
+
method = methods[4]
|
95
|
+
assert_equal('AliasTest::TestMe#some_method_original', method.full_name)
|
96
|
+
assert_equal(8, method.line)
|
97
|
+
refute(method.recursive?)
|
98
|
+
|
99
|
+
assert_equal(1, method.call_trees.callers.count)
|
100
|
+
call_tree = method.call_trees.callers[0]
|
101
|
+
assert_equal('AliasTest::TestMe#some_method', call_tree.parent.target.full_name)
|
102
|
+
assert_equal(14, call_tree.line)
|
103
|
+
|
104
|
+
assert_equal(1, method.call_trees.callees.count)
|
105
|
+
call_tree = method.call_trees.callees[0]
|
106
|
+
assert_equal('Kernel#sleep', call_tree.target.full_name)
|
107
|
+
assert_equal(9, call_tree.line)
|
108
|
+
|
109
|
+
# Method 5
|
110
|
+
method = methods[5]
|
111
|
+
assert_equal('Kernel#sleep', method.full_name)
|
112
|
+
assert_equal(0, method.line)
|
113
|
+
refute(method.recursive?)
|
114
|
+
|
115
|
+
assert_equal(1, method.call_trees.callers.count)
|
116
|
+
call_tree = method.call_trees.callers[0]
|
117
|
+
assert_equal('AliasTest::TestMe#some_method_original', call_tree.parent.target.full_name)
|
118
|
+
assert_equal(9, call_tree.line)
|
119
|
+
|
120
|
+
assert_equal(0, method.call_trees.callees.count)
|
125
121
|
end
|
126
122
|
end
|
@@ -3,18 +3,18 @@
|
|
3
3
|
|
4
4
|
require File.expand_path('../test_helper', __FILE__)
|
5
5
|
|
6
|
-
class
|
6
|
+
class DuplicateNamesTest < TestCase
|
7
7
|
def test_names
|
8
8
|
result = RubyProf::profile do
|
9
9
|
str = %{module Foo; class Bar; def foo; end end end}
|
10
10
|
|
11
11
|
eval str
|
12
12
|
Foo::Bar.new.foo
|
13
|
-
|
13
|
+
DuplicateNamesTest.class_eval {remove_const :Foo}
|
14
14
|
|
15
15
|
eval str
|
16
16
|
Foo::Bar.new.foo
|
17
|
-
|
17
|
+
DuplicateNamesTest.class_eval {remove_const :Foo}
|
18
18
|
|
19
19
|
eval str
|
20
20
|
Foo::Bar.new.foo
|
@@ -24,7 +24,7 @@ class DuplicateNames < TestCase
|
|
24
24
|
methods = result.threads.first.methods.sort.reverse
|
25
25
|
|
26
26
|
methods = methods.select do |method|
|
27
|
-
method.full_name == '
|
27
|
+
method.full_name == 'DuplicateNamesTest::Foo::Bar#foo'
|
28
28
|
end
|
29
29
|
|
30
30
|
assert_equal(3, methods.length)
|
data/test/dynamic_method_test.rb
CHANGED
@@ -39,15 +39,29 @@ class DynamicMethodTest < TestCase
|
|
39
39
|
end
|
40
40
|
|
41
41
|
methods = result.threads.first.methods.sort.reverse
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
42
|
+
|
43
|
+
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.1')
|
44
|
+
expected_method_names = %w(
|
45
|
+
DynamicMethodTest#test_dynamic_method
|
46
|
+
Kernel#sleep
|
47
|
+
DynamicMethodTest::FruitMedley#peach
|
48
|
+
DynamicMethodTest::FruitMedley#banana
|
49
|
+
DynamicMethodTest::FruitMedley#orange
|
50
|
+
DynamicMethodTest::FruitMedley#apple
|
51
|
+
Symbol#to_s
|
52
|
+
)
|
53
|
+
else
|
54
|
+
expected_method_names = %w(
|
55
|
+
DynamicMethodTest#test_dynamic_method
|
56
|
+
Kernel#sleep
|
57
|
+
DynamicMethodTest::FruitMedley#peach
|
58
|
+
DynamicMethodTest::FruitMedley#banana
|
59
|
+
DynamicMethodTest::FruitMedley#orange
|
60
|
+
DynamicMethodTest::FruitMedley#apple
|
61
|
+
Integer#==
|
62
|
+
)
|
63
|
+
end
|
64
|
+
|
51
65
|
assert_equal expected_method_names.join("\n"), methods.map(&:full_name).join("\n")
|
52
66
|
end
|
53
67
|
end
|
data/test/gc_test.rb
CHANGED
@@ -29,6 +29,8 @@ class GcTest < TestCase
|
|
29
29
|
array
|
30
30
|
end
|
31
31
|
|
32
|
+
GC.start
|
33
|
+
|
32
34
|
threads.each do |thread|
|
33
35
|
refute_nil(thread.id)
|
34
36
|
end
|
@@ -42,6 +44,8 @@ class GcTest < TestCase
|
|
42
44
|
array
|
43
45
|
end
|
44
46
|
|
47
|
+
GC.start
|
48
|
+
|
45
49
|
methods.each do |method|
|
46
50
|
refute_nil(method.method_name)
|
47
51
|
end
|
@@ -55,6 +59,8 @@ class GcTest < TestCase
|
|
55
59
|
array
|
56
60
|
end
|
57
61
|
|
62
|
+
GC.start
|
63
|
+
|
58
64
|
method_call_infos.each do |call_trees|
|
59
65
|
refute_empty(call_trees.call_trees)
|
60
66
|
end
|
@@ -63,11 +69,13 @@ class GcTest < TestCase
|
|
63
69
|
def test_hold_onto_measurements
|
64
70
|
measurements = 5.times.reduce(Array.new) do |array, i|
|
65
71
|
profile = run_profile
|
66
|
-
|
67
|
-
array.concat(
|
72
|
+
measurements_2 = profile.threads.map(&:methods).flatten.map(&:measurement)
|
73
|
+
array.concat(measurements_2)
|
68
74
|
array
|
69
75
|
end
|
70
76
|
|
77
|
+
GC.start
|
78
|
+
|
71
79
|
measurements.each do |measurement|
|
72
80
|
error = assert_raises(RuntimeError) do
|
73
81
|
measurement.total_time
|
@@ -83,6 +91,8 @@ class GcTest < TestCase
|
|
83
91
|
array
|
84
92
|
end
|
85
93
|
|
94
|
+
GC.start
|
95
|
+
|
86
96
|
call_trees.each do |call_tree|
|
87
97
|
refute_nil(call_tree.source_file)
|
88
98
|
end
|
data/test/marshal_test.rb
CHANGED
@@ -5,6 +5,8 @@ require File.expand_path("../test_helper", __FILE__)
|
|
5
5
|
class MarshalTest < TestCase
|
6
6
|
def verify_profile(profile_1, profile_2)
|
7
7
|
verify_threads(profile_1.threads, profile_2.threads)
|
8
|
+
assert_equal(profile_1.measure_mode, profile_2.measure_mode)
|
9
|
+
assert_equal(profile_1.track_allocations?, profile_2.track_allocations?)
|
8
10
|
end
|
9
11
|
|
10
12
|
def verify_threads(threads_1, threads_2)
|
@@ -35,7 +37,13 @@ class MarshalTest < TestCase
|
|
35
37
|
|
36
38
|
assert_equal(method_1.recursive?, method_2.recursive?)
|
37
39
|
|
38
|
-
|
40
|
+
if method_1.source_file
|
41
|
+
assert_equal(method_1.source_file, method_2.source_file)
|
42
|
+
else
|
43
|
+
assert_nil(method_1.source_file)
|
44
|
+
assert_nil(method_2.source_file)
|
45
|
+
end
|
46
|
+
|
39
47
|
assert_equal(method_1.line, method_2.line)
|
40
48
|
|
41
49
|
verify_measurement(method_1.measurement, method_2.measurement)
|
@@ -73,10 +81,23 @@ class MarshalTest < TestCase
|
|
73
81
|
|
74
82
|
def verify_call_info(call_info_1, call_info_2)
|
75
83
|
assert_equal(call_info_1.target, call_info_2.target)
|
76
|
-
|
84
|
+
|
85
|
+
if call_info_1.parent&.target
|
86
|
+
assert_equal(call_info_1.parent&.target, call_info_2.parent&.target)
|
87
|
+
else
|
88
|
+
assert_nil(call_info_1.parent&.target)
|
89
|
+
assert_nil(call_info_2.parent&.target)
|
90
|
+
end
|
77
91
|
|
78
92
|
assert_equal(call_info_1.depth, call_info_2.depth)
|
79
|
-
|
93
|
+
|
94
|
+
if call_info_1.source_file
|
95
|
+
assert_equal(call_info_1.source_file, call_info_2.source_file) #
|
96
|
+
else
|
97
|
+
assert_nil(call_info_1.source_file)
|
98
|
+
assert_nil(call_info_2.source_file)
|
99
|
+
end
|
100
|
+
|
80
101
|
assert_equal(call_info_1.line, call_info_2.line)
|
81
102
|
|
82
103
|
verify_measurement(call_info_1.measurement, call_info_2.measurement)
|
@@ -89,8 +110,19 @@ class MarshalTest < TestCase
|
|
89
110
|
assert_equal(measurement_1.called, measurement_2.called)
|
90
111
|
end
|
91
112
|
|
92
|
-
def
|
93
|
-
profile_1 = RubyProf.profile do
|
113
|
+
def test_marshal_1
|
114
|
+
profile_1 = RubyProf.profile(:measure_mode => RubyProf::WALL_TIME) do
|
115
|
+
1.times { RubyProf::C1.new.sleep_wait }
|
116
|
+
end
|
117
|
+
|
118
|
+
data = Marshal.dump(profile_1)
|
119
|
+
profile_2 = Marshal.load(data)
|
120
|
+
|
121
|
+
verify_profile(profile_1, profile_2)
|
122
|
+
end
|
123
|
+
|
124
|
+
def test_marshal_2
|
125
|
+
profile_1 = RubyProf.profile(:measure_mode => RubyProf::PROCESS_TIME, :track_allocations => true) do
|
94
126
|
1.times { RubyProf::C1.new.sleep_wait }
|
95
127
|
end
|
96
128
|
|
data/test/measure_allocations.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
require File.expand_path('../test_helper', __FILE__)
|
5
5
|
require_relative './measure_allocations'
|
6
6
|
|
7
|
-
class
|
7
|
+
class MeasureAllocationsTraceTest < TestCase
|
8
8
|
def setup
|
9
9
|
RubyProf::measure_mode = RubyProf::ALLOCATIONS
|
10
10
|
end
|
@@ -15,7 +15,7 @@ class MeasureAllocationsTest < TestCase
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def test_allocations
|
18
|
-
result = RubyProf.profile do
|
18
|
+
result = RubyProf.profile(:track_allocations => true) do
|
19
19
|
allocator = Allocator.new
|
20
20
|
allocator.run
|
21
21
|
end
|
@@ -24,11 +24,11 @@ class MeasureAllocationsTest < TestCase
|
|
24
24
|
assert_in_delta(20, thread.total_time, 1)
|
25
25
|
|
26
26
|
methods = result.threads.first.methods.sort.reverse
|
27
|
-
assert_equal(
|
27
|
+
assert_equal(12, methods.length)
|
28
28
|
|
29
29
|
# Method 0
|
30
30
|
method = methods[0]
|
31
|
-
assert_equal('
|
31
|
+
assert_equal('MeasureAllocationsTraceTest#test_allocations', method.full_name)
|
32
32
|
assert_in_delta(20, method.total_time, 1)
|
33
33
|
assert_equal(0, method.wait_time)
|
34
34
|
assert_equal(0, method.self_time)
|
@@ -61,31 +61,7 @@ class MeasureAllocationsTest < TestCase
|
|
61
61
|
|
62
62
|
assert_equal(1, method.call_trees.callers.length)
|
63
63
|
call_tree = method.call_trees.callers[0]
|
64
|
-
assert_equal('
|
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)
|
64
|
+
assert_equal('MeasureAllocationsTraceTest#test_allocations', call_tree.parent.target.full_name)
|
89
65
|
assert_equal(19, call_tree.total_time)
|
90
66
|
assert_equal(0, call_tree.wait_time)
|
91
67
|
assert_equal(0, call_tree.self_time)
|
@@ -113,8 +89,8 @@ class MeasureAllocationsTest < TestCase
|
|
113
89
|
assert_equal(1, call_tree.self_time)
|
114
90
|
assert_equal(3, call_tree.children_time)
|
115
91
|
|
116
|
-
# Method
|
117
|
-
method = methods[
|
92
|
+
# Method 2
|
93
|
+
method = methods[2]
|
118
94
|
assert_equal('Class#new', method.full_name)
|
119
95
|
assert_equal(18, method.total_time)
|
120
96
|
assert_equal(0, method.wait_time)
|
@@ -123,7 +99,7 @@ class MeasureAllocationsTest < TestCase
|
|
123
99
|
|
124
100
|
assert_equal(4, method.call_trees.callers.length)
|
125
101
|
call_tree = method.call_trees.callers[0]
|
126
|
-
assert_equal('
|
102
|
+
assert_equal('MeasureAllocationsTraceTest#test_allocations', call_tree.parent.target.full_name)
|
127
103
|
assert_equal(1, call_tree.total_time)
|
128
104
|
assert_equal(0, call_tree.wait_time)
|
129
105
|
assert_equal(1, call_tree.self_time)
|
@@ -179,8 +155,8 @@ class MeasureAllocationsTest < TestCase
|
|
179
155
|
assert_equal(1, call_tree.self_time)
|
180
156
|
assert_equal(0, call_tree.children_time)
|
181
157
|
|
182
|
-
# Method
|
183
|
-
method = methods[
|
158
|
+
# Method 3
|
159
|
+
method = methods[3]
|
184
160
|
assert_equal('Allocator#make_arrays', method.full_name)
|
185
161
|
assert_equal(10, method.total_time)
|
186
162
|
assert_equal(0, method.wait_time)
|
@@ -189,7 +165,7 @@ class MeasureAllocationsTest < TestCase
|
|
189
165
|
|
190
166
|
assert_equal(1, method.call_trees.callers.length)
|
191
167
|
call_tree = method.call_trees.callers[0]
|
192
|
-
assert_equal('Allocator#
|
168
|
+
assert_equal('Allocator#run', call_tree.parent.target.full_name)
|
193
169
|
assert_equal(10, call_tree.total_time)
|
194
170
|
assert_equal(0, call_tree.wait_time)
|
195
171
|
assert_equal(0, call_tree.self_time)
|
@@ -203,8 +179,8 @@ class MeasureAllocationsTest < TestCase
|
|
203
179
|
assert_equal(0, call_tree.self_time)
|
204
180
|
assert_equal(10, call_tree.children_time)
|
205
181
|
|
206
|
-
# Method
|
207
|
-
method = methods[
|
182
|
+
# Method 4
|
183
|
+
method = methods[4]
|
208
184
|
assert_equal('Integer#times', method.full_name)
|
209
185
|
assert_equal(10, method.total_time)
|
210
186
|
assert_equal(0, method.wait_time)
|
@@ -227,8 +203,8 @@ class MeasureAllocationsTest < TestCase
|
|
227
203
|
assert_equal(10, call_tree.self_time)
|
228
204
|
assert_equal(0, call_tree.children_time)
|
229
205
|
|
230
|
-
# Method
|
231
|
-
method = methods[
|
206
|
+
# Method 5
|
207
|
+
method = methods[5]
|
232
208
|
assert_equal('Allocator#make_hashes', method.full_name)
|
233
209
|
assert_equal(5, method.total_time)
|
234
210
|
assert_equal(0, method.wait_time)
|
@@ -237,7 +213,7 @@ class MeasureAllocationsTest < TestCase
|
|
237
213
|
|
238
214
|
assert_equal(1, method.call_trees.callers.length)
|
239
215
|
call_tree = method.call_trees.callers[0]
|
240
|
-
assert_equal('Allocator#
|
216
|
+
assert_equal('Allocator#run', call_tree.parent.target.full_name)
|
241
217
|
assert_equal(5, call_tree.total_time)
|
242
218
|
assert_equal(0, call_tree.wait_time)
|
243
219
|
assert_equal(0, call_tree.self_time)
|
@@ -251,8 +227,8 @@ class MeasureAllocationsTest < TestCase
|
|
251
227
|
assert_equal(5, call_tree.self_time)
|
252
228
|
assert_equal(0, call_tree.children_time)
|
253
229
|
|
254
|
-
# Method
|
255
|
-
method = methods[
|
230
|
+
# Method 6
|
231
|
+
method = methods[6]
|
256
232
|
assert_equal('Allocator#make_strings', method.full_name)
|
257
233
|
assert_equal(4, method.total_time)
|
258
234
|
assert_equal(0, method.wait_time)
|
@@ -261,7 +237,7 @@ class MeasureAllocationsTest < TestCase
|
|
261
237
|
|
262
238
|
assert_equal(1, method.call_trees.callers.length)
|
263
239
|
call_tree = method.call_trees.callers[0]
|
264
|
-
assert_equal('Allocator#
|
240
|
+
assert_equal('Allocator#run', call_tree.parent.target.full_name)
|
265
241
|
assert_equal(4, call_tree.total_time)
|
266
242
|
assert_equal(0, call_tree.wait_time)
|
267
243
|
assert_equal(1, call_tree.self_time)
|
@@ -282,8 +258,8 @@ class MeasureAllocationsTest < TestCase
|
|
282
258
|
assert_equal(1, call_tree.self_time)
|
283
259
|
assert_equal(1, call_tree.children_time)
|
284
260
|
|
285
|
-
# Method
|
286
|
-
method = methods[
|
261
|
+
# Method 7
|
262
|
+
method = methods[7]
|
287
263
|
assert_equal('String#*', method.full_name)
|
288
264
|
assert_equal(1, method.total_time)
|
289
265
|
assert_equal(0, method.wait_time)
|
@@ -300,8 +276,8 @@ class MeasureAllocationsTest < TestCase
|
|
300
276
|
|
301
277
|
assert_equal(0, method.call_trees.callees.length)
|
302
278
|
|
303
|
-
# Method
|
304
|
-
method = methods[
|
279
|
+
# Method 8
|
280
|
+
method = methods[8]
|
305
281
|
assert_equal('String#initialize', method.full_name)
|
306
282
|
assert_equal(1, method.total_time)
|
307
283
|
assert_equal(0, method.wait_time)
|
@@ -318,8 +294,8 @@ class MeasureAllocationsTest < TestCase
|
|
318
294
|
|
319
295
|
assert_equal(0, method.call_trees.callees.length)
|
320
296
|
|
321
|
-
# Method
|
322
|
-
method = methods[
|
297
|
+
# Method 9
|
298
|
+
method = methods[9]
|
323
299
|
assert_equal('BasicObject#initialize', method.full_name)
|
324
300
|
assert_equal(0, method.total_time)
|
325
301
|
assert_equal(0, method.wait_time)
|
@@ -336,8 +312,8 @@ class MeasureAllocationsTest < TestCase
|
|
336
312
|
|
337
313
|
assert_equal(0, method.call_trees.callees.length)
|
338
314
|
|
339
|
-
# Method
|
340
|
-
method = methods[
|
315
|
+
# Method 10
|
316
|
+
method = methods[10]
|
341
317
|
assert_equal('Hash#initialize', method.full_name)
|
342
318
|
assert_equal(0, method.total_time)
|
343
319
|
assert_equal(0, method.wait_time)
|
@@ -353,23 +329,5 @@ class MeasureAllocationsTest < TestCase
|
|
353
329
|
assert_equal(0, call_tree.children_time)
|
354
330
|
|
355
331
|
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
332
|
end
|
375
333
|
end
|