hotch 0.5.1 → 0.6.0
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/README.md +19 -1
- data/examples/memory_at_exit.rb +15 -0
- data/examples/memory_inline_report.rb +15 -0
- data/hotch.gemspec +2 -2
- data/lib/hotch/memory.rb +5 -0
- data/lib/hotch/memory/run.rb +3 -0
- data/lib/hotch/version.rb +1 -1
- metadata +12 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a8f4b895fb76ef2998f7d51ce4a1725723649839b655a46e261e6b5d8bbd7a7
|
4
|
+
data.tar.gz: 55e5919e466022d1427d607d12fc8929248ceb4ad9c6716d0cfba9bc1cafe11e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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:
|
data/hotch.gemspec
CHANGED
@@ -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.
|
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"
|
24
|
+
spec.add_development_dependency "bundler"
|
25
25
|
spec.add_development_dependency "rake", "~> 10.0"
|
26
26
|
end
|
data/lib/hotch/memory.rb
CHANGED
@@ -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
|
data/lib/hotch/version.rb
CHANGED
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.
|
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:
|
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.
|
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.
|
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: '
|
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: '
|
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
|
-
|
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
|