ruby-prof 1.4.3 → 1.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +30 -9
- data/{README.rdoc → README.md} +2 -2
- data/Rakefile +3 -3
- 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 +1 -1
- data/ext/ruby_prof/rp_measurement.h +1 -1
- data/ext/ruby_prof/rp_profile.c +18 -3
- data/ext/ruby_prof/vc/ruby_prof.vcxproj +8 -6
- data/lib/ruby-prof/assets/call_stack_printer.html.erb +2 -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/marshal_test.rb +15 -2
- data/test/measure_allocations.rb +1 -5
- data/test/measure_allocations_test.rb +643 -349
- data/test/{measure_memory_trace_test.rb → measure_memory_test.rb} +178 -605
- 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/recursive_test.rb +372 -148
- data/test/test_helper.rb +4 -8
- data/test/unique_call_path_test.rb +24 -8
- data/test/yarv_test.rb +8 -4
- metadata +10 -26
- data/test/measure_allocations_trace_test.rb +0 -375
- data/test/temp.rb +0 -20
data/test/yarv_test.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
require File.expand_path('../test_helper', __FILE__)
|
5
5
|
|
6
6
|
# tests for bugs reported by users
|
7
|
-
class
|
7
|
+
class YarvTest < TestCase
|
8
8
|
def setup
|
9
9
|
RubyProf::measure_mode = RubyProf::WALL_TIME
|
10
10
|
define_methods
|
@@ -16,7 +16,7 @@ class BugsTest < TestCase
|
|
16
16
|
a = self.array_push_unoptimized
|
17
17
|
end
|
18
18
|
assert_equal 2, a.length
|
19
|
-
assert_equal ["
|
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
|
@@ -24,8 +24,12 @@ class BugsTest < TestCase
|
|
24
24
|
result = RubyProf.profile do
|
25
25
|
a = self.array_push_optimized
|
26
26
|
end
|
27
|
-
assert_equal
|
28
|
-
|
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.
|
4
|
+
version: 1.4.5
|
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:
|
11
|
+
date: 2022-12-28 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,7 +55,7 @@ extra_rdoc_files: []
|
|
69
55
|
files:
|
70
56
|
- CHANGES
|
71
57
|
- LICENSE
|
72
|
-
- README.
|
58
|
+
- README.md
|
73
59
|
- Rakefile
|
74
60
|
- bin/ruby-prof
|
75
61
|
- bin/ruby-prof-check-trace
|
@@ -144,8 +130,7 @@ files:
|
|
144
130
|
- test/marshal_test.rb
|
145
131
|
- test/measure_allocations.rb
|
146
132
|
- test/measure_allocations_test.rb
|
147
|
-
- test/
|
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
|
@@ -167,7 +152,6 @@ files:
|
|
167
152
|
- test/singleton_test.rb
|
168
153
|
- test/stack_printer_test.rb
|
169
154
|
- test/start_stop_test.rb
|
170
|
-
- test/temp.rb
|
171
155
|
- test/test_helper.rb
|
172
156
|
- test/thread_test.rb
|
173
157
|
- test/unique_call_path_test.rb
|
@@ -179,8 +163,8 @@ metadata:
|
|
179
163
|
bug_tracker_uri: https://github.com/ruby-prof/ruby-prof/issues
|
180
164
|
changelog_uri: https://github.com/ruby-prof/ruby-prof/blob/master/CHANGES
|
181
165
|
documentation_uri: https://ruby-prof.github.io/
|
182
|
-
source_code_uri: https://github.com/ruby-prof/ruby-prof/tree/v1.4.
|
183
|
-
post_install_message:
|
166
|
+
source_code_uri: https://github.com/ruby-prof/ruby-prof/tree/v1.4.5
|
167
|
+
post_install_message:
|
184
168
|
rdoc_options: []
|
185
169
|
require_paths:
|
186
170
|
- lib
|
@@ -188,15 +172,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
188
172
|
requirements:
|
189
173
|
- - ">="
|
190
174
|
- !ruby/object:Gem::Version
|
191
|
-
version: 2.
|
175
|
+
version: 2.7.0
|
192
176
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
193
177
|
requirements:
|
194
178
|
- - ">="
|
195
179
|
- !ruby/object:Gem::Version
|
196
180
|
version: '0'
|
197
181
|
requirements: []
|
198
|
-
rubygems_version: 3.1
|
199
|
-
signing_key:
|
182
|
+
rubygems_version: 3.4.1
|
183
|
+
signing_key:
|
200
184
|
specification_version: 4
|
201
185
|
summary: Fast Ruby profiler
|
202
186
|
test_files:
|
@@ -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
|
data/test/temp.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'redis'
|
2
|
-
|
3
|
-
path = File.expand_path(File.join(__dir__, '..', 'lib'))
|
4
|
-
$LOAD_PATH << path
|
5
|
-
require 'ruby-prof'
|
6
|
-
|
7
|
-
Widget = Struct.new(:key) do
|
8
|
-
def set!
|
9
|
-
Redis.current.set(key, 1, ex: 10)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
result = RubyProf.profile do
|
14
|
-
(1..20).each { |i| Widget.new(i).set! }
|
15
|
-
end
|
16
|
-
|
17
|
-
printer = RubyProf::CallStackPrinter.new(result)
|
18
|
-
File.open("framez.html", 'w:ASCII-8BIT') do |file|
|
19
|
-
printer.print(file, {})
|
20
|
-
end
|