ruby-prof 1.7.1 → 1.7.2

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.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES +8 -0
  3. data/ext/ruby_prof/extconf.rb +23 -22
  4. data/ext/ruby_prof/rp_call_trees.c +296 -296
  5. data/ext/ruby_prof/rp_call_trees.h +28 -28
  6. data/ext/ruby_prof/rp_measure_allocations.c +47 -47
  7. data/ext/ruby_prof/rp_measure_process_time.c +64 -66
  8. data/ext/ruby_prof/rp_measure_wall_time.c +52 -64
  9. data/ext/ruby_prof/rp_method.c +551 -551
  10. data/ext/ruby_prof/rp_stack.c +212 -212
  11. data/ext/ruby_prof/ruby_prof.c +50 -50
  12. data/ext/ruby_prof/ruby_prof.h +3 -2
  13. data/ext/ruby_prof/vc/ruby_prof.vcxproj +3 -3
  14. data/lib/ruby-prof/compatibility.rb +113 -113
  15. data/lib/ruby-prof/exclude_common_methods.rb +204 -204
  16. data/lib/ruby-prof/printers/abstract_printer.rb +156 -138
  17. data/lib/ruby-prof/version.rb +3 -3
  18. data/ruby-prof.gemspec +66 -65
  19. data/test/dynamic_method_test.rb +9 -21
  20. data/test/enumerable_test.rb +23 -21
  21. data/test/exclude_methods_test.rb +363 -257
  22. data/test/fiber_test.rb +195 -195
  23. data/test/gc_test.rb +104 -102
  24. data/test/line_number_test.rb +426 -289
  25. data/test/measure_allocations_test.rb +1172 -1081
  26. data/test/measure_memory_test.rb +1193 -1456
  27. data/test/measure_process_time_test.rb +3330 -2477
  28. data/test/measure_wall_time_test.rb +634 -568
  29. data/test/merge_test.rb +146 -146
  30. data/test/method_info_test.rb +100 -95
  31. data/test/printers_test.rb +178 -135
  32. data/test/recursive_test.rb +796 -622
  33. data/test/start_stop_test.rb +4 -4
  34. data/test/test_helper.rb +20 -20
  35. data/test/thread_test.rb +229 -231
  36. data/test/unique_call_path_test.rb +9 -22
  37. data/test/yarv_test.rb +1 -5
  38. metadata +19 -9
  39. data/test/crash2.rb +0 -144
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-prof
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.1
4
+ version: 1.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shugo Maeda, Charlie Savage, Roger Pack, Stefan Kaes
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-10-19 00:00:00.000000000 Z
10
+ date: 2025-05-21 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: base64
@@ -17,7 +16,7 @@ dependencies:
17
16
  - - ">="
18
17
  - !ruby/object:Gem::Version
19
18
  version: '0'
20
- type: :development
19
+ type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
@@ -52,6 +51,20 @@ dependencies:
52
51
  - - ">="
53
52
  - !ruby/object:Gem::Version
54
53
  version: '0'
54
+ - !ruby/object:Gem::Dependency
55
+ name: rdoc
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ type: :development
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
55
68
  description: |
56
69
  ruby-prof is a fast code profiler for Ruby. It is a C extension and
57
70
  therefore is many times faster than the standard Ruby profiler. It
@@ -131,7 +144,6 @@ files:
131
144
  - test/call_tree_visitor_test.rb
132
145
  - test/call_trees_test.rb
133
146
  - test/compatibility_test.rb
134
- - test/crash2.rb
135
147
  - test/duplicate_names_test.rb
136
148
  - test/dynamic_method_test.rb
137
149
  - test/enumerable_test.rb
@@ -182,8 +194,7 @@ metadata:
182
194
  bug_tracker_uri: https://github.com/ruby-prof/ruby-prof/issues
183
195
  changelog_uri: https://github.com/ruby-prof/ruby-prof/blob/master/CHANGES
184
196
  documentation_uri: https://ruby-prof.github.io/
185
- source_code_uri: https://github.com/ruby-prof/ruby-prof/tree/v1.7.1
186
- post_install_message:
197
+ source_code_uri: https://github.com/ruby-prof/ruby-prof/tree/v1.7.2
187
198
  rdoc_options: []
188
199
  require_paths:
189
200
  - lib
@@ -198,8 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
198
209
  - !ruby/object:Gem::Version
199
210
  version: '0'
200
211
  requirements: []
201
- rubygems_version: 3.5.16
202
- signing_key:
212
+ rubygems_version: 3.6.8
203
213
  specification_version: 4
204
214
  summary: Fast Ruby profiler
205
215
  test_files:
