memory 0.4.0 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/bake/memory/profiler.rb +2 -2
- data/lib/memory/aggregate.rb +6 -6
- data/lib/memory/report.rb +5 -5
- data/lib/memory/sampler.rb +5 -1
- data/lib/memory/version.rb +2 -2
- data/license.md +1 -1
- data/readme.md +22 -15
- data.tar.gz.sig +0 -0
- metadata +5 -61
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 007d5f4bf3d0a25dc887eefc4c7467f44a021e0658a4ac6acfe186da4c72c435
|
4
|
+
data.tar.gz: dcc7e341db91dccf9f3928d3eb7901606e31fc3df9bb7701c1ad3c1253e7d2c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f5831fce8f53208b08a5c2fab8f0d4286077fbe69a9d1fe227888695be775259743f098fb8ef1a2dce9843e478ddcc7f66e37142567f79df9bbfe20f694ffbc
|
7
|
+
data.tar.gz: fac10ba0b56492a1d870217d31c92fb20e35c9cdb65dfb44d5b7bec41d673b0ccb2631f4d913575fa40474c5eaddece64e821c63cbd2f86819fb9f6b5b305a3c
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/bake/memory/profiler.rb
CHANGED
@@ -18,7 +18,7 @@ def check(paths:)
|
|
18
18
|
cache = Memory::Cache.new
|
19
19
|
wrapper = Memory::Wrapper.new(cache)
|
20
20
|
|
21
|
-
|
21
|
+
progress = Console.logger.progress(report, total_size)
|
22
22
|
|
23
23
|
paths.each do |path|
|
24
24
|
Console.logger.info(report, "Loading #{path}, #{Memory.formatted_bytes File.size(path)}")
|
@@ -29,7 +29,7 @@ def check(paths:)
|
|
29
29
|
|
30
30
|
report.concat(unpacker)
|
31
31
|
|
32
|
-
|
32
|
+
progress.increment(io.size)
|
33
33
|
end
|
34
34
|
|
35
35
|
Console.logger.info(report, "Loaded allocations, #{report.total_allocated}")
|
data/lib/memory/aggregate.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2020-
|
4
|
+
# Copyright, 2020-2023, by Samuel Williams.
|
5
5
|
|
6
6
|
module Memory
|
7
7
|
UNITS = {
|
@@ -43,7 +43,7 @@ module Memory
|
|
43
43
|
"(#{Memory.formatted_bytes memory} in #{count} allocations)"
|
44
44
|
end
|
45
45
|
|
46
|
-
def as_json
|
46
|
+
def as_json(options = nil)
|
47
47
|
{
|
48
48
|
memory: memory,
|
49
49
|
count: count
|
@@ -89,11 +89,11 @@ module Memory
|
|
89
89
|
io.puts nil
|
90
90
|
end
|
91
91
|
|
92
|
-
def as_json
|
92
|
+
def as_json(options = nil)
|
93
93
|
{
|
94
94
|
title: @title,
|
95
|
-
total: @total.as_json,
|
96
|
-
totals: @totals.map{|k, v| [k, v.as_json]}
|
95
|
+
total: @total.as_json(options),
|
96
|
+
totals: @totals.map{|k, v| [k, v.as_json(options)]}
|
97
97
|
}
|
98
98
|
end
|
99
99
|
end
|
@@ -130,7 +130,7 @@ module Memory
|
|
130
130
|
end
|
131
131
|
end
|
132
132
|
|
133
|
-
def as_json
|
133
|
+
def as_json(options = nil)
|
134
134
|
{
|
135
135
|
title: @title,
|
136
136
|
aggregates: @aggregates.map{|k, v| [k, v.as_json]}
|
data/lib/memory/report.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2020-
|
4
|
+
# Copyright, 2020-2023, by Samuel Williams.
|
5
5
|
|
6
6
|
require_relative 'aggregate'
|
7
7
|
|
@@ -58,11 +58,11 @@ module Memory
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
-
def as_json
|
61
|
+
def as_json(options = nil)
|
62
62
|
{
|
63
|
-
total_allocated: @total_allocated.as_json,
|
64
|
-
total_retained: @total_retained.as_json,
|
65
|
-
aggregates: @aggregates.map(
|
63
|
+
total_allocated: @total_allocated.as_json(options),
|
64
|
+
total_retained: @total_retained.as_json(options),
|
65
|
+
aggregates: @aggregates.map{|aggregate| aggregate.as_json(options)}
|
66
66
|
}
|
67
67
|
end
|
68
68
|
|
data/lib/memory/sampler.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
# Copyright, 2018, by Jonas Peschla.
|
12
12
|
# Copyright, 2018, by Espartaco Palma.
|
13
13
|
# Copyright, 2020, by Jean Boussier.
|
14
|
-
# Copyright, 2020-
|
14
|
+
# Copyright, 2020-2024, by Samuel Williams.
|
15
15
|
|
16
16
|
require 'objspace'
|
17
17
|
require 'msgpack'
|
@@ -67,6 +67,10 @@ module Memory
|
|
67
67
|
@allocated = Array.new
|
68
68
|
end
|
69
69
|
|
70
|
+
def inspect
|
71
|
+
"#<#{self.class} #{@allocated.size} allocations>"
|
72
|
+
end
|
73
|
+
|
70
74
|
attr :filter
|
71
75
|
|
72
76
|
attr :cache
|
data/lib/memory/version.rb
CHANGED
@@ -4,8 +4,8 @@
|
|
4
4
|
# Copyright, 2013-2019, by Sam Saffron.
|
5
5
|
# Copyright, 2015-2016, by Dave Gynn.
|
6
6
|
# Copyright, 2018, by Jonas Peschla.
|
7
|
-
# Copyright, 2020-
|
7
|
+
# Copyright, 2020-2024, by Samuel Williams.
|
8
8
|
|
9
9
|
module Memory
|
10
|
-
VERSION = "0.4.
|
10
|
+
VERSION = "0.4.2"
|
11
11
|
end
|
data/license.md
CHANGED
@@ -24,7 +24,7 @@ Copyright, 2019-2020, by Jean Boussier.
|
|
24
24
|
Copyright, 2019, by Ashwin Maroli.
|
25
25
|
Copyright, 2019, by Olle Jonsson.
|
26
26
|
Copyright, 2019, by Danny Ben Shitrit.
|
27
|
-
Copyright, 2020-
|
27
|
+
Copyright, 2020-2024, by Samuel Williams.
|
28
28
|
|
29
29
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
30
30
|
of this software and associated documentation files (the "Software"), to deal
|
data/readme.md
CHANGED
@@ -49,41 +49,40 @@ report.print
|
|
49
49
|
``` ruby
|
50
50
|
memory_sampler = nil
|
51
51
|
config.before(:all) do |example_group|
|
52
|
-
name = example_group.class.description.gsub(/[^\w]+/,
|
52
|
+
name = example_group.class.description.gsub(/[^\w]+/, '-')
|
53
53
|
path = "#{name}.mprof"
|
54
|
-
|
54
|
+
|
55
55
|
skip if File.exist?(path)
|
56
|
-
|
56
|
+
|
57
57
|
memory_sampler = Memory::Sampler.new
|
58
58
|
memory_sampler.start
|
59
59
|
end
|
60
60
|
|
61
61
|
config.after(:all) do |example_group|
|
62
|
-
name = example_group.class.description.gsub(/[^\w]+/,
|
62
|
+
name = example_group.class.description.gsub(/[^\w]+/, '-')
|
63
63
|
path = "#{name}.mprof"
|
64
|
-
|
64
|
+
|
65
65
|
if memory_sampler
|
66
66
|
memory_sampler.stop
|
67
|
-
|
67
|
+
|
68
68
|
File.open(path, "w", encoding: Encoding::BINARY) do |io|
|
69
69
|
memory_sampler.dump(io)
|
70
70
|
end
|
71
|
-
|
71
|
+
|
72
72
|
memory_sampler = nil
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
76
|
config.after(:suite) do
|
77
77
|
memory_sampler = Memory::Sampler.new
|
78
|
-
|
79
|
-
Dir.glob(
|
80
|
-
|
81
|
-
|
82
|
-
encoding: Encoding::BINARY,
|
83
|
-
))
|
78
|
+
|
79
|
+
Dir.glob('*.mprof') do |path|
|
80
|
+
$stderr.puts "Loading #{path}..."
|
81
|
+
memory_sampler.load(File.read(path, encoding: Encoding::BINARY))
|
84
82
|
end
|
85
|
-
|
86
|
-
|
83
|
+
|
84
|
+
$stderr.puts "Memory usage:"
|
85
|
+
memory_sampler.report.print
|
87
86
|
end
|
88
87
|
```
|
89
88
|
|
@@ -121,3 +120,11 @@ We welcome contributions to this project.
|
|
121
120
|
3. Commit your changes (`git commit -am 'Add some feature'`).
|
122
121
|
4. Push to the branch (`git push origin my-new-feature`).
|
123
122
|
5. Create new Pull Request.
|
123
|
+
|
124
|
+
### Developer Certificate of Origin
|
125
|
+
|
126
|
+
This project uses the [Developer Certificate of Origin](https://developercertificate.org/). All contributors to this project must agree to this document to have their contributions accepted.
|
127
|
+
|
128
|
+
### Contributor Covenant
|
129
|
+
|
130
|
+
This project is governed by the [Contributor Covenant](https://www.contributor-covenant.org/). All contributors and participants agree to abide by its terms.
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: memory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Saffron
|
8
8
|
- Dave Gynn
|
9
|
+
- Samuel Williams
|
9
10
|
- Nick LaMuro
|
10
11
|
- Jonas Peschla
|
11
|
-
- Samuel Williams
|
12
12
|
- Ashwin Maroli
|
13
13
|
- Søren Skovsbøll
|
14
14
|
- Richard Schneeman
|
@@ -61,7 +61,7 @@ cert_chain:
|
|
61
61
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
62
62
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
63
63
|
-----END CERTIFICATE-----
|
64
|
-
date:
|
64
|
+
date: 2024-02-13 00:00:00.000000000 Z
|
65
65
|
dependencies:
|
66
66
|
- !ruby/object:Gem::Dependency
|
67
67
|
name: bake
|
@@ -105,62 +105,6 @@ dependencies:
|
|
105
105
|
- - ">="
|
106
106
|
- !ruby/object:Gem::Version
|
107
107
|
version: '0'
|
108
|
-
- !ruby/object:Gem::Dependency
|
109
|
-
name: bake-test
|
110
|
-
requirement: !ruby/object:Gem::Requirement
|
111
|
-
requirements:
|
112
|
-
- - ">="
|
113
|
-
- !ruby/object:Gem::Version
|
114
|
-
version: '0'
|
115
|
-
type: :development
|
116
|
-
prerelease: false
|
117
|
-
version_requirements: !ruby/object:Gem::Requirement
|
118
|
-
requirements:
|
119
|
-
- - ">="
|
120
|
-
- !ruby/object:Gem::Version
|
121
|
-
version: '0'
|
122
|
-
- !ruby/object:Gem::Dependency
|
123
|
-
name: bundler
|
124
|
-
requirement: !ruby/object:Gem::Requirement
|
125
|
-
requirements:
|
126
|
-
- - ">="
|
127
|
-
- !ruby/object:Gem::Version
|
128
|
-
version: '0'
|
129
|
-
type: :development
|
130
|
-
prerelease: false
|
131
|
-
version_requirements: !ruby/object:Gem::Requirement
|
132
|
-
requirements:
|
133
|
-
- - ">="
|
134
|
-
- !ruby/object:Gem::Version
|
135
|
-
version: '0'
|
136
|
-
- !ruby/object:Gem::Dependency
|
137
|
-
name: covered
|
138
|
-
requirement: !ruby/object:Gem::Requirement
|
139
|
-
requirements:
|
140
|
-
- - ">="
|
141
|
-
- !ruby/object:Gem::Version
|
142
|
-
version: '0'
|
143
|
-
type: :development
|
144
|
-
prerelease: false
|
145
|
-
version_requirements: !ruby/object:Gem::Requirement
|
146
|
-
requirements:
|
147
|
-
- - ">="
|
148
|
-
- !ruby/object:Gem::Version
|
149
|
-
version: '0'
|
150
|
-
- !ruby/object:Gem::Dependency
|
151
|
-
name: sus
|
152
|
-
requirement: !ruby/object:Gem::Requirement
|
153
|
-
requirements:
|
154
|
-
- - ">="
|
155
|
-
- !ruby/object:Gem::Version
|
156
|
-
version: '0'
|
157
|
-
type: :development
|
158
|
-
prerelease: false
|
159
|
-
version_requirements: !ruby/object:Gem::Requirement
|
160
|
-
requirements:
|
161
|
-
- - ">="
|
162
|
-
- !ruby/object:Gem::Version
|
163
|
-
version: '0'
|
164
108
|
description:
|
165
109
|
email:
|
166
110
|
executables: []
|
@@ -190,14 +134,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
190
134
|
requirements:
|
191
135
|
- - ">="
|
192
136
|
- !ruby/object:Gem::Version
|
193
|
-
version:
|
137
|
+
version: '3.0'
|
194
138
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
195
139
|
requirements:
|
196
140
|
- - ">="
|
197
141
|
- !ruby/object:Gem::Version
|
198
142
|
version: '0'
|
199
143
|
requirements: []
|
200
|
-
rubygems_version: 3.3
|
144
|
+
rubygems_version: 3.5.3
|
201
145
|
signing_key:
|
202
146
|
specification_version: 4
|
203
147
|
summary: Memory profiling routines for Ruby 2.3+
|
metadata.gz.sig
CHANGED
Binary file
|