ruby-prof 1.6.1-x64-mingw-ucrt → 1.6.2-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: 4b4e4760579e79fbe1f366a04b3fe39aad288034c2db4ac4683c0f892ac3b8e7
4
+ data.tar.gz: a1a82b7f129560014af92d6256f6e4a0ef06ee909cf2fff7fd643e92ab92f770
5
5
  SHA512:
6
- metadata.gz: 6aa08fee0a9d16b9276867db6f7465286cae2d118738ff20e78bca8eae764bf9a6657bf93678b0f3430f2998c11117022e6bd6d732d29021bc4fb3b5e6f34615
7
- data.tar.gz: b34eb2eb7e9bfb6567292ead8d625a3fd71533d3d2ed87be0798ab9e4e5def42a86768b02605f64048b25fbc90c2b736c5b1c4add494900c8250bfcf480e728d
6
+ metadata.gz: 58af0b67459d001ba4781b4d25544fb3d75d6806877c4695b2fd41357333bc5e8ba8b9425e7ed8b8f3aba6daaf00f32b5045757ca1284d1aa0eb131f51dcbbec
7
+ data.tar.gz: f3c3e5953671deca67472e3740bd5757dc2cab05cb4c364080e43d5b33803611b404351fbadf5402ad6118974957db40df3fa858d736231c3269c6a1e4d3995f
data/CHANGES CHANGED
@@ -1,3 +1,9 @@
1
+ 1.6.2 (2023-04-17)
2
+ =====================
3
+ * Fix Profile#merge! implementation (asksurya)
4
+ * Fix ruby-prof command line program (Charlie Savage)
5
+ * Added CMakeLists.txt file (Charlie Savage)
6
+
1
7
  1.6.1 (2023-02-21)
2
8
  =====================
3
9
  * Fix loading C extension for MacOS (Charlie Savage)
data/bin/ruby-prof CHANGED
@@ -1,5 +1,10 @@
1
1
  #! /usr/bin/env ruby
2
2
 
3
+ # To make testing/debugging easier test within this source tree versus an installed gem
4
+ require 'bundler/setup'
5
+ ext_path = File.expand_path(File.join(__dir__, '..', 'ext', 'ruby_prof'))
6
+ $LOAD_PATH.unshift(File.expand_path(ext_path))
7
+
3
8
  # First require ruby-prof
4
9
  require 'ruby-prof'
5
10
 
@@ -16,37 +21,38 @@ module RubyProf
16
21
  # ruby-prof [options] <script.rb> [--] [profiled-script-command-line-options]
17
22
  #
18
23
  # 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
24
+ # --allow_exceptions Raise exceptions encountered during profiling (true) or suppress them (false)
25
+ # -E, --eval-noprof=code execute the ruby statements (not profiled)
26
+ # --exclude=methods A comma separated list of methods to exclude.
27
+ # Specify instance methods via # (Integer#times)
28
+ # Specify class methods via . (Integer.superclass)
29
+ # --exclude-common Remove common methods from the profile
30
+ # -f, --file=path Output results to a file instead of standard out.
27
31
  # -m, --min_percent=min_percent The minimum percent a method must take before
28
32
  # being included in output reports.
29
33
  # This option is not supported for call tree.
30
- # -f, --file=path Output results to a file instead of standard out.
31
34
  # --mode=measure_mode Select what ruby-prof should measure:
32
35
  # wall - Wall time (default).
33
36
  # process - Process time.
34
37
  # allocations - Object allocations (requires patched Ruby interpreter).
35
38
  # memory - Allocated memory in KB (requires patched Ruby interpreter).
39
+ # -p, --printer=printer Select a printer:
40
+ # flat - Prints a flat profile as text (default).
41
+ # graph - Prints a graph profile as text.
42
+ # graph_html - Prints a graph profile as html.
43
+ # call_tree - format for KCacheGrind
44
+ # call_stack - prints a HTML visualization of the call tree
45
+ # dot - Prints a graph profile as a dot file
46
+ # multi - Creates several reports in output directory
47
+ # -R, --require-noprof=lib require a specific library (not profiled)
36
48
  # -s, --sort=sort_mode Select how ruby-prof results should be sorted:
37
49
  # total - Total time
38
50
  # self - Self time
39
51
  # wait - Wait time
40
52
  # 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
53
+ # --track_allocations Track allocations while profiling
49
54
  # -v, --version version Show version (1.1.0)
55
+ # -h, --help Show help message
50
56
 
51
57
  class Cmd
52
58
  # :enddoc:
@@ -63,15 +69,16 @@ module RubyProf
63
69
 
64
70
  def setup_options
65
71
  @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
72
  options.allow_exceptions = false
71
- options.exclude_common = false
72
73
  options.exclude = Array.new
74
+ options.exclude_common = false
75
+ options.file = nil
76
+ options.measure_mode = RubyProf::WALL_TIME
77
+ options.min_percent = 0
73
78
  options.pre_libs = Array.new
74
79
  options.pre_execs = Array.new
80
+ options.printer = RubyProf::FlatPrinter
81
+ options.track_allocations = false
75
82
  end
76
83
 
77
84
  # This is copied from ActiveSupport:
@@ -118,40 +125,31 @@ module RubyProf
118
125
  opts.separator ""
119
126
  opts.separator "Options:"