data/test/crash2.rb DELETED
@@ -1,144 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- # This is a benchmark for HTTPS traffic.
5
- # To run against a local server:
6
- # docker run --rm --detach --name httpbin -v /tmp:/tmp -v $PWD/tests/data:/data -e HTTPS_CERT_FILE='/data/127.0.0.1.cert.crt' -e HTTPS_KEY_FILE='/data/127.0.0.1.cert.key' -e PORT='8443' -p 8443:8443 mccutchen/go-httpbin
7
- # Then, run the benchmark:
8
- # benchmarks/httpbin.rb --uri='https://localhost:8443/stream-bytes/102400?chunk_size=1024'
9
- # Finally, stop the server with:
10
- # docker kill httpbin
11
-
12
- #require 'bundler/inline'
13
-
14
- #gemfile do
15
- # source 'https://rubygems.org'
16
-
17
- # gem 'benchmark-ips', require: 'benchmark/ips'
18
- # gem 'ruby-prof', '1.6.3'
19
- # gem 'excon'
20
- #end
21
-
22
- require File.expand_path('../test_helper', __FILE__)
23
-
24
-
25
- require 'openssl'
26
- require 'optparse'
27
- require 'uri'
28
- require 'excon'
29
- require 'benchmark'
30
- require 'benchmark/ips'
31
-
32
- Options = Struct.new(:uri, :profile, :time, :warmup, :iterations, :status)
33
-
34
- options = Options.new(
35
- URI.parse('https://httpbingo.org/stream-bytes/102400?chunk_size=1024'),
36
- false,
37
- 10,
38
- 5,
39
- 2,
40
- 200
41
- )
42
-
43
- OptionParser.new do |opts|
44
- opts.banner = "Usage: ruby #{__FILE__} [options]"
45
-
46
- opts.on('-u URI', '--uri=URI', String, "URI to send requests to (default: #{options.uri})") do |uri|
47
- options.uri = URI.parse(uri)
48
- end
49
-
50
- opts.on('-p', '--[no-]profile', 'Profile the benchmark using Ruby-Prof (defaults to no profiling)') do |profile|
51
- options.profile = profile
52
- end
53
-
54
- opts.on('-t TIME', '--time=TIME', Float, "The number of seconds to run the benchmark to measure performance (default: #{options.time})") do |time|
55
- options.time = time
56
- end
57
-
58
- opts.on('-w WARMUP', '--warmup=WARMUP', Float, "The number of seconds to warmup the benchmark for before measuring (default: #{options.warmup})") do |warmup|
59
- options.warmup = warmup
60
- end
61
-
62
- opts.on('-i ITERATIONS', '--iterations=ITERATIONS', Integer, "The number of iterations to run the benchmark for (default: #{options.iterations})") do |iterations|
63
- options.iterations = iterations
64
- end
65
-
66
- opts.on('-s STATUS', '--status=STATUS', Integer, "The HTTP status expected from a request to the given URI (default: #{options.status})") do |status|
67
- options.status = status
68
- end
69
-
70
- opts.on('-h', '--help', 'print options') do
71
- puts opts
72
- exit
73
- end
74
- end.parse!
75
-
76
- # Enable and start GC before each job run. Disable GC afterwards.
77
- #
78
- # Inspired by https://www.omniref.com/ruby/2.2.1/symbols/Benchmark/bm?#annotation=4095926&line=182
79
- class GCSuite
80
- def warming(*)
81
- run_gc
82
- end
83
-
84
- def running(*)
85
- run_gc
86
- end
87
-
88
- def warmup_stats(*); end
89
-
90
- def add_report(*); end
91
-
92
- private
93
-
94
- def run_gc
95
- GC.enable
96
- GC.start
97
- GC.compact
98
- GC.disable
99
- end
100
- end
101
-
102
- profile = nil
103
-
104
- if options.profile
105
- profile = RubyProf::Profile.new(track_allocations: true, measure_mode: RubyProf::MEMORY)
106
- profile.start
107
- profile.pause
108
- end
109
-
110
- excerpt = ['Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.']
111
- data = (excerpt * 3).join(' ')
112
-
113
- client = ::Excon.new(options.uri.to_s, ssl_verify_peer: false, ssl_verify_peer_host: false, persistent: true, retry_errors: [Excon::Error::Socket], idempotent: true)
114
-
115
- Benchmark.ips do |x|
116
- x.time = options.time
117
- x.warmup = options.warmup
118
- x.suite = GCSuite.new
119
- x.iterations = options.iterations
120
-
121
- x.report(options.uri.to_s) do
122
- profile&.resume
123
-
124
- response = client.request(method: :get, headers: { data: data })
125
-
126
- response.body
127
- response.status
128
-
129
- profile&.pause
130
-
131
- raise "Invalid status: expected #{options.status}, actual is #{response.status}" unless response.status == options.status
132
- end
133
-
134
- x.compare!
135
- end
136
-
137
- if options.profile
138
- result = profile.stop
139
-
140
- File.open("excon-#{Excon::VERSION}.html", 'w') do |output|
141
- printer = RubyProf::GraphHtmlPrinter.new(result)
142
- printer.print(output)
143
- end
144
- end