process-metrics 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f0917ad55068d053da8e6f58943114ab1cc7d2dd7b61969f022c7a373a7212d9
4
- data.tar.gz: cff5b81fdad7a03e4c2a843178e5c880c20c68580ef2dd93e9a29b529591ea87
3
+ metadata.gz: 1dfdad473ae6b2f7680c1c62bf67144c0451014c61e6a4d9c38650d2b51dcc86
4
+ data.tar.gz: 5938c811e5b7cab7d849b9430236bd60712158fe744ee5b494e3d01f0ed49997
5
5
  SHA512:
6
- metadata.gz: 94617d513a1849da4c48d052e4aa92d7279d07deb0f0710439a19f5c87b17a3c9fd259ea260b9c774130c7a111ed7ff4d4870d58ece51c1d2bff6a5c65ccd939
7
- data.tar.gz: 2689b081c6aa85ce0901c97feec76ddb54ef9bd322872f1fc6a76a6bfd14f682a8a80499e094fae8c080f443f36ddfaea61ea90c888a63fdee6f027a0fd5a8ed
6
+ metadata.gz: 2c607a0f1eb78abe097463ebd46784f2212b60b6bc5590dff646aecac131e5da59eb0e3a5ea082943c66d3fc0cb4425d19abb3596ed0350aec51718ac6fb4244
7
+ data.tar.gz: 420abffc1c85856674376cf95455972e58a18b18591ccc003be3e0d9bad6212d17587d93e10c0ec06691c60c187ba43e80af472c8c74be619f4e06f370780d3d
checksums.yaml.gz.sig ADDED
@@ -0,0 +1,2 @@
1
+ l���Ҫ�+n��VT��*�[��p5�-�Ǭ��췯�������u�,�﫢�o1L̑��lH ��U�i�rE+�56��V���8�4*haM�[��6]���G� 3L.N>�ڌ����|c<�LN�{S����ֻ:(�$� h�vN{���4�� ����KkA�����[wӢ�9�u9JE�m1�t�������v\_Li�`�ШY�;;�Q�8�ѿ[|����C�X�[~dz��?�5t-�S#0��K_�lL����B51V�`9��6�3,� p��w%1�?�-���4<ziY��D u�!"@ /e/J��(����U��[| ��\��V���?QC��D�u�~D�q�(�!�]�������oj"$
2
+ 0T0��y4��z���
@@ -1,22 +1,7 @@
1
- # Copyright, 2020, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the "Software"), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in
11
- # all copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- # THE SOFTWARE.
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2020-2024, by Samuel Williams.
20
5
 
21
6
  require 'samovar'
22
7
 
@@ -77,7 +62,7 @@ module Process
77
62
  return terminal
78
63
  end
79
64
 
80
- def format_pcpu(value, terminal)
65
+ def format_processor_utilization(value, terminal)
81
66
  if value > 80.0
82
67
  intensity = :high
83
68
  elsif value > 50.0
@@ -124,18 +109,21 @@ module Process
124
109
  summary = Process::Metrics::General.capture(pid: @options[:pid], ppid: @options[:ppid])
125
110
 
126
111
  format_memory_usage = self.method(:format_memory_usage).curry
127
- memory_usage = 0
112
+ shared_memory_usage = 0
113
+ private_memory_usage = 0
114
+
128
115
  proportional = true
129
116
 
130
117
  summary.each do |pid, general|
131
118
  terminal.print_line(:pid, pid, :reset, " ", :command, general[:command])
132
119
 
133
120
  terminal.print(:key, "Processor Usage: ".rjust(20), :reset)
134
- format_pcpu(general.pcpu, terminal)
121
+ format_processor_utilization(general.processor_utilization, terminal)
135
122
  terminal.print_line
136
123
 
137
124
  if memory = general.memory
138
- memory_usage += memory.proportional_size
125
+ shared_memory_usage += memory.proportional_size
126
+ private_memory_usage += memory.unique_size
139
127
 
140
128
  terminal.print_line(
141
129
  :key, "Memory (PSS): ".rjust(20), :reset,
@@ -147,7 +135,7 @@ module Process
147
135
  format_memory_usage[memory.unique_size]
148
136
  )
149
137
  else
150
- memory_usage += general.rss
138
+ shared_memory_usage += general.rss
151
139
  proportional = false
152
140
 
153
141
  terminal.print_line(
@@ -162,7 +150,12 @@ module Process
162
150
  if proportional
163
151
  terminal.print_line(
164
152
  :key, "Memory (PSS): ".rjust(20), :reset,
165
- format_memory_usage[memory_usage]
153
+ format_memory_usage[shared_memory_usage]
154
+ )
155
+
156
+ terminal.print_line(
157
+ :key, "Memory (USS): ".rjust(20), :reset,
158
+ format_memory_usage[private_memory_usage]
166
159
  )
167
160
  else
168
161
  terminal.print_line(
@@ -170,6 +163,11 @@ module Process
170
163
  format_memory_usage[memory_usage]
171
164
  )
172
165
  end
166
+
167
+ terminal.print_line(
168
+ :key, "Memory (Total): ".rjust(20), :reset,
169
+ format_memory_usage[shared_memory_usage + private_memory_usage]
170
+ )
173
171
  end
174
172
  end
175
173
  end
@@ -1,22 +1,7 @@
1
- # Copyright, 2020, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the "Software"), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in
11
- # all copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- # THE SOFTWARE.
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2020-2024, by Samuel Williams.
20
5
 
21
6
  require 'samovar'
22
7
 
@@ -1,22 +1,7 @@
1
- # Copyright, 2017, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the "Software"), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in
11
- # all copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- # THE SOFTWARE.
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2020-2024, by Samuel Williams.
20
5
 
21
6
  require_relative 'command/top'
22
7
 
@@ -1,32 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright, 2019, by Samuel G. D. Williams. <https://www.codeotaku.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
3
+ # Released under the MIT License.
4
+ # Copyright, 2019-2024, by Samuel Williams.
22
5
 
23
6
  require_relative 'memory'
24
7
  require 'set'
8
+ require 'json'
25
9
 
26
10
  module Process
27
11
  module Metrics
28
12
  PS = "ps"
29
13
 
14
+ # Parse a duration string into seconds.
30
15
  # According to the linux manual page specifications.
31
16
  def self.duration(value)
32
17
  if /((?<days>\d\d)\-)?((?<hours>\d\d):)?(?<minutes>\d\d):(?<seconds>\d\d)?/ =~ value
@@ -34,54 +19,54 @@ module Process
34
19
  end
35
20
  end
36
21
 
37
- # pid: Process Identifier
38
- # pmem: Percentage Memory used.
39
- # pcpu: Percentage Processor used.
40
- # time: The process time used (executing on CPU).
41
- # vsz: Virtual Size in kilobytes
42
- # rss: Resident Set Size in kilobytes
43
- # etime: The process elapsed time.
44
- # command: The name of the process.
22
+ # The fields that will be extracted from the `ps` command.
45
23
  FIELDS = {
46
- pid: ->(value){value.to_i},
47
- ppid: ->(value){value.to_i},
48
- pgid: ->(value){value.to_i},
49
- pcpu: ->(value){value.to_f},
50
- time: self.method(:duration),
51
- vsz: ->(value){value.to_i},
52
- rss: ->(value){value.to_i},
53
- etime: self.method(:duration),
54
- command: ->(value){value},
24
+ pid: ->(value){value.to_i}, # Process ID
25
+ ppid: ->(value){value.to_i}, # Parent Process ID
26
+ pgid: ->(value){value.to_i}, # Process Group ID
27
+ pcpu: ->(value){value.to_f}, # Percentage CPU
28
+ time: self.method(:duration), # CPU Time
29
+ vsz: ->(value){value.to_i}, # Virtual Size
30
+ rss: ->(value){value.to_i}, # Resident Size
31
+ etime: self.method(:duration), # Elapsed Time
32
+ command: ->(value){value}, # Command (name of the process)
55
33
  }
56
34
 
57
- class General < Struct.new(:pid, :ppid, :pgid, :pcpu, :vsz, :rss, :time, :etime, :command, :memory)
35
+ # General process information.
36
+ class General < Struct.new(:process_id, :parent_process_id, :process_group_id, :processor_utilization, :virtual_size, :resident_size, :processor_time, :elapsed_time, :command, :memory)
37
+ # Convert the object to a JSON serializable hash.
58
38
  def as_json
59
39
  {
60
- pid: self.pid,
61
- ppid: self.ppid,
62
- pgid: self.pgid,
63
- pcpu: self.pcpu,
64
- vsz: self.vsz,
65
- rss: self.rss,
66
- time: self.time,
67
- etime: self.etime,
40
+ process_id: self.process_id,
41
+ parent_process_id: self.parent_process_id,
42
+ process_group_id: self.process_group_id,
43
+ processor_utilization: self.processor_utilization,
44
+ total_size: self.total_size,
45
+ virtual_size: self.virtual_size,
46
+ resident_size: self.resident_size,
47
+ processor_time: self.processor_time,
48
+ elapsed_time: self.elapsed_time,
68
49
  command: self.command,
69
50
  memory: self.memory&.as_json,
70
51
  }
71
52
  end
72
53
 
54
+ # Convert the object to a JSON string.
73
55
  def to_json(*arguments)
74
56
  as_json.to_json(*arguments)
75
57
  end
76
58
 
77
- def memory_usage
78
- if self.memory
79
- self.memory.proportional_size
59
+ # The general memory usage of the process using the best available information.
60
+ def total_size
61
+ if memory = self.memory
62
+ memory.proportional_size
80
63
  else
81
- self.rss
64
+ self.resident_size
82
65
  end
83
66
  end
84
67
 
68
+ alias memory_usage total_size
69
+
85
70
  def self.expand_children(children, hierarchy, pids)
86
71
  children.each do |pid|
87
72
  self.expand(pid, hierarchy, pids)
@@ -102,8 +87,8 @@ module Process
102
87
  hierarchy = Hash.new{|h,k| h[k] = []}
103
88
 
104
89
  processes.each_value do |process|
105
- if ppid = process.ppid
106
- hierarchy[ppid] << process.pid
90
+ if parent_process_id = process.parent_process_id
91
+ hierarchy[parent_process_id] << process.process_id
107
92
  end
108
93
  end
109
94
 
@@ -116,7 +101,11 @@ module Process
116
101
  end
117
102
  end
118
103
 
119
- def self.capture(pid: nil, ppid: nil, ps: PS, fields: FIELDS)
104
+ # Capture process information. If given a `pid`, it will capture the details of that process. If given a `ppid`, it will capture the details of all child processes. Specify both `pid` and `ppid` if you want to capture a process and all its children.
105
+ #
106
+ # @parameter pid [Integer] The process ID to capture.
107
+ # @parameter ppid [Integer] The parent process ID to capture.
108
+ def self.capture(pid: nil, ppid: nil, ps: PS)
120
109
  input, output = IO.pipe
121
110
 
122
111
  arguments = [ps]
@@ -127,7 +116,7 @@ module Process
127
116
  arguments.push("ax")
128
117
  end
129
118
 
130
- arguments.push("-o", fields.keys.join(','))
119
+ arguments.push("-o", FIELDS.keys.join(','))
131
120
 
132
121
  ps_pid = Process.spawn(*arguments, out: output, pgroup: true)
133
122
 
@@ -138,13 +127,13 @@ module Process
138
127
  processes = {}
139
128
 
140
129
  lines.map do |line|
141
- record = fields.
142
- zip(line.split(/\s+/, fields.size)).
130
+ record = FIELDS.
131
+ zip(line.split(/\s+/, FIELDS.size)).
143
132
  map{|(key, type), value| type.call(value)}
144
133
 
145
134
  instance = self.new(*record)
146
135
 
147
- processes[instance.pid] = instance
136
+ processes[instance.process_id] = instance
148
137
  end
149
138
 
150
139
  if ppid
@@ -1,87 +1,108 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright, 2019, by Samuel G. D. Williams. <https://www.codeotaku.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
3
+ # Released under the MIT License.
4
+ # Copyright, 2019-2024, by Samuel Williams.
5
+
6
+ require 'json'
22
7
 
23
8
  module Process
24
9
  module Metrics
25
- class Memory < Struct.new(:map_count, :total_size, :resident_size, :proportional_size, :shared_clean_size, :shared_dirty_size, :private_clean_size, :private_dirty_size, :referenced_size, :anonymous_size, :swap_size, :proportional_swap_size)
10
+ class Memory < Struct.new(:map_count, :resident_size, :proportional_size, :shared_clean_size, :shared_dirty_size, :private_clean_size, :private_dirty_size, :referenced_size, :anonymous_size, :swap_size, :proportional_swap_size)
26
11
 
27
12
  alias as_json to_h
28
13
 
14
+ # Convert the object to a JSON string.
29
15
  def to_json(*arguments)
30
16
  as_json.to_json(*arguments)
31
17
  end
32
18
 
19
+ # The total size of the process in memory.
20
+ def total_size
21
+ self.resident_size + self.swap_size
22
+ end
23
+
33
24
  # The unique set size, the size of completely private (unshared) data.
34
25
  def unique_size
35
26
  self.private_clean_size + self.private_dirty_size
36
27
  end
37
28
 
38
- if File.readable?('/proc/self/smaps')
29
+ # The fields that will be extracted from the `smaps` data.
30
+ MAP = {
31
+ "Rss" => :resident_size,
32
+ "Pss" => :proportional_size,
33
+ "Shared_Clean" => :shared_clean_size,
34
+ "Shared_Dirty" => :shared_dirty_size,
35
+ "Private_Clean" => :private_clean_size,
36
+ "Private_Dirty" => :private_dirty_size,
37
+ "Referenced" => :referenced_size,
38
+ "Anonymous" => :anonymous_size,
39
+ "Swap" => :swap_size,
40
+ "SwapPss" => :proportional_swap_size,
41
+ }
42
+
43
+ if File.readable?('/proc/self/smaps_rollup')
44
+ # Whether the memory usage can be captured on this system.
39
45
  def self.supported?
40
46
  true
41
47
  end
42
48
 
43
- MAP = {
44
- "Size" => :total_size,
45
- "Rss" => :resident_size,
46
- "Pss" => :proportional_size,
47
- "Shared_Clean" => :shared_clean_size,
48
- "Shared_Dirty" => :shared_dirty_size,
49
- "Private_Clean" => :private_clean_size,
50
- "Private_Dirty" => :private_dirty_size,
51
- "Referenced" => :referenced_size,
52
- "Anonymous" => :anonymous_size,
53
- "Swap" => :swap_size,
54
- "SwapPss" => :proportional_swap_size,
55
- }
49
+ # Capture memory usage for the given process IDs.
50
+ def self.capture(pids)
51
+ usage = self.new(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
52
+
53
+ pids.each do |pid|
54
+ File.foreach("/proc/#{pid}/smaps_rollup") do |line|
55
+ if /(?<name>.*?):\s+(?<value>\d+) kB/ =~ line
56
+ if key = MAP[name]
57
+ usage[key] += value.to_i
58
+ end
59
+ end
60
+ end
61
+
62
+ usage.map_count += File.readlines("/proc/#{pid}/maps").size
63
+ rescue Errno::ENOENT => error
64
+ # Ignore.
65
+ end
66
+
67
+ return usage
68
+ end
69
+ elsif File.readable?('/proc/self/smaps')
70
+ # Whether the memory usage can be captured on this system.
71
+ def self.supported?
72
+ true
73
+ end
56
74
 
75
+ # Capture memory usage for the given process IDs.
57
76
  def self.capture(pids)
58
77
  usage = self.new(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
59
78
 
60
79
  pids.each do |pid|
61
- if lines = File.readlines("/proc/#{pid}/smaps")
62
- lines.each do |line|
63
- # The format of this is fixed according to:
64
- # https://github.com/torvalds/linux/blob/351c8a09b00b5c51c8f58b016fffe51f87e2d820/fs/proc/task_mmu.c#L804-L814
65
- if /(?<name>.*?):\s+(?<value>\d+) kB/ =~ line
66
- if key = MAP[name]
67
- usage[key] += value.to_i
68
- end
69
- elsif /VmFlags:\s+(?<flags>.*)/ =~ line
70
- # It should be possible to extract the number of fibers and each fiber's memory usage.
71
- # flags = flags.split(/\s+/)
72
- usage.map_count += 1
80
+ File.foreach("/proc/#{pid}/smaps") do |line|
81
+ # The format of this is fixed according to:
82
+ # https://github.com/torvalds/linux/blob/351c8a09b00b5c51c8f58b016fffe51f87e2d820/fs/proc/task_mmu.c#L804-L814
83
+ if /(?<name>.*?):\s+(?<value>\d+) kB/ =~ line
84
+ if key = MAP[name]
85
+ usage[key] += value.to_i
73
86
  end
87
+ elsif /VmFlags:\s+(?<flags>.*)/ =~ line
88
+ # It should be possible to extract the number of fibers and each fiber's memory usage.
89
+ # flags = flags.split(/\s+/)
90
+ usage.map_count += 1
74
91
  end
75
92
  end
93
+ rescue Errno::ENOENT => error
94
+ # Ignore.
76
95
  end
77
96
 
78
97
  return usage
79
98
  end
80
99
  else
100
+ # Whether the memory usage can be captured on this system.
81
101
  def self.supported?
82
102
  false
83
103
  end
84
104
 
105
+ # Capture memory usage for the given process IDs.
85
106
  def self.capture(pids)
86
107
  return self.new
87
108
  end
@@ -1,27 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright, 2019, by Samuel G. D. Williams. <https://www.codeotaku.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
3
+ # Released under the MIT License.
4
+ # Copyright, 2019-2024, by Samuel Williams.
22
5
 
23
6
  module Process
24
7
  module Metrics
25
- VERSION = "0.2.1"
8
+ VERSION = "0.3.0"
26
9
  end
27
10
  end
@@ -1,22 +1,7 @@
1
- # Copyright, 2019, by Samuel G. D. Williams. <https://www.codeotaku.com>
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the "Software"), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in
11
- # all copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- # THE SOFTWARE.
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2019-2024, by Samuel Williams.
20
5
 
21
6
  require_relative "metrics/version"
22
7
  require_relative "metrics/general"
data/license.md ADDED
@@ -0,0 +1,22 @@
1
+ # MIT License
2
+
3
+ Copyright, 2019-2024, by Samuel Williams.
4
+ Copyright, 2024, by Adam Daniels.
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
data/readme.md ADDED
@@ -0,0 +1,31 @@
1
+ # Process::Metrics
2
+
3
+ Extract performance and memory metrics from running processes.
4
+
5
+ ![Command Line Example](command-line.png)
6
+
7
+ [![Development Status](https://github.com/socketry/process-metrics/workflows/Test/badge.svg)](https://github.com/socketry/process-metrics/actions?workflow=Test)
8
+
9
+ ## Usage
10
+
11
+ Please see the [project documentation](https://socketry.github.io/process-metrics/) for more details.
12
+
13
+ - [Getting Started](https://socketry.github.io/process-metrics/guides/getting-started/index) - This guide explains how to use the `process-metrics` gem to collect and analyze process metrics including processor and memory utilization.
14
+
15
+ ## Contributing
16
+
17
+ We welcome contributions to this project.
18
+
19
+ 1. Fork it.
20
+ 2. Create your feature branch (`git checkout -b my-new-feature`).
21
+ 3. Commit your changes (`git commit -am 'Add some feature'`).
22
+ 4. Push to the branch (`git push origin my-new-feature`).
23
+ 5. Create new Pull Request.
24
+
25
+ ### Developer Certificate of Origin
26
+
27
+ 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.
28
+
29
+ ### Contributor Covenant
30
+
31
+ 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 ADDED
Binary file
metadata CHANGED
@@ -1,14 +1,44 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: process-metrics
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
- autorequire:
8
+ - Adam Daniels
9
+ autorequire:
9
10
  bindir: bin
10
- cert_chain: []
11
- date: 2020-02-03 00:00:00.000000000 Z
11
+ cert_chain:
12
+ - |
13
+ -----BEGIN CERTIFICATE-----
14
+ MIIE2DCCA0CgAwIBAgIBATANBgkqhkiG9w0BAQsFADBhMRgwFgYDVQQDDA9zYW11
15
+ ZWwud2lsbGlhbXMxHTAbBgoJkiaJk/IsZAEZFg1vcmlvbnRyYW5zZmVyMRIwEAYK
16
+ CZImiZPyLGQBGRYCY28xEjAQBgoJkiaJk/IsZAEZFgJuejAeFw0yMjA4MDYwNDUz
17
+ MjRaFw0zMjA4MDMwNDUzMjRaMGExGDAWBgNVBAMMD3NhbXVlbC53aWxsaWFtczEd
18
+ MBsGCgmSJomT8ixkARkWDW9yaW9udHJhbnNmZXIxEjAQBgoJkiaJk/IsZAEZFgJj
19
+ bzESMBAGCgmSJomT8ixkARkWAm56MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIB
20
+ igKCAYEAomvSopQXQ24+9DBB6I6jxRI2auu3VVb4nOjmmHq7XWM4u3HL+pni63X2
21
+ 9qZdoq9xt7H+RPbwL28LDpDNflYQXoOhoVhQ37Pjn9YDjl8/4/9xa9+NUpl9XDIW
22
+ sGkaOY0eqsQm1pEWkHJr3zn/fxoKPZPfaJOglovdxf7dgsHz67Xgd/ka+Wo1YqoE
23
+ e5AUKRwUuvaUaumAKgPH+4E4oiLXI4T1Ff5Q7xxv6yXvHuYtlMHhYfgNn8iiW8WN
24
+ XibYXPNP7NtieSQqwR/xM6IRSoyXKuS+ZNGDPUUGk8RoiV/xvVN4LrVm9upSc0ss
25
+ RZ6qwOQmXCo/lLcDUxJAgG95cPw//sI00tZan75VgsGzSWAOdjQpFM0l4dxvKwHn
26
+ tUeT3ZsAgt0JnGqNm2Bkz81kG4A2hSyFZTFA8vZGhp+hz+8Q573tAR89y9YJBdYM
27
+ zp0FM4zwMNEUwgfRzv1tEVVUEXmoFCyhzonUUw4nE4CFu/sE3ffhjKcXcY//qiSW
28
+ xm4erY3XAgMBAAGjgZowgZcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0O
29
+ BBYEFO9t7XWuFf2SKLmuijgqR4sGDlRsMC4GA1UdEQQnMCWBI3NhbXVlbC53aWxs
30
+ aWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MC4GA1UdEgQnMCWBI3NhbXVlbC53aWxs
31
+ aWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MA0GCSqGSIb3DQEBCwUAA4IBgQB5sxkE
32
+ cBsSYwK6fYpM+hA5B5yZY2+L0Z+27jF1pWGgbhPH8/FjjBLVn+VFok3CDpRqwXCl
33
+ xCO40JEkKdznNy2avOMra6PFiQyOE74kCtv7P+Fdc+FhgqI5lMon6tt9rNeXmnW/
34
+ c1NaMRdxy999hmRGzUSFjozcCwxpy/LwabxtdXwXgSay4mQ32EDjqR1TixS1+smp
35
+ 8C/NCWgpIfzpHGJsjvmH2wAfKtTTqB9CVKLCWEnCHyCaRVuKkrKjqhYCdmMBqCws
36
+ JkxfQWC+jBVeG9ZtPhQgZpfhvh+6hMhraUYRQ6XGyvBqEUe+yo6DKIT3MtGE2+CP
37
+ eX9i9ZWBydWb8/rvmwmX2kkcBbX0hZS1rcR593hGc61JR6lvkGYQ2MYskBveyaxt
38
+ Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
39
+ voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
40
+ -----END CERTIFICATE-----
41
+ date: 2024-04-06 00:00:00.000000000 Z
12
42
  dependencies:
13
43
  - !ruby/object:Gem::Dependency
14
44
  name: console
@@ -39,77 +69,27 @@ dependencies:
39
69
  - !ruby/object:Gem::Version
40
70
  version: '2.1'
41
71
  - !ruby/object:Gem::Dependency
42
- name: covered
72
+ name: json
43
73
  requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: bundler
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: rake
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '12.0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
74
  requirements:
80
75
  - - "~>"
81
76
  - !ruby/object:Gem::Version
82
- version: '12.0'
83
- - !ruby/object:Gem::Dependency
84
- name: rspec
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '3.8'
90
- type: :development
77
+ version: '2'
78
+ type: :runtime
91
79
  prerelease: false
92
80
  version_requirements: !ruby/object:Gem::Requirement
93
81
  requirements:
94
82
  - - "~>"
95
83
  - !ruby/object:Gem::Version
96
- version: '3.8'
97
- description:
84
+ version: '2'
85
+ description:
98
86
  email:
99
- - samuel.williams@oriontransfer.co.nz
100
87
  executables:
101
88
  - process-metrics
102
89
  extensions: []
103
90
  extra_rdoc_files: []
104
91
  files:
105
- - ".gitignore"
106
- - ".rspec"
107
- - ".travis.yml"
108
- - Gemfile
109
- - README.md
110
- - Rakefile
111
92
  - bin/process-metrics
112
- - command-line.png
113
93
  - lib/process/metrics.rb
114
94
  - lib/process/metrics/command.rb
115
95
  - lib/process/metrics/command/summary.rb
@@ -117,13 +97,16 @@ files:
117
97
  - lib/process/metrics/general.rb
118
98
  - lib/process/metrics/memory.rb
119
99
  - lib/process/metrics/version.rb
120
- - process-metrics.gemspec
100
+ - license.md
101
+ - readme.md
121
102
  homepage: https://github.com/socketry/process-metrics
122
103
  licenses:
123
104
  - MIT
124
105
  metadata:
106
+ documentation_uri: https://socketry.github.io/process-metrics/
125
107
  funding_uri: https://github.com/sponsors/ioquatix
126
- post_install_message:
108
+ source_code_uri: https://github.com/socketry/process-metrics.git
109
+ post_install_message:
127
110
  rdoc_options: []
128
111
  require_paths:
129
112
  - lib
@@ -131,15 +114,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
131
114
  requirements:
132
115
  - - ">="
133
116
  - !ruby/object:Gem::Version
134
- version: 2.3.0
117
+ version: '0'
135
118
  required_rubygems_version: !ruby/object:Gem::Requirement
136
119
  requirements:
137
120
  - - ">="
138
121
  - !ruby/object:Gem::Version
139
122
  version: '0'
140
123
  requirements: []
141
- rubygems_version: 3.1.2
142
- signing_key:
124
+ rubygems_version: 3.5.3
125
+ signing_key:
143
126
  specification_version: 4
144
127
  summary: Provide detailed OS-specific process metrics.
145
128
  test_files: []
metadata.gz.sig ADDED
@@ -0,0 +1,3 @@
1
+ h�n1��aZ��e0w�v��Ѷ����)A�QjlX#���5�Q��_F���|��b�ӎt�Q�&깆r���f�y-���cy�F�/J3��F��c��&e�:L�],p,��{o�h��#w$��3����7�1eǒ�����Yo�
2
+ �7A�
3
+ &&�{ _��Wl����J҂�5H��жѨ�v��~\G�Y͇ ���',<�⻺X��Z���S��I��Y|�Ѳ
data/.gitignore DELETED
@@ -1,14 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
-
10
- Gemfile.lock
11
-
12
- # rspec failure tracking
13
- .rspec_status
14
- .covered.db
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --warnings
3
- --require spec_helper
data/.travis.yml DELETED
@@ -1,22 +0,0 @@
1
- language: ruby
2
- dist: xenial
3
- cache: bundler
4
-
5
- matrix:
6
- include:
7
- - rvm: 2.4
8
- - rvm: 2.5
9
- - rvm: 2.6
10
- - rvm: 2.6
11
- env: COVERAGE=PartialSummary,Coveralls
12
- - rvm: 2.7
13
- - rvm: truffleruby
14
- - rvm: jruby-head
15
- - rvm: ruby-head
16
- - rvm: 2.7
17
- os: osx
18
- allow_failures:
19
- - rvm: truffleruby
20
- - rvm: ruby-head
21
- - rvm: jruby-head
22
- - rvm: truffleruby
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # Specify your gem's dependencies in process-metrics.gemspec
4
- gemspec
data/README.md DELETED
@@ -1,184 +0,0 @@
1
- # Process::Metrics
2
-
3
- Extract performance and memory metrics from running processes.
4
-
5
- [![Build Status](https://travis-ci.com/socketry/process-metrics.svg)](https://travis-ci.com/socketry/process-metrics)
6
-
7
- ## Installation
8
-
9
- To add it to your current project:
10
-
11
- bundle add process-metrics
12
-
13
- ## Usage
14
-
15
- Memory is measured in kilobytes and time is measured in seconds.
16
-
17
- ### Command Line
18
-
19
- You can use the `process-metrics` command line to print data about a running process and it's children:
20
-
21
- ![Command Line Example](command-line.png)
22
-
23
- ### Capturing for Specific Process
24
-
25
- You can capture the metrics for a single process:
26
-
27
- ```ruby
28
- #!/usr/bin/env ruby
29
-
30
- require 'process/metrics'
31
-
32
- metrics = Process::Metrics.capture(pid: Process.pid)
33
-
34
- pp metrics
35
- # [{:pid=>282195,
36
- # :ppid=>230572,
37
- # :pgid=>282195,
38
- # :pcpu=>0.0,
39
- # :time=>0,
40
- # :vsz=>78800,
41
- # :rss=>14360,
42
- # :etime=>0,
43
- # :command=>"ruby /tmp/6b35f421-4595-45d6-b444-754a50636daf",
44
- # :memory=>
45
- # {:total=>78804,
46
- # :rss=>14600,
47
- # :pss=>9208,
48
- # :shared_clean=>5728,
49
- # :shared_dirty=>0,
50
- # :private_clean=>16,
51
- # :private_dirty=>8856,
52
- # :referenced=>14600,
53
- # :anonymous=>8856,
54
- # :swap=>0,
55
- # :swap_pss=>0,
56
- # :maps=>150}}]
57
- ```
58
-
59
- ### Capturing for Process Hierarchy
60
-
61
- You can capture the metrics for a process and all it's children:
62
-
63
- ```ruby
64
- #!/usr/bin/env ruby
65
-
66
- require 'process/metrics'
67
-
68
- ppid = ENV["PPID"].to_i
69
- metrics = Process::Metrics.capture(pid: ppid, ppid: ppid)
70
-
71
- pp metrics
72
- # [{:pid=>68536,
73
- # :ppid=>46295,
74
- # :pgid=>68536,
75
- # :pcpu=>0.0,
76
- # :time=>0,
77
- # :vsz=>94516,
78
- # :rss=>29688,
79
- # :etime=>41057,
80
- # :command=>
81
- # "/home/samuel/.rbenv/versions/2.7.0/bin/ruby /home/samuel/.rbenv/versions/2.7.0/bin/falcon-host ./falcon.rb",
82
- # :memory=>
83
- # {:total=>94520,
84
- # :rss=>29696,
85
- # :pss=>8912,
86
- # :shared_clean=>9528,
87
- # :shared_dirty=>14588,
88
- # :private_clean=>924,
89
- # :private_dirty=>4656,
90
- # :referenced=>29696,
91
- # :anonymous=>19244,
92
- # :swap=>0,
93
- # :swap_pss=>0,
94
- # :maps=>294}},
95
- # {:pid=>68558,
96
- # :ppid=>68536,
97
- # :pgid=>68558,
98
- # :pcpu=>0.0,
99
- # :time=>0,
100
- # :vsz=>94516,
101
- # :rss=>23612,
102
- # :etime=>41057,
103
- # :command=>"supervisor",
104
- # :memory=>
105
- # {:total=>94520,
106
- # :rss=>23612,
107
- # :pss=>7551,
108
- # :shared_clean=>4416,
109
- # :shared_dirty=>14448,
110
- # :private_clean=>0,
111
- # :private_dirty=>4748,
112
- # :referenced=>11184,
113
- # :anonymous=>19196,
114
- # :swap=>0,
115
- # :swap_pss=>0,
116
- # :maps=>294}},
117
- # {:pid=>68559,
118
- # :ppid=>68536,
119
- # :pgid=>68558,
120
- # :pcpu=>0.0,
121
- # :time=>0,
122
- # :vsz=>95000,
123
- # :rss=>25136,
124
- # :etime=>41057,
125
- # :command=>"Falcon Host for hello.localhost",
126
- # :memory=>
127
- # {:total=>95004,
128
- # :rss=>25136,
129
- # :pss=>9308,
130
- # :shared_clean=>5504,
131
- # :shared_dirty=>11784,
132
- # :private_clean=>0,
133
- # :private_dirty=>7848,
134
- # :referenced=>17596,
135
- # :anonymous=>19632,
136
- # :swap=>0,
137
- # :swap_pss=>0,
138
- # :maps=>295}},
139
- # ... snip ...
140
- ```
141
-
142
- ### Metrics
143
-
144
- On some platforms (currently only Linux), additional memory metrics are captured.
145
-
146
- #### Proportional Set Size
147
-
148
- The total private memory usage + shared memory usage divided by the number of processes sharing said data.
149
-
150
- #### Unique Set Size
151
-
152
- The total private memory usage.
153
-
154
- ## Contributing
155
-
156
- 1. Fork it
157
- 2. Create your feature branch (`git checkout -b my-new-feature`)
158
- 3. Commit your changes (`git commit -am 'Add some feature'`)
159
- 4. Push to the branch (`git push origin my-new-feature`)
160
- 5. Create new Pull Request
161
-
162
- ## License
163
-
164
- Released under the MIT license.
165
-
166
- Copyright, 2019, by [Samuel G. D. Williams](https://www.codeotaku.com).
167
-
168
- Permission is hereby granted, free of charge, to any person obtaining a copy
169
- of this software and associated documentation files (the "Software"), to deal
170
- in the Software without restriction, including without limitation the rights
171
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
172
- copies of the Software, and to permit persons to whom the Software is
173
- furnished to do so, subject to the following conditions:
174
-
175
- The above copyright notice and this permission notice shall be included in
176
- all copies or substantial portions of the Software.
177
-
178
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
179
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
180
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
181
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
182
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
183
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
184
- THE SOFTWARE.
data/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
data/command-line.png DELETED
Binary file
@@ -1,33 +0,0 @@
1
- require_relative 'lib/process/metrics/version'
2
-
3
- Gem::Specification.new do |spec|
4
- spec.name = "process-metrics"
5
- spec.version = Process::Metrics::VERSION
6
- spec.authors = ["Samuel Williams"]
7
- spec.email = ["samuel.williams@oriontransfer.co.nz"]
8
-
9
- spec.summary = "Provide detailed OS-specific process metrics."
10
- spec.homepage = "https://github.com/socketry/process-metrics"
11
- spec.license = "MIT"
12
-
13
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
14
-
15
- spec.metadata["funding_uri"] = "https://github.com/sponsors/ioquatix"
16
-
17
- # Specify which files should be added to the gem when it is released.
18
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
20
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
- end
22
-
23
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
24
- spec.require_paths = ["lib"]
25
-
26
- spec.add_dependency "console", "~> 1.8"
27
- spec.add_dependency "samovar", "~> 2.1"
28
-
29
- spec.add_development_dependency "covered"
30
- spec.add_development_dependency "bundler"
31
- spec.add_development_dependency "rake", "~> 12.0"
32
- spec.add_development_dependency "rspec", "~> 3.8"
33
- end