ruby-prof 1.6.1-x64-mingw-ucrt → 1.6.3-x64-mingw-ucrt

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b366b0cde0e477d0b06b95b8bcb7f2d0c8747216b9cc8fcdf2c202e89a3106d6
4
- data.tar.gz: 21239104377ef6a1479c4110dcd4cd2e2b086d75cd577a3531102799f19b8061
3
+ metadata.gz: 64892324d0beb77fe9a75baf53c029c0e3be929330dc60bd6e637a16163022d7
4
+ data.tar.gz: 4191109bbd215cc01dc8c3476edfb6700690cd5bc0035c31b622476decdf16a1
5
5
  SHA512:
6
- metadata.gz: 6aa08fee0a9d16b9276867db6f7465286cae2d118738ff20e78bca8eae764bf9a6657bf93678b0f3430f2998c11117022e6bd6d732d29021bc4fb3b5e6f34615
7
- data.tar.gz: b34eb2eb7e9bfb6567292ead8d625a3fd71533d3d2ed87be0798ab9e4e5def42a86768b02605f64048b25fbc90c2b736c5b1c4add494900c8250bfcf480e728d
6
+ metadata.gz: a789179d62a9fb36b8660a55746ba91cd767985e42e92a64e25ee448a17757161a90cc15ac572b1368faae18b84222059d2b5331c62486578ca967a92a30363c
7
+ data.tar.gz: 33c6c79f3f6a268200a517e36b94c35a191ed4110b1f4d5114d1da874792aadd88f364c16f5604253a239ca2dd04427ff189fb8d753210ada949dd573253bc36
data/CHANGES CHANGED
@@ -1,3 +1,13 @@
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
+
1
11
  1.6.1 (2023-02-21)
2
12
  =====================
3
13
  * Fix loading C extension for MacOS (Charlie Savage)
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
- # -p, --printer=printer Select a printer:
20
- # flat - Prints a flat profile as text (default).
21
- # graph - Prints a graph profile as text.
22
- # graph_html - Prints a graph profile as html.
23
- # call_tree - format for KCacheGrind
24
- # call_stack - prints a HTML visualization of the call tree
25
- # dot - Prints a graph profile as a dot file
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
- # --allow_exceptions Raise exceptions encountered during profiling (true) or suppress them (false)
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('-p printer', '--printer=printer', [:flat, :flat_with_line_numbers, :graph, :graph_html, :call_tree, :call_stack, :dot, :multi],
122
- 'Select a printer:',
123
- ' flat - Prints a flat profile as text (default).',
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
- case printer
133
- when :flat
134
- options.printer = RubyProf::FlatPrinter
135
- when :graph
136
- options.printer = RubyProf::GraphPrinter
137
- when :graph_html
138
- options.printer = RubyProf::GraphHtmlPrinter
139
- when :call_tree
140
- options.printer = RubyProf::CallTreePrinter
141
- when :call_stack
142
- options.printer = RubyProf::CallStackPrinter
143
- when :dot
144
- options.printer = RubyProf::DotPrinter
145
- when :multi
146
- options.printer = RubyProf::MultiPrinter
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('-m min_percent', '--min_percent=min_percent', Float,
151
- 'The minimum percent a method must take before ',
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.on_tail("-h", "--help", "Show help message") do
203
- puts opts
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.on('--allow_exceptions', 'Raise exceptions encountered during profiling (true) or suppress them (false)') do
213
- options.allow_exceptions = true
214
- end
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
- script = ARGV.shift
285
- @profile = Profile.new(options.to_h)
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, :sort_method => cmd.options.sort_method}
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