120
127
 
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|
128
+ opts.on('--allow_exceptions', 'Raise exceptions encountered during profiling (true) or suppress them (false)') do
129
+ options.allow_exceptions = true
130
+ end
131
131
 
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
132
+ opts.on('-E code', '--eval-noprof=code', 'execute the ruby statements (not profiled)') do |code|
133
+ options.pre_execs << code
134
+ end
135
+
136
+ opts.on('--exclude=methods', String,
137
+ 'A comma separated list of methods to exclude.',
138
+ ' Specify instance methods via # (Integer#times)',
139
+ ' Specify class methods via . (Integer.superclass)') do |exclude_string|
140
+ exclude_string.split(',').each do |string|
141
+ match = string.strip.match(/(.*)(#|\.)(.*)/)
142
+ klass = constantize(match[1])
143
+ if match[2] == '.'
144
+ klass = klass.singleton_class
145
+ end
146
+ method = match[3].to_sym
147
+ options.exclude << [klass, method]
147
148
  end
148
149
  end
149
150
 
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
151
+ opts.on('--exclude-common', 'Remove common methods from the profile') do
152
+ options.exclude_common = true
155
153
  end
156
154
 
157
155
  opts.on('-f path', '--file=path',
@@ -160,6 +158,13 @@ module RubyProf
160
158
  options.old_wd = Dir.pwd
161
159
  end
162
160
 
161
+ opts.on('-m min_percent', '--min_percent=min_percent', Float,
162
+ 'The minimum percent a method must take before ',
163
+ ' being included in output reports.',
164
+ ' This option is not supported for call tree.') do |min_percent|
165
+ options.min_percent = min_percent
166
+ end
167
+
163
168
  opts.on('--mode=measure_mode',
164
169
  [:process, :wall, :allocations, :memory],
165
170
  'Select what ruby-prof should measure:',
@@ -180,6 +185,39 @@ module RubyProf
180
185
  end
181
186
  end
182
187
 
188
+ opts.on('-p printer', '--printer=printer', [:flat, :flat_with_line_numbers, :graph, :graph_html, :call_tree, :call_stack, :dot, :multi],
189
+ 'Select a printer:',
190
+ ' flat - Prints a flat profile as text (default).',
191
+ ' graph - Prints a graph profile as text.',
192
+ ' graph_html - Prints a graph profile as html.',
193
+ ' call_tree - format for KCacheGrind',
194
+ ' call_stack - prints a HTML visualization of the call tree',
195
+ ' dot - Prints a graph profile as a dot file',
196
+ ' multi - Creates several reports in output directory'
197
+ ) do |printer|
198
+
199
+ case printer
200
+ when :flat
201
+ options.printer = RubyProf::FlatPrinter
202
+ when :graph
203
+ options.printer = RubyProf::GraphPrinter
204
+ when :graph_html
205
+ options.printer = RubyProf::GraphHtmlPrinter
206
+ when :call_tree
207
+ options.printer = RubyProf::CallTreePrinter
208
+ when :call_stack
209
+ options.printer = RubyProf::CallStackPrinter
210
+ when :dot
211
+ options.printer = RubyProf::DotPrinter
212
+ when :multi
213
+ options.printer = RubyProf::MultiPrinter
214
+ end
215
+ end
216
+
217
+ opts.on('-R lib', '--require-noprof=lib', 'require a specific library (not profiled)') do |lib|
218
+ options.pre_libs << lib
219
+ end
220
+
183
221
  opts.on('-s sort_mode', '--sort=sort_mode', [:total, :self, :wait, :child],
184
222
  'Select how ruby-prof results should be sorted:',
185
223
  ' total - Total time',
@@ -199,9 +237,8 @@ module RubyProf
199
237
  end
200
238
  end
201
239
 
202
- opts.on_tail("-h", "--help", "Show help message") do
203
- puts opts
204
- exit
240
+ opts.on('--track_allocations', 'Track allocations while profiling') do
241
+ options.track_allocations = true
205
242
  end
206
243
 
207
244
  opts.on_tail("-v version", "--version", "Show version (#{RubyProf::VERSION})") do
@@ -209,35 +246,9 @@ module RubyProf
209
246
  exit
210
247
  end
211
248
 
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
249
+ opts.on_tail("-h", "--help", "Show help message") do
250
+ puts opts
251
+ exit
241
252
  end
242
253
  end
243
254
  end
@@ -281,12 +292,18 @@ module RubyProf
281
292
  end
282
293
 
283
294
  def run
284
- script = ARGV.shift
285
- @profile = Profile.new(options.to_h)
295
+ profile_options = {:allow_exceptions => options.allow_exceptions,
296
+ :exclude_common => options.exclude_common,
297
+ :measure_mode => options.measure_mode,
298
+ :track_allocations => options.track_allocations}
299
+
300
+ @profile = Profile.new(**profile_options)
301
+
286
302
  options.exclude.each do |klass, method|
287
303
  @profile.exclude_method!(klass, method)
288
304
  end
289
305
 
306
+ script = ARGV.shift
290
307
  profile.profile do
291
308
  load script
292
309
  end
@@ -304,7 +321,8 @@ cmd = RubyProf::Cmd.new
304
321
  at_exit {
305
322
  # Create a printer
306
323
  printer = cmd.options.printer.new(cmd.profile)
307
- printer_options = {:min_percent => cmd.options.min_percent, :sort_method => cmd.options.sort_method}
324
+ printer_options = {:min_percent => cmd.options.min_percent,
325
+ :sort_method => cmd.options.sort_method}
308
326
 
309
327
  # Get output
310
328
  if cmd.options.file