get_process_mem 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/get_process_mem.rb +5 -10
- data/lib/get_process_mem/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40e47a8db99d1a0aa017234b19201977d0d5ffd7
|
4
|
+
data.tar.gz: e6f6c78ed5e072ba3e1c61ca8485e04f470e19e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35a0c27762550925839a2c6722d3e759bb77568e1a7badf46ddaa81c5907ee1c7e4c122b9e9bc0b772ce573c3d4b08b5626ec40bf71f5491c6a5250f1ac05893
|
7
|
+
data.tar.gz: 1ff60c90b5f3b47526b86a5ea7bcb4d40068a4aa67a424246bcde6bc25a2cfb2b43dd03de2806c6e8b8be2943e28d3fdbce4eaeff565496d2f1ee6aa15e045d9
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Get Process Memory
|
2
2
|
|
3
|
-
[![Build Status](https://travis-ci.org/schneems/
|
3
|
+
[![Build Status](https://travis-ci.org/schneems/get_process_mem.png?branch=master)](https://travis-ci.org/schneems/get_process_mem)
|
4
4
|
|
5
5
|
Do you need to get the memory useage of a process? Great because this library does that.
|
6
6
|
|
data/lib/get_process_mem.rb
CHANGED
@@ -26,19 +26,15 @@ class GetProcessMem
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def kb(b = bytes)
|
29
|
-
b.
|
29
|
+
b.fdiv(KB_TO_BYTE)
|
30
30
|
end
|
31
31
|
|
32
32
|
def mb(b = bytes)
|
33
|
-
b.
|
33
|
+
b.fdiv(MB_TO_BYTE)
|
34
34
|
end
|
35
35
|
|
36
36
|
def gb(b = bytes)
|
37
|
-
b.
|
38
|
-
end
|
39
|
-
|
40
|
-
def refresh
|
41
|
-
@bytes = nil
|
37
|
+
b.fdiv(GB_TO_BYTE)
|
42
38
|
end
|
43
39
|
|
44
40
|
def inspect
|
@@ -76,11 +72,10 @@ class GetProcessMem
|
|
76
72
|
# linux stores memory info in a file "/proc/#{pid}/status"
|
77
73
|
# If it's available it uses less resources than shelling out to ps
|
78
74
|
def linux_memory
|
79
|
-
line = @process_file.
|
75
|
+
line = @process_file.each_line.detect {|line| line.include? mem_type_for_linux }
|
80
76
|
return unless line
|
81
77
|
return unless (name, value, unit = line.split(nil)).length == 3
|
82
|
-
|
83
|
-
multiplier * value.to_i
|
78
|
+
CONVERSION[unit.downcase] * value.to_i
|
84
79
|
end
|
85
80
|
end
|
86
81
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: get_process_mem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Schneeman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|