memory 0.8.1 → 0.8.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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/memory/format.rb +8 -14
- data/lib/memory/usage.rb +1 -1
- data/lib/memory/version.rb +1 -1
- data/readme.md +4 -0
- data/releases.md +4 -0
- data.tar.gz.sig +0 -0
- metadata +8 -3
- 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: a88cb9c708625797b36720bba379af629592388084df0b36298016dc4dd686ea
|
|
4
|
+
data.tar.gz: d284d96489cbd80e63cf47e35020aa940e6cf041c2a3270ccab69163a3e6e5e8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2f5690f42837f74111ca24aedc8c3543f156a7c90120f3425a4f15222407a7a3edbbe616e2f77a69e3bef31b519fff43566b4c5eb0752b55a8e18c8642c11db4
|
|
7
|
+
data.tar.gz: 4992afa7decf15606f8f0e8f98c4cd124a1e7e5c10a99b8e31d662ec043c58d9305e7c40d0ec37aad76c6a81520431743a42478cad809278ae5bf4923a7b7b1a
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/lib/memory/format.rb
CHANGED
|
@@ -4,17 +4,7 @@
|
|
|
4
4
|
# Copyright, 2025, by Samuel Williams.
|
|
5
5
|
|
|
6
6
|
module Memory
|
|
7
|
-
UNITS =
|
|
8
|
-
0 => "B",
|
|
9
|
-
3 => "KiB",
|
|
10
|
-
6 => "MiB",
|
|
11
|
-
9 => "GiB",
|
|
12
|
-
12 => "TiB",
|
|
13
|
-
15 => "PiB",
|
|
14
|
-
18 => "EiB",
|
|
15
|
-
21 => "ZiB",
|
|
16
|
-
24 => "YiB"
|
|
17
|
-
}.freeze
|
|
7
|
+
UNITS = ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"].freeze
|
|
18
8
|
|
|
19
9
|
# Format bytes into human-readable units.
|
|
20
10
|
# @parameter bytes [Integer] The number of bytes to format.
|
|
@@ -22,8 +12,12 @@ module Memory
|
|
|
22
12
|
def self.formatted_bytes(bytes)
|
|
23
13
|
return "0 B" if bytes.zero?
|
|
24
14
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
15
|
+
# Calculate how many times we can divide by 1024 (2^10)
|
|
16
|
+
# log2(bytes) / 10 gives the number of 1024 divisions
|
|
17
|
+
index = Math.log2(bytes).to_i / 10
|
|
18
|
+
index = 8 if index > 8 # Cap at YiB
|
|
19
|
+
|
|
20
|
+
# Divide by 1024^index, which equals 2^(index * 10)
|
|
21
|
+
"%.2f #{UNITS[index]}" % (bytes / (1024.0 ** index))
|
|
28
22
|
end
|
|
29
23
|
end
|
data/lib/memory/usage.rb
CHANGED
data/lib/memory/version.rb
CHANGED
data/readme.md
CHANGED
|
@@ -94,6 +94,10 @@ end
|
|
|
94
94
|
|
|
95
95
|
Please see the [project releases](https://socketry.github.io/memory/releases/index) for all releases.
|
|
96
96
|
|
|
97
|
+
### v0.8.2
|
|
98
|
+
|
|
99
|
+
- Fix several formatting issues.
|
|
100
|
+
|
|
97
101
|
### v0.8.1
|
|
98
102
|
|
|
99
103
|
- Skip over `ObjectSpace::InternalObjectWrapper` instances in `Memory::Usage.of` to avoid unbounded recursion.
|
data/releases.md
CHANGED
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: memory
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.8.
|
|
4
|
+
version: 0.8.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sam Saffron
|
|
@@ -29,6 +29,7 @@ authors:
|
|
|
29
29
|
- Olle Jonsson
|
|
30
30
|
- Vasily Kolesnikov
|
|
31
31
|
- William Tabi
|
|
32
|
+
autorequire:
|
|
32
33
|
bindir: bin
|
|
33
34
|
cert_chain:
|
|
34
35
|
- |
|
|
@@ -60,7 +61,7 @@ cert_chain:
|
|
|
60
61
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
|
61
62
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
|
62
63
|
-----END CERTIFICATE-----
|
|
63
|
-
date:
|
|
64
|
+
date: 2025-10-29 00:00:00.000000000 Z
|
|
64
65
|
dependencies:
|
|
65
66
|
- !ruby/object:Gem::Dependency
|
|
66
67
|
name: bake
|
|
@@ -104,6 +105,8 @@ dependencies:
|
|
|
104
105
|
- - ">="
|
|
105
106
|
- !ruby/object:Gem::Version
|
|
106
107
|
version: '0'
|
|
108
|
+
description:
|
|
109
|
+
email:
|
|
107
110
|
executables: []
|
|
108
111
|
extensions: []
|
|
109
112
|
extra_rdoc_files: []
|
|
@@ -130,6 +133,7 @@ licenses:
|
|
|
130
133
|
metadata:
|
|
131
134
|
documentation_uri: https://socketry.github.io/memory/
|
|
132
135
|
source_code_uri: https://github.com/socketry/memory.git
|
|
136
|
+
post_install_message:
|
|
133
137
|
rdoc_options: []
|
|
134
138
|
require_paths:
|
|
135
139
|
- lib
|
|
@@ -144,7 +148,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
144
148
|
- !ruby/object:Gem::Version
|
|
145
149
|
version: '0'
|
|
146
150
|
requirements: []
|
|
147
|
-
rubygems_version: 3.
|
|
151
|
+
rubygems_version: 3.4.19
|
|
152
|
+
signing_key:
|
|
148
153
|
specification_version: 4
|
|
149
154
|
summary: Memory profiling routines for Ruby 2.3+
|
|
150
155
|
test_files: []
|
metadata.gz.sig
CHANGED
|
Binary file
|