hotch 0.5.1 → 0.6.0

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: 81c6b6c4a7de4bfbb45eb8d4c4bef3672231aa8c9677329f81bf47dc3cf06e3d
4
- data.tar.gz: 9ca8707942ea5d222891429764cb090d653cbccbd02f68c6d54ce47716611c6d
3
+ metadata.gz: 8a8f4b895fb76ef2998f7d51ce4a1725723649839b655a46e261e6b5d8bbd7a7
4
+ data.tar.gz: 55e5919e466022d1427d607d12fc8929248ceb4ad9c6716d0cfba9bc1cafe11e
5
5
  SHA512:
6
- metadata.gz: 70c13dc3481dbbf1fb7fe37e7828ae5f1a4c7913b8d15a0df0bbb20866eb3d71a464fcfad09e9eebb3ef66a456646961e91fba3ccfe34fd546e8f2c87eb85dff
7
- data.tar.gz: 02506de0b9435c1bfca28ab740171d5118820965f7b7e40bfd504622defaaa7088e3f53f9da774e466d3d7fc13629092189c4f425db84d97365cc494898acc70
6
+ metadata.gz: 21af11cc4cdfbab13d13cbe882cfc0bd28aecc72a746ae613c21031911d07d386cf2bc328ac165861517501681db221564b971b8f3658c354ffb7ac6633f7f0d
7
+ data.tar.gz: 6f43595863fb4975d6fd3fd632e7c920d1628d5a659349f433ec9b16b003d43c4de187ac25011a71d2f0c44bf6591ec4b03f6c9bc0d36ec47685fd9dc0904fec
data/README.md CHANGED
@@ -62,7 +62,7 @@ dry/struct/class_interface.rb:77 T_OBJECT 2000 0 0 0
62
62
  Add this line to your application's Gemfile:
63
63
 
64
64
  ```ruby
65
- gem 'hotch', '~> 0.5.0'
65
+ gem 'hotch', '~> 0.6.0'
66
66
  ```
67
67
 
68
68
  And then execute:
@@ -138,6 +138,10 @@ Hotch::Minitest.run(options: { limit: 200 })
138
138
 
139
139
  ### Memory profiler
140
140
 
141
+ Shell usage:
142
+
143
+ $ ruby -rhotch/memory/run my_program.rb
144
+
141
145
  Require `hotch/memory` and use `Hotch.memory { ... }` as in:
142
146
 
143
147
  ```ruby
@@ -183,6 +187,20 @@ Hotch.memory(aggregate: false) do
183
187
  end
184
188
  ```
185
189
 
190
+ #### Inline reporting
191
+
192
+ This prints two ASCII tables showing the object alloctions two calls:
193
+
194
+ ```ruby
195
+ puts Hotch::Memory.report("memory") {
196
+ # ...
197
+ }
198
+
199
+ puts Hotch::Memory.report("another") {
200
+ # ...
201
+ }
202
+ ```
203
+
186
204
  ### Minitest integration for the memory profiler
187
205
 
188
206
  Load `hotch/memory/minitest` in your `test/test_helper.rb` like this:
@@ -0,0 +1,15 @@
1
+ require 'hotch/memory'
2
+
3
+ ary = []
4
+
5
+ Hotch.memory do
6
+ ary << "string"
7
+ end
8
+
9
+ Hotch.memory do
10
+ ary << "another"
11
+ end
12
+
13
+ Hotch.memory do
14
+ ary.join(" ")
15
+ end
@@ -0,0 +1,15 @@
1
+ require 'hotch/memory'
2
+
3
+ ary = []
4
+
5
+ puts Hotch::Memory.report("1") {
6
+ ary << "string"
7
+ }
8
+
9
+ puts Hotch::Memory.report("2") {
10
+ ary << "another"
11
+ }
12
+
13
+ puts Hotch::Memory.report("3") {
14
+ ary.join(" ")
15
+ }
@@ -18,9 +18,9 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_runtime_dependency "stackprof", "~> 0.2.10"
21
+ spec.add_runtime_dependency "stackprof", "~> 0.2.15"
22
22
  spec.add_runtime_dependency "allocation_tracer", "~> 0.6.3"
23
23
 
24
- spec.add_development_dependency "bundler", "~> 1.7"
24
+ spec.add_development_dependency "bundler"
25
25
  spec.add_development_dependency "rake", "~> 10.0"
26
26
  end
@@ -28,6 +28,10 @@ class Hotch
28
28
  @disable_gc = disable_gc
29
29
  end
30
30
 
31
+ def self.report(name, **args, &block)
32
+ new(name, **args).run(&block).report
33
+ end
34
+
31
35
  def start
32
36
  return if @started
33
37
  GC.disable if @disable_gc
@@ -47,6 +51,7 @@ class Hotch
47
51
  def run
48
52
  start
49
53
  yield
54
+ self
50
55
  ensure
51
56
  stop
52
57
  end
@@ -0,0 +1,3 @@
1
+ require 'hotch/memory'
2
+
3
+ Hotch.memory(name: $0)
@@ -1,3 +1,3 @@
1
1
  class Hotch
2
- VERSION = "0.5.1"
2
+ VERSION = "0.6.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hotch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Leitzen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-01 00:00:00.000000000 Z
11
+ date: 2020-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: stackprof
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.2.10
19
+ version: 0.2.15
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.2.10
26
+ version: 0.2.15
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: allocation_tracer
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -42,16 +42,16 @@ dependencies:
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '1.7'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '1.7'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -79,6 +79,8 @@ files:
79
79
  - README.md
80
80
  - Rakefile
81
81
  - examples/bundler.rb
82
+ - examples/memory_at_exit.rb
83
+ - examples/memory_inline_report.rb
82
84
  - examples/simple.rb
83
85
  - hotch.gemspec
84
86
  - images/dry-validation.profile_schema_call_valid.png
@@ -86,6 +88,7 @@ files:
86
88
  - lib/hotch.rb
87
89
  - lib/hotch/memory.rb
88
90
  - lib/hotch/memory/minitest.rb
91
+ - lib/hotch/memory/run.rb
89
92
  - lib/hotch/minitest.rb
90
93
  - lib/hotch/run.rb
91
94
  - lib/hotch/version.rb
@@ -108,8 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
111
  - !ruby/object:Gem::Version
109
112
  version: '0'
110
113
  requirements: []
111
- rubyforge_project:
112
- rubygems_version: 2.7.7
114
+ rubygems_version: 3.0.3
113
115
  signing_key:
114
116
  specification_version: 4
115
117
  summary: Profile helper