ruby-prof 1.4.3 → 1.6.3
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.
- checksums.yaml +4 -4
- data/CHANGES +59 -9
- data/{README.rdoc → README.md} +2 -2
- data/Rakefile +4 -4
- data/bin/ruby-prof +100 -87
- data/ext/ruby_prof/rp_allocation.c +140 -85
- data/ext/ruby_prof/rp_allocation.h +8 -6
- data/ext/ruby_prof/rp_call_tree.c +502 -369
- data/ext/ruby_prof/rp_call_tree.h +47 -43
- data/ext/ruby_prof/rp_call_trees.c +16 -8
- 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 +147 -20
- data/ext/ruby_prof/rp_measurement.h +4 -1
- data/ext/ruby_prof/rp_method.c +142 -83
- data/ext/ruby_prof/rp_method.h +63 -62
- data/ext/ruby_prof/rp_profile.c +933 -900
- data/ext/ruby_prof/rp_profile.h +1 -0
- data/ext/ruby_prof/rp_thread.c +433 -362
- data/ext/ruby_prof/rp_thread.h +39 -39
- data/ext/ruby_prof/ruby_prof.c +0 -2
- data/ext/ruby_prof/ruby_prof.h +8 -0
- data/ext/ruby_prof/vc/ruby_prof.vcxproj +11 -8
- data/lib/ruby-prof/assets/call_stack_printer.html.erb +2 -1
- data/lib/ruby-prof/compatibility.rb +14 -0
- data/lib/ruby-prof/method_info.rb +8 -1
- data/lib/ruby-prof/printers/abstract_printer.rb +2 -1
- data/lib/ruby-prof/printers/call_tree_printer.rb +4 -10
- data/lib/ruby-prof/printers/graph_html_printer.rb +1 -1
- data/lib/ruby-prof/printers/multi_printer.rb +17 -17
- data/lib/ruby-prof/profile.rb +70 -37
- data/lib/ruby-prof/rack.rb +31 -21
- data/lib/ruby-prof/version.rb +1 -1
- data/lib/ruby-prof.rb +1 -1
- data/ruby-prof.gemspec +2 -3
- data/test/abstract_printer_test.rb +1 -0
- data/test/alias_test.rb +97 -106
- data/test/call_tree_builder.rb +126 -0
- data/test/call_tree_test.rb +94 -0
- data/test/call_tree_visitor_test.rb +1 -6
- data/test/call_trees_test.rb +6 -6
- data/test/{basic_test.rb → compatibility_test.rb} +8 -2
- data/test/duplicate_names_test.rb +5 -5
- data/test/dynamic_method_test.rb +24 -15
- data/test/enumerable_test.rb +1 -1
- data/test/exceptions_test.rb +2 -2
- data/test/exclude_methods_test.rb +3 -8
- data/test/exclude_threads_test.rb +4 -9
- data/test/fiber_test.rb +74 -8
- data/test/gc_test.rb +11 -9
- data/test/inverse_call_tree_test.rb +33 -34
- data/test/line_number_test.rb +37 -61
- data/test/marshal_test.rb +16 -3
- data/test/measure_allocations.rb +1 -5
- data/test/measure_allocations_test.rb +642 -357
- data/test/{measure_memory_trace_test.rb → measure_memory_test.rb} +180 -616
- data/test/measure_process_time_test.rb +1566 -741
- data/test/measure_wall_time_test.rb +179 -193
- data/test/measurement_test.rb +82 -0
- data/test/merge_test.rb +146 -0
- data/test/method_info_test.rb +95 -0
- data/test/multi_printer_test.rb +0 -5
- data/test/no_method_class_test.rb +1 -1
- data/test/pause_resume_test.rb +12 -16
- data/test/printer_call_stack_test.rb +2 -2
- data/test/printer_call_tree_test.rb +4 -4
- data/test/printer_flat_test.rb +1 -1
- data/test/printer_graph_html_test.rb +2 -2
- data/test/printer_graph_test.rb +2 -2
- data/test/printers_test.rb +14 -20
- data/test/printing_recursive_graph_test.rb +2 -2
- data/test/profile_test.rb +85 -0
- data/test/recursive_test.rb +374 -155
- data/test/scheduler.rb +363 -0
- data/test/singleton_test.rb +1 -1
- data/test/stack_printer_test.rb +5 -8
- data/test/start_stop_test.rb +11 -14
- data/test/test_helper.rb +11 -8
- data/test/thread_test.rb +106 -15
- data/test/unique_call_path_test.rb +28 -12
- data/test/yarv_test.rb +11 -7
- metadata +17 -29
- data/ext/ruby_prof/rp_aggregate_call_tree.c +0 -59
- data/ext/ruby_prof/rp_aggregate_call_tree.h +0 -13
- data/test/measure_allocations_trace_test.rb +0 -375
- data/test/temp.rb +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 416c147d8497f94d50b9b142596873a4f3bd5c9809bb5079f229fa413f626497
|
4
|
+
data.tar.gz: a7cceb2728e182181bac58ecd791a2d425be2e33c6ab1314a8fa66758a4d2ee1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 754d7fd2b208eb398cbb5a3fb6830dc78f0164f0f0ee3024314587982a16a6329c9ae2b54f525d425ec13c2aac54209dfc97febc5920ca72b34aa9c8004c787d
|
7
|
+
data.tar.gz: 076c3bb65e7d71c036e8b393dd74ab51b6d4be4428998445e0c8af1e16f2ce384c36ba7a5417661933eb40d522dcee274a7040e26dd1a4eb2352a395e1fc8ed9
|
data/CHANGES
CHANGED
@@ -1,15 +1,65 @@
|
|
1
|
-
1.
|
1
|
+
1.6.3 (2023-04-20)
|
2
|
+
=====================
|
3
|
+
* Remove debug code unintentionally left in ruby-prof command line program (Charlie Savage)
|
4
|
+
|
5
|
+
1.6.2 (2023-04-17)
|
6
|
+
=====================
|
7
|
+
* Fix Profile#merge! implementation (asksurya)
|
8
|
+
* Fix ruby-prof command line program (Charlie Savage)
|
9
|
+
* Added CMakeLists.txt file (Charlie Savage)
|
10
|
+
|
11
|
+
1.6.1 (2023-02-21)
|
12
|
+
=====================
|
13
|
+
* Fix loading C extension for MacOS (Charlie Savage)
|
14
|
+
|
15
|
+
1.6.0 (2023-02-20)
|
16
|
+
=====================
|
17
|
+
* Add support for Ruby's compacting garbage collector (Charlie Savage)
|
18
|
+
* Add rbs signature files (Charlie Savage)
|
19
|
+
* Update rack adapter used for profiling Rails to include latest ruby-prof features (Charlie Savage)
|
20
|
+
* Add warnings for deprecated methods (Charlie Savage)
|
21
|
+
* Update tests to not use deprecated methods (Charlie Savage)
|
22
|
+
* Improve tests on OSX (Charlie Savage)
|
23
|
+
|
24
|
+
1.5.0 (2023-02-06)
|
25
|
+
=====================
|
26
|
+
* Add new Profile#merge! method that merges results for threads/fibers that share the same root method (Charlie Savage)
|
27
|
+
* Expand API to allow creation of +Measurement+, +CallTree+, +MethodInfo+ and +Thread+ instances. This
|
28
|
+
was done to make is possible to write tests for the new Profile#merge! functionality (Charlie Savage)
|
29
|
+
|
30
|
+
1.4.5 (2022-12-27)
|
31
|
+
=====================
|
32
|
+
* Look for ruby_prof extension built on install in the lib directory (Charlie Savage)
|
33
|
+
* Added Ruby 3.2.0 build for mingw-urct
|
34
|
+
|
35
|
+
1.4.4 (2022-12-11)
|
36
|
+
=====================
|
37
|
+
* Update tests for Ruby 3.1 (Charlie Savage)
|
38
|
+
* When tracing allocations always use the RUBY_INTERNAL_EVENT_NEWOBJ trace event. Previously GC stats could also be used, but that includes the creation of internal T_IMEMO objects makes reviewing results confusing (Charlie Savage)
|
39
|
+
* Remove :profile option that lets a user set the prefix on callgrind output files since KCacheGrind will not automatically show these files in its open dialog. Fixes #313. (Charlie Savage)
|
40
|
+
* Don't expose threads to Ruby that don't have a call tree. This can happen when a user is profiling memory usage and then sends a signint to the profiled process. New objects will be created in a new thread, but no method enter/exit trace events are generated by Ruby. Thus the thread has no call tree. Fixes #312 (Charlie Savage)
|
41
|
+
* Update github Actions - change 3.0 to '3.0', add Windows mswin (MSP-Greg)
|
42
|
+
* Add Ruby 3.1 to test matrix (Charlie Savage)
|
43
|
+
* Use normal weight text instead of bold in call strack printer output. Fixes #297 (Charlie Savage)
|
44
|
+
* Update VC project to Ruby 3.1 and Visual Studio 2022 (Charlie Savage)
|
45
|
+
* Fix marshaling of profile measure. Fixes #315 (Charlie Savage)
|
46
|
+
* CI: Omit duplicate 'bundle install'. PR #309 (Olle Jonsson)
|
47
|
+
* Fix typo. s/perecent/percent/ (Paarth Madan)
|
48
|
+
* Remove support for Ruby 2.5 and 2.6 which are now end of life (Charlie Savage)
|
49
|
+
|
50
|
+
1.4.3 (2021-02-16)
|
2
51
|
=====================
|
3
52
|
* Remove trailing spaces (sergioro)
|
4
|
-
*
|
5
|
-
*
|
53
|
+
* Load "ruby-prof.so" with require_relative (sergioro)
|
54
|
+
* Use same file permissions for all test files (sergioro)
|
55
|
+
* Create tmp directory for test output (sergioro)
|
56
|
+
* Update git-ignore to add mkmf log (sergioro)
|
6
57
|
* Fix minitest warning about using MT_CPU instead of N (sergioro)
|
7
|
-
* Fix minitest warning "Use assert_nil if expecting nil
|
8
|
-
*
|
9
|
-
*
|
10
|
-
*
|
11
|
-
*
|
12
|
-
* Greatly slim down library size by removing symbols on GCC (Charlie Savage)
|
58
|
+
* Fix minitest warning "Use assert_nil if expecting nil (sergioro)
|
59
|
+
* Add xcode project (Charlie Savage)
|
60
|
+
* Update test for Ruby 3.0 (Charlie Savage)
|
61
|
+
* Remove Ruby 2.4 support since it is no longer maintained (Charlie Savage)
|
62
|
+
* Replace travis status badge with github status badge (Charlie Savage)
|
13
63
|
|
14
64
|
1.4.2 (2020-11-3)
|
15
65
|
=====================
|
data/{README.rdoc → README.md}
RENAMED
data/Rakefile
CHANGED
@@ -42,7 +42,7 @@ end
|
|
42
42
|
Rake::Task[:package].enhance [:rdoc]
|
43
43
|
|
44
44
|
# Setup Windows Gem
|
45
|
-
if RUBY_PLATFORM.match(/
|
45
|
+
if RUBY_PLATFORM.match(/mswin|mingw/)
|
46
46
|
# Windows specification
|
47
47
|
win_spec = default_spec.clone
|
48
48
|
win_spec.platform = Gem::Platform::CURRENT
|
@@ -61,17 +61,17 @@ end
|
|
61
61
|
desc "Generate rdoc documentation"
|
62
62
|
RDoc::Task.new("rdoc") do |rdoc|
|
63
63
|
rdoc.rdoc_dir = 'doc'
|
64
|
-
rdoc.title
|
64
|
+
rdoc.title = "ruby-prof"
|
65
65
|
# Show source inline with line numbers
|
66
66
|
rdoc.options << "--line-numbers"
|
67
67
|
# Make the readme file the start page for the generated html
|
68
|
-
rdoc.options << '--main' << 'README.
|
68
|
+
rdoc.options << '--main' << 'README.md'
|
69
69
|
rdoc.rdoc_files.include('bin/*',
|
70
70
|
'doc/*.rdoc',
|
71
71
|
'lib/**/*.rb',
|
72
72
|
'ext/ruby_prof/*.c',
|
73
73
|
'ext/ruby_prof/*.h',
|
74
|
-
'README.
|
74
|
+
'README.md',
|
75
75
|
'LICENSE')
|
76
76
|
end
|
77
77
|
|
data/bin/ruby-prof
CHANGED
@@ -16,37 +16,38 @@ module RubyProf
|
|
16
16
|
# ruby-prof [options] <script.rb> [--] [profiled-script-command-line-options]
|
17
17
|
#
|
18
18
|
# Options:
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
# multi - Creates several reports in output directory
|
19
|
+
# --allow_exceptions Raise exceptions encountered during profiling (true) or suppress them (false)
|
20
|
+
# -E, --eval-noprof=code execute the ruby statements (not profiled)
|
21
|
+
# --exclude=methods A comma separated list of methods to exclude.
|
22
|
+
# Specify instance methods via # (Integer#times)
|
23
|
+
# Specify class methods via . (Integer.superclass)
|
24
|
+
# --exclude-common Remove common methods from the profile
|
25
|
+
# -f, --file=path Output results to a file instead of standard out.
|
27
26
|
# -m, --min_percent=min_percent The minimum percent a method must take before
|
28
27
|
# being included in output reports.
|
29
28
|
# This option is not supported for call tree.
|
30
|
-
# -f, --file=path Output results to a file instead of standard out.
|
31
29
|
# --mode=measure_mode Select what ruby-prof should measure:
|
32
30
|
# wall - Wall time (default).
|
33
31
|
# process - Process time.
|
34
32
|
# allocations - Object allocations (requires patched Ruby interpreter).
|
35
33
|
# memory - Allocated memory in KB (requires patched Ruby interpreter).
|
34
|
+
# -p, --printer=printer Select a printer:
|
35
|
+
# flat - Prints a flat profile as text (default).
|
36
|
+
# graph - Prints a graph profile as text.
|
37
|
+
# graph_html - Prints a graph profile as html.
|
38
|
+
# call_tree - format for KCacheGrind
|
39
|
+
# call_stack - prints a HTML visualization of the call tree
|
40
|
+
# dot - Prints a graph profile as a dot file
|
41
|
+
# multi - Creates several reports in output directory
|
42
|
+
# -R, --require-noprof=lib require a specific library (not profiled)
|
36
43
|
# -s, --sort=sort_mode Select how ruby-prof results should be sorted:
|
37
44
|
# total - Total time
|
38
45
|
# self - Self time
|
39
46
|
# wait - Wait time
|
40
47
|
# child - Child time
|
41
|
-
# --
|
42
|
-
# -R, --require-noprof=lib require a specific library (not profiled)
|
43
|
-
# -E, --eval-noprof=code execute the ruby statements (not profiled)
|
44
|
-
# --exclude=methods A comma separated list of methods to exclude.
|
45
|
-
# Specify instance methods via # (Integer#times)
|
46
|
-
# Specify class methods via . (Integer.superclass)
|
47
|
-
# --exclude-common Remove common methods from the profile
|
48
|
-
# -h, --help Show help message
|
48
|
+
# --track_allocations Track allocations while profiling
|
49
49
|
# -v, --version version Show version (1.1.0)
|
50
|
+
# -h, --help Show help message
|
50
51
|
|
51
52
|
class Cmd
|
52
53
|
# :enddoc:
|
@@ -63,15 +64,16 @@ module RubyProf
|
|
63
64
|
|
64
65
|
def setup_options
|
65
66
|
@options = OpenStruct.new
|
66
|
-
options.printer = RubyProf::FlatPrinter
|
67
|
-
options.measure_mode = RubyProf::WALL_TIME
|
68
|
-
options.min_percent = 0
|
69
|
-
options.file = nil
|
70
67
|
options.allow_exceptions = false
|
71
|
-
options.exclude_common = false
|
72
68
|
options.exclude = Array.new
|
69
|
+
options.exclude_common = false
|
70
|
+
options.file = nil
|
71
|
+
options.measure_mode = RubyProf::WALL_TIME
|
72
|
+
options.min_percent = 0
|
73
73
|
options.pre_libs = Array.new
|
74
74
|
options.pre_execs = Array.new
|
75
|
+
options.printer = RubyProf::FlatPrinter
|
76
|
+
options.track_allocations = false
|
75
77
|
end
|
76
78
|
|
77
79
|
# This is copied from ActiveSupport:
|
@@ -118,40 +120,31 @@ module RubyProf
|
|
118
120
|
opts.separator ""
|
119
121
|
opts.separator "Options:"
|
120
122
|
|
121
|
-
opts.on('
|
122
|
-
|
123
|
-
|
124
|
-
' graph - Prints a graph profile as text.',
|
125
|
-
' graph_html - Prints a graph profile as html.',
|
126
|
-
' call_tree - format for KCacheGrind',
|
127
|
-
' call_stack - prints a HTML visualization of the call tree',
|
128
|
-
' dot - Prints a graph profile as a dot file',
|
129
|
-
' multi - Creates several reports in output directory'
|
130
|
-
) do |printer|
|
123
|
+
opts.on('--allow_exceptions', 'Raise exceptions encountered during profiling (true) or suppress them (false)') do
|
124
|
+
options.allow_exceptions = true
|
125
|
+
end
|
131
126
|
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
127
|
+
opts.on('-E code', '--eval-noprof=code', 'execute the ruby statements (not profiled)') do |code|
|
128
|
+
options.pre_execs << code
|
129
|
+
end
|
130
|
+
|
131
|
+
opts.on('--exclude=methods', String,
|
132
|
+
'A comma separated list of methods to exclude.',
|
133
|
+
' Specify instance methods via # (Integer#times)',
|
134
|
+
' Specify class methods via . (Integer.superclass)') do |exclude_string|
|
135
|
+
exclude_string.split(',').each do |string|
|
136
|
+
match = string.strip.match(/(.*)(#|\.)(.*)/)
|
137
|
+
klass = constantize(match[1])
|
138
|
+
if match[2] == '.'
|
139
|
+
klass = klass.singleton_class
|
140
|
+
end
|
141
|
+
method = match[3].to_sym
|
142
|
+
options.exclude << [klass, method]
|
147
143
|
end
|
148
144
|
end
|
149
145
|
|
150
|
-
opts.on('-
|
151
|
-
|
152
|
-
' being included in output reports.',
|
153
|
-
' This option is not supported for call tree.') do |min_percent|
|
154
|
-
options.min_percent = min_percent
|
146
|
+
opts.on('--exclude-common', 'Remove common methods from the profile') do
|
147
|
+
options.exclude_common = true
|
155
148
|
end
|
156
149
|
|
157
150
|
opts.on('-f path', '--file=path',
|
@@ -160,6 +153,13 @@ module RubyProf
|
|
160
153
|
options.old_wd = Dir.pwd
|
161
154
|
end
|
162
155
|
|
156
|
+
opts.on('-m min_percent', '--min_percent=min_percent', Float,
|
157
|
+
'The minimum percent a method must take before ',
|
158
|
+
' being included in output reports.',
|
159
|
+
' This option is not supported for call tree.') do |min_percent|
|
160
|
+
options.min_percent = min_percent
|
161
|
+
end
|
162
|
+
|
163
163
|
opts.on('--mode=measure_mode',
|
164
164
|
[:process, :wall, :allocations, :memory],
|
165
165
|
'Select what ruby-prof should measure:',
|
@@ -180,6 +180,39 @@ module RubyProf
|
|
180
180
|
end
|
181
181
|
end
|
182
182
|
|
183
|
+
opts.on('-p printer', '--printer=printer', [:flat, :flat_with_line_numbers, :graph, :graph_html, :call_tree, :call_stack, :dot, :multi],
|
184
|
+
'Select a printer:',
|
185
|
+
' flat - Prints a flat profile as text (default).',
|
186
|
+
' graph - Prints a graph profile as text.',
|
187
|
+
' graph_html - Prints a graph profile as html.',
|
188
|
+
' call_tree - format for KCacheGrind',
|
189
|
+
' call_stack - prints a HTML visualization of the call tree',
|
190
|
+
' dot - Prints a graph profile as a dot file',
|
191
|
+
' multi - Creates several reports in output directory'
|
192
|
+
) do |printer|
|
193
|
+
|
194
|
+
case printer
|
195
|
+
when :flat
|
196
|
+
options.printer = RubyProf::FlatPrinter
|
197
|
+
when :graph
|
198
|
+
options.printer = RubyProf::GraphPrinter
|
199
|
+
when :graph_html
|
200
|
+
options.printer = RubyProf::GraphHtmlPrinter
|
201
|
+
when :call_tree
|
202
|
+
options.printer = RubyProf::CallTreePrinter
|
203
|
+
when :call_stack
|
204
|
+
options.printer = RubyProf::CallStackPrinter
|
205
|
+
when :dot
|
206
|
+
options.printer = RubyProf::DotPrinter
|
207
|
+
when :multi
|
208
|
+
options.printer = RubyProf::MultiPrinter
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
opts.on('-R lib', '--require-noprof=lib', 'require a specific library (not profiled)') do |lib|
|
213
|
+
options.pre_libs << lib
|
214
|
+
end
|
215
|
+
|
183
216
|
opts.on('-s sort_mode', '--sort=sort_mode', [:total, :self, :wait, :child],
|
184
217
|
'Select how ruby-prof results should be sorted:',
|
185
218
|
' total - Total time',
|
@@ -199,9 +232,8 @@ module RubyProf
|
|
199
232
|
end
|
200
233
|
end
|
201
234
|
|
202
|
-
opts.
|
203
|
-
|
204
|
-
exit
|
235
|
+
opts.on('--track_allocations', 'Track allocations while profiling') do
|
236
|
+
options.track_allocations = true
|
205
237
|
end
|
206
238
|
|
207
239
|
opts.on_tail("-v version", "--version", "Show version (#{RubyProf::VERSION})") do
|
@@ -209,35 +241,9 @@ module RubyProf
|
|
209
241
|
exit
|
210
242
|
end
|
211
243
|
|
212
|
-
opts.
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
opts.on('-R lib', '--require-noprof=lib', 'require a specific library (not profiled)') do |lib|
|
217
|
-
options.pre_libs << lib
|
218
|
-
end
|
219
|
-
|
220
|
-
opts.on('-E code', '--eval-noprof=code', 'execute the ruby statements (not profiled)') do |code|
|
221
|
-
options.pre_execs << code
|
222
|
-
end
|
223
|
-
|
224
|
-
opts.on('--exclude=methods', String,
|
225
|
-
'A comma separated list of methods to exclude.',
|
226
|
-
' Specify instance methods via # (Integer#times)',
|
227
|
-
' Specify class methods via . (Integer.superclass)') do |exclude_string|
|
228
|
-
exclude_string.split(',').each do |string|
|
229
|
-
match = string.strip.match(/(.*)(#|\.)(.*)/)
|
230
|
-
klass = constantize(match[1])
|
231
|
-
if match[2] == '.'
|
232
|
-
klass = klass.singleton_class
|
233
|
-
end
|
234
|
-
method = match[3].to_sym
|
235
|
-
options.exclude << [klass, method]
|
236
|
-
end
|
237
|
-
end
|
238
|
-
|
239
|
-
opts.on('--exclude-common', 'Remove common methods from the profile') do
|
240
|
-
options.exclude_common = true
|
244
|
+
opts.on_tail("-h", "--help", "Show help message") do
|
245
|
+
puts opts
|
246
|
+
exit
|
241
247
|
end
|
242
248
|
end
|
243
249
|
end
|
@@ -281,12 +287,18 @@ module RubyProf
|
|
281
287
|
end
|
282
288
|
|
283
289
|
def run
|
284
|
-
|
285
|
-
|
290
|
+
profile_options = {:allow_exceptions => options.allow_exceptions,
|
291
|
+
:exclude_common => options.exclude_common,
|
292
|
+
:measure_mode => options.measure_mode,
|
293
|
+
:track_allocations => options.track_allocations}
|
294
|
+
|
295
|
+
@profile = Profile.new(**profile_options)
|
296
|
+
|
286
297
|
options.exclude.each do |klass, method|
|
287
298
|
@profile.exclude_method!(klass, method)
|
288
299
|
end
|
289
300
|
|
301
|
+
script = ARGV.shift
|
290
302
|
profile.profile do
|
291
303
|
load script
|
292
304
|
end
|
@@ -304,7 +316,8 @@ cmd = RubyProf::Cmd.new
|
|
304
316
|
at_exit {
|
305
317
|
# Create a printer
|
306
318
|
printer = cmd.options.printer.new(cmd.profile)
|
307
|
-
printer_options = {:min_percent => cmd.options.min_percent,
|
319
|
+
printer_options = {:min_percent => cmd.options.min_percent,
|
320
|
+
:sort_method => cmd.options.sort_method}
|
308
321
|
|
309
322
|
# Get output
|
310
323
|
if cmd.options.file
|