process-metrics 0.6.0 → 0.6.1
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/memory/linux.rb +14 -18
- data/lib/process/metrics/version.rb +1 -1
- data/readme.md +4 -0
- data/releases.md +4 -0
- data.tar.gz.sig +0 -0
- metadata +2 -2
- 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: 21b2cec0ce445dbf8e7401a91b2ef3698c2b2d0dc1faa497e6c5e18cbb80efbe
|
|
4
|
+
data.tar.gz: 0d7004039c130aa4c13aafcf3bbe867fbded7a9968bb5cf1f1f64e8e153c518c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a368497ef8239069aadbbbdf507892f516d7109325f5e5363b6c666abf4df2fac788b4406e2f596af2151d67f3cb433a937ca9a55c63ba1289874427a3bb5763
|
|
7
|
+
data.tar.gz: 1022c8a322daf3b779324d8a8ec04daf2014336c80e9feb3f4686eefd0ff918d08b24f1fd4d626fa7df69732fdae93199a320c4769654ac75dbece2ad12c0225
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
|
@@ -11,20 +11,16 @@ module Process
|
|
|
11
11
|
# @parameter pid [Integer] The process ID.
|
|
12
12
|
# @parameter usage [Memory] The Memory instance to populate with fault counters.
|
|
13
13
|
def self.capture_faults(pid, usage)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
# The process may have exited or permissions are insufficient; ignore.
|
|
25
|
-
rescue => error
|
|
26
|
-
# Be robust to unexpected formats; ignore errors silently.
|
|
27
|
-
end
|
|
14
|
+
stat = File.read("/proc/#{pid}/stat")
|
|
15
|
+
# The comm field can contain spaces and parentheses; find the closing ')':
|
|
16
|
+
rparen_index = stat.rindex(")")
|
|
17
|
+
return unless rparen_index
|
|
18
|
+
fields = stat[(rparen_index+2)..-1].split(/\s+/)
|
|
19
|
+
# proc(5): field 10=minflt, 12=majflt; our fields array is 0-indexed from field 3.
|
|
20
|
+
usage.minor_faults = fields[10-3].to_i
|
|
21
|
+
usage.major_faults = fields[12-3].to_i
|
|
22
|
+
rescue
|
|
23
|
+
# Be robust to unexpected formats; ignore errors silently.
|
|
28
24
|
end
|
|
29
25
|
|
|
30
26
|
# @returns [Numeric] Total memory size in kilobytes.
|
|
@@ -72,8 +68,8 @@ module Process
|
|
|
72
68
|
usage.map_count += File.readlines("/proc/#{pid}/maps").size
|
|
73
69
|
# Also capture fault counters:
|
|
74
70
|
self.capture_faults(pid, usage)
|
|
75
|
-
rescue Errno::ENOENT
|
|
76
|
-
# Ignore.
|
|
71
|
+
rescue Errno::ENOENT, Errno::ESRCH
|
|
72
|
+
# Ignore, process may have ended.
|
|
77
73
|
end
|
|
78
74
|
|
|
79
75
|
return usage
|
|
@@ -104,8 +100,8 @@ module Process
|
|
|
104
100
|
end
|
|
105
101
|
# Also capture fault counters:
|
|
106
102
|
self.capture_faults(pid, usage)
|
|
107
|
-
rescue Errno::ENOENT
|
|
108
|
-
# Ignore.
|
|
103
|
+
rescue Errno::ENOENT, Errno::ESRCH
|
|
104
|
+
# Ignore, process may have ended.
|
|
109
105
|
end
|
|
110
106
|
|
|
111
107
|
return usage
|
data/readme.md
CHANGED
|
@@ -16,6 +16,10 @@ 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.6.1
|
|
20
|
+
|
|
21
|
+
- Handle `Errno::ESRCH: No such process @ io_fillbuf - fd:xxx /proc/xxx/smaps_rollup` by ignoring it.
|
|
22
|
+
|
|
19
23
|
### v0.6.0
|
|
20
24
|
|
|
21
25
|
- Add support for major and minor page faults on Linux: `Process::Metrics::Memory#major_faults` and `#minor_faults`. Unfortunately these metrics are not available on Darwin (macOS).
|
data/releases.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Releases
|
|
2
2
|
|
|
3
|
+
## v0.6.1
|
|
4
|
+
|
|
5
|
+
- Handle `Errno::ESRCH: No such process @ io_fillbuf - fd:xxx /proc/xxx/smaps_rollup` by ignoring it.
|
|
6
|
+
|
|
3
7
|
## v0.6.0
|
|
4
8
|
|
|
5
9
|
- Add support for major and minor page faults on Linux: `Process::Metrics::Memory#major_faults` and `#minor_faults`. Unfortunately these metrics are not available on Darwin (macOS).
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: process-metrics
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Samuel Williams
|
|
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
122
122
|
- !ruby/object:Gem::Version
|
|
123
123
|
version: '0'
|
|
124
124
|
requirements: []
|
|
125
|
-
rubygems_version: 3.
|
|
125
|
+
rubygems_version: 3.6.9
|
|
126
126
|
specification_version: 4
|
|
127
127
|
summary: Provide detailed OS-specific process metrics.
|
|
128
128
|
test_files: []
|
metadata.gz.sig
CHANGED
|
Binary file
|