host 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/host/linux/load_average.rb +6 -0
- data/lib/host/linux/memory.rb +15 -4
- data/lib/host/linux/processor.rb +6 -0
- data/lib/host/memory.rb +2 -2
- data/lib/host/version.rb +1 -1
- metadata +3 -3
data/lib/host/linux/memory.rb
CHANGED
@@ -11,22 +11,33 @@ module Host
|
|
11
11
|
|
12
12
|
# Just sugar. Equivalent to Host::Memory.get('MemTotal') with
|
13
13
|
# implicit transformation to integer (in kB)
|
14
|
-
|
14
|
+
# You can pass it a boolean option. If +true+, information will be
|
15
|
+
# reloaded. Defaults to +false+. Equivalent to:
|
16
|
+
# Host::Memory.refresh.total
|
17
|
+
def total(refresh=false)
|
18
|
+
get_meminfo if refresh
|
15
19
|
as_integer @info[:MemTotal]
|
16
20
|
end
|
17
21
|
|
18
22
|
# Sugar. Equivalent to Host::Memory.get('MemFree') with implicit
|
19
|
-
# transformation to integer (in kB)
|
20
|
-
def free
|
23
|
+
# transformation to integer (in kB).
|
24
|
+
def free(refresh=false)
|
25
|
+
get_meminfo if refresh
|
21
26
|
as_integer @info[:MemFree]
|
22
27
|
end
|
23
28
|
|
24
29
|
# Sugar. Equivalent to Host::Memory.get('Buffers') with implicit
|
25
30
|
# transformation to integer (in kB)
|
26
|
-
def buffers
|
31
|
+
def buffers(refresh=false)
|
32
|
+
get_meminfo if refresh
|
27
33
|
as_integer @info[:Buffers]
|
28
34
|
end
|
29
35
|
|
36
|
+
# Refreshes your memory information, reading +/proc/meminfo+ once again
|
37
|
+
def refresh
|
38
|
+
get_meminfo
|
39
|
+
end
|
40
|
+
|
30
41
|
# Retrieves specific information for the given key (as some exotic
|
31
42
|
# information in +/proc/meminfo+, for instance).
|
32
43
|
def get(key)
|
data/lib/host/linux/processor.rb
CHANGED
@@ -53,6 +53,12 @@ module Host
|
|
53
53
|
@current_core && @current_core[key.to_sym]
|
54
54
|
end
|
55
55
|
|
56
|
+
# Refreshes your processor information, reading from +/proc/cpuinfo+ once
|
57
|
+
# again
|
58
|
+
def refresh
|
59
|
+
get_cpuinfo
|
60
|
+
end
|
61
|
+
|
56
62
|
private
|
57
63
|
|
58
64
|
# Opens +/proc/cpuinfo+ and parses it, filling the info hash
|
data/lib/host/memory.rb
CHANGED
@@ -15,8 +15,8 @@ module Host
|
|
15
15
|
#
|
16
16
|
# Example usage:
|
17
17
|
#
|
18
|
-
# Host::Memory.total #=>
|
19
|
-
# Host::Memory.free #=>
|
18
|
+
# Host::Memory.total #=> 4023256
|
19
|
+
# Host::Memory.free #=> 2115874
|
20
20
|
# # For specific information (as in +/proc/meminfo+ for instance),
|
21
21
|
# # you can use the +get+ method
|
22
22
|
# Host::Memory.get('KernelStack') #=> "1080 kB"
|
data/lib/host/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: host
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2011-11-
|
14
|
+
date: 2011-11-20 00:00:00.000000000 Z
|
15
15
|
dependencies: []
|
16
16
|
description: ! " Host is a symple library for accessing your host system information
|
17
17
|
in runtime.\n It allows you to get CPU and memory usage, the load average and
|
@@ -63,7 +63,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
63
63
|
version: '0'
|
64
64
|
segments:
|
65
65
|
- 0
|
66
|
-
hash: -
|
66
|
+
hash: -699765582844184843
|
67
67
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
68
|
none: false
|
69
69
|
requirements:
|