process-metrics 0.10.0 → 0.10.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/process/metrics/host/memory.rb +6 -6
- data/lib/process/metrics/memory.rb +22 -3
- data/lib/process/metrics/version.rb +1 -1
- data/readme.md +9 -18
- data/releases.md +9 -1
- data.tar.gz.sig +0 -0
- metadata +1 -1
- 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: 213edfd5fbe960b9a75ac7574f17828f6b9f24ec5328ebf8c6ee85dcafeae0c2
|
|
4
|
+
data.tar.gz: 8daf591b9691f058dbe87dd861c0d8ff2e2669edff94b098ad0de36440963b14
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7cfafb180bf9286f5eb35dd2d5393b77ca88fc86f8b93509aed2f30870255dbba5e617ceceb69c17607bc3e620b7599e8c11ab960323033a97087a2acc45340c
|
|
7
|
+
data.tar.gz: 78427458c5dd06674690a1fe3ffab4d1c85a6ce265defce5dc2191be874ee995c87299c86de9b83e88e84318425ca2b16361e69df4b9d26d4badca1dbb8078e7
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
|
@@ -8,12 +8,12 @@ module Process
|
|
|
8
8
|
# Per-host (system-wide) memory metrics. Use Host::Memory for total/used/free and swap; use Process::Metrics::Memory for per-process metrics.
|
|
9
9
|
module Host
|
|
10
10
|
# Struct for host memory snapshot. All sizes in bytes.
|
|
11
|
-
# @attribute
|
|
12
|
-
# @attribute
|
|
13
|
-
# @attribute
|
|
14
|
-
# @attribute
|
|
15
|
-
# @attribute
|
|
16
|
-
Memory = Struct.new(:
|
|
11
|
+
# @attribute total_size [Integer] Total memory (cgroup limit when in a container, else physical RAM).
|
|
12
|
+
# @attribute used_size [Integer] Memory in use (total_size - free_size).
|
|
13
|
+
# @attribute free_size [Integer] Available memory (MemAvailable-style: free + reclaimable).
|
|
14
|
+
# @attribute swap_total_size [Integer, nil] Total swap, or nil if not available.
|
|
15
|
+
# @attribute swap_used_size [Integer, nil] Swap in use, or nil if not available.
|
|
16
|
+
Memory = Struct.new(:total_size, :used_size, :free_size, :swap_total_size, :swap_used_size) do
|
|
17
17
|
alias as_json to_h
|
|
18
18
|
|
|
19
19
|
def to_json(*arguments)
|
|
@@ -23,11 +23,30 @@ module Process
|
|
|
23
23
|
self.resident_size + self.swap_size
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
-
# The
|
|
27
|
-
|
|
26
|
+
# The private set size, the size of completely private (unshared) data.
|
|
27
|
+
# This is the sum of Private_Clean and Private_Dirty pages.
|
|
28
|
+
# @returns [Integer] Total private memory in bytes.
|
|
29
|
+
def private_size
|
|
28
30
|
self.private_clean_size + self.private_dirty_size
|
|
29
31
|
end
|
|
30
32
|
|
|
33
|
+
# The private set size is also known as the unique set size.
|
|
34
|
+
alias unique_size private_size
|
|
35
|
+
|
|
36
|
+
# The total size of shared (potentially shared with other processes) memory.
|
|
37
|
+
# This is the sum of Shared_Clean and Shared_Dirty pages.
|
|
38
|
+
#
|
|
39
|
+
# When tracking Copy-on-Write (CoW) activity in forked processes:
|
|
40
|
+
# - Initially, most memory is shared between parent and child.
|
|
41
|
+
# - As the child writes to memory, CoW triggers and shared pages become private.
|
|
42
|
+
# - Tracking shared_size decrease vs unique_size increase can indicate CoW activity.
|
|
43
|
+
# - If shared_size decreases by X and unique_size increases by ~X, it's likely CoW.
|
|
44
|
+
#
|
|
45
|
+
# @returns [Integer] Total shared memory in bytes.
|
|
46
|
+
def shared_size
|
|
47
|
+
self.shared_clean_size + self.shared_dirty_size
|
|
48
|
+
end
|
|
49
|
+
|
|
31
50
|
# Create a zero-initialized Memory instance.
|
|
32
51
|
# @returns [Memory] A new Memory object with all fields set to zero.
|
|
33
52
|
def self.zero
|
|
@@ -37,7 +56,7 @@ module Process
|
|
|
37
56
|
# Total system/host memory in bytes. Delegates to Host::Memory.capture.
|
|
38
57
|
# @returns [Integer | Nil]
|
|
39
58
|
def self.total_size
|
|
40
|
-
Host::Memory.capture&.
|
|
59
|
+
Host::Memory.capture&.total_size
|
|
41
60
|
end
|
|
42
61
|
|
|
43
62
|
# Whether the memory usage can be captured on this system.
|
data/readme.md
CHANGED
|
@@ -16,9 +16,17 @@ Please see the [project documentation](https://socketry.github.io/process-metric
|
|
|
16
16
|
|
|
17
17
|
Please see the [project releases](https://socketry.github.io/process-metrics/releases/index) for all releases.
|
|
18
18
|
|
|
19
|
+
### v0.10.2
|
|
20
|
+
|
|
21
|
+
- Add `Process::Metrics::Memory#private_size` for the sum of private (unshared) pages (Private\_Clean + Private\_Dirty); `#unique_size` is now an alias for `#private_size`.
|
|
22
|
+
|
|
23
|
+
### v0.10.1
|
|
24
|
+
|
|
25
|
+
- Consistent use of `_size` suffix.
|
|
26
|
+
|
|
19
27
|
### v0.10.0
|
|
20
28
|
|
|
21
|
-
- **Host::Memory**: New per-host struct `Process::Metrics::Host::Memory` with `
|
|
29
|
+
- **Host::Memory**: New per-host struct `Process::Metrics::Host::Memory` with `total_size`, `used_size`, `free_size`, `swap_total_size`, `swap_used_size` (all bytes). Use `Host::Memory.capture` to get a snapshot; `.supported?` indicates platform support.
|
|
22
30
|
|
|
23
31
|
### v0.9.0
|
|
24
32
|
|
|
@@ -54,23 +62,6 @@ Please see the [project releases](https://socketry.github.io/process-metrics/rel
|
|
|
54
62
|
- Improved support for proportional memory usage (PSS).
|
|
55
63
|
- Exposed total system memory information.
|
|
56
64
|
|
|
57
|
-
### v0.4.0
|
|
58
|
-
|
|
59
|
-
- Fixed command formatting in output display.
|
|
60
|
-
- Modernized codebase to use current Ruby conventions.
|
|
61
|
-
- Improved Darwin (macOS) support with better platform-specific handling.
|
|
62
|
-
|
|
63
|
-
### v0.3.0
|
|
64
|
-
|
|
65
|
-
- Added support for `smaps_rollup` on Linux for more efficient memory statistics collection.
|
|
66
|
-
- Fixed `smaps_rollup` detection (corrected file path).
|
|
67
|
-
- Removed `sz` metric (not supported on Darwin).
|
|
68
|
-
- Expanded test coverage.
|
|
69
|
-
- Improved documentation with better syntax highlighting and fixed links.
|
|
70
|
-
- Avoided abbreviations in naming conventions for better code clarity.
|
|
71
|
-
- Added missing dependencies: `bake-test-external` and `json` gem.
|
|
72
|
-
- Added summary lines for PSS (Proportional Set Size) and USS (Unique Set Size).
|
|
73
|
-
|
|
74
65
|
## Contributing
|
|
75
66
|
|
|
76
67
|
We welcome contributions to this project.
|
data/releases.md
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
# Releases
|
|
2
2
|
|
|
3
|
+
## v0.10.2
|
|
4
|
+
|
|
5
|
+
- Add `Process::Metrics::Memory#private_size` for the sum of private (unshared) pages (Private\_Clean + Private\_Dirty); `#unique_size` is now an alias for `#private_size`.
|
|
6
|
+
|
|
7
|
+
## v0.10.1
|
|
8
|
+
|
|
9
|
+
- Consistent use of `_size` suffix.
|
|
10
|
+
|
|
3
11
|
## v0.10.0
|
|
4
12
|
|
|
5
|
-
- **Host::Memory**: New per-host struct `Process::Metrics::Host::Memory` with `
|
|
13
|
+
- **Host::Memory**: New per-host struct `Process::Metrics::Host::Memory` with `total_size`, `used_size`, `free_size`, `swap_total_size`, `swap_used_size` (all bytes). Use `Host::Memory.capture` to get a snapshot; `.supported?` indicates platform support.
|
|
6
14
|
|
|
7
15
|
## v0.9.0
|
|
8
16
|
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
|
Binary file
|