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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5cca1e4bc8403f7fea51433ecdc8471f65fdf823
4
- data.tar.gz: 3dfb46b8047e464e46f3bee70826b6ed9114522e
3
+ metadata.gz: 40e47a8db99d1a0aa017234b19201977d0d5ffd7
4
+ data.tar.gz: e6f6c78ed5e072ba3e1c61ca8485e04f470e19e0
5
5
  SHA512:
6
- metadata.gz: dbf95661e13258be18215581177f9f7f2beb949dd5f389ba75b18d60af72b877bfcb2668a53ac641c59fc2ab26b34a6e0320a451c1a346c5191b07596d5f6714
7
- data.tar.gz: 77cbc7d341d3e8e40e573886f57d8be80801e37d8c55d813ca0853655b1ef9d205bf838cfda59015bfa761a9216a0896c5bbbdd63eb303c98618ae62a0ef78ac
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/get_process_memory.png?branch=master)](https://travis-ci.org/schneems/get_process_memory)
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
 
@@ -26,19 +26,15 @@ class GetProcessMem
26
26
  end
27
27
 
28
28
  def kb(b = bytes)
29
- b.to_f/KB_TO_BYTE
29
+ b.fdiv(KB_TO_BYTE)
30
30
  end
31
31
 
32
32
  def mb(b = bytes)
33
- b.to_f/MB_TO_BYTE
33
+ b.fdiv(MB_TO_BYTE)
34
34
  end
35
35
 
36
36
  def gb(b = bytes)
37
- b.to_f/GB_TO_BYTE
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.read.each_line.detect {|line| line.include? mem_type_for_linux }
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
- multiplier = CONVERSION[unit.downcase]
83
- multiplier * value.to_i
78
+ CONVERSION[unit.downcase] * value.to_i
84
79
  end
85
80
  end
86
81
 
@@ -1,3 +1,3 @@
1
1
  class GetProcessMem
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
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.1
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-09 00:00:00.000000000 Z
11
+ date: 2014-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake