proc_parser 0.2.1 → 0.2.2
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
- data/Gemfile.lock +7 -1
- data/README.md +1 -1
- data/lib/proc_parser/cpu_stat.rb +1 -10
- data/lib/proc_parser/mem_info.rb +2 -2
- data/lib/proc_parser/version.rb +1 -1
- data/proc_parser.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5441defec722a5f7c3233fbcb92766dc20451cd8
|
4
|
+
data.tar.gz: 98917dcc7c55cc64938785af3b3c18f288909470
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b3970db2cf0d28f40eecd8f39e1a904f3a18d47c8efbc4eec56a55b275f442708a25a13d5d62f91109f027e16641a80fa09c8d570ec86d658804fc20ee1f078
|
7
|
+
data.tar.gz: 8e10690f11efc452b2b5060b24e8bd15164c22933779a12f8b9e7b0c23144c7dc796e7e3102d7d9eb41a1fb4718da5aa2382e7e61135529dbaebce6f8fb4ba28
|
data/Gemfile.lock
CHANGED
@@ -1,12 +1,17 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
proc_parser (0.2.
|
4
|
+
proc_parser (0.2.2)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
+
coderay (1.1.2)
|
9
10
|
diff-lcs (1.3)
|
11
|
+
method_source (0.9.0)
|
12
|
+
pry (0.11.3)
|
13
|
+
coderay (~> 1.1.0)
|
14
|
+
method_source (~> 0.9.0)
|
10
15
|
rake (12.1.0)
|
11
16
|
rspec (3.6.0)
|
12
17
|
rspec-core (~> 3.6.0)
|
@@ -28,6 +33,7 @@ PLATFORMS
|
|
28
33
|
DEPENDENCIES
|
29
34
|
bundler (~> 1.15)
|
30
35
|
proc_parser!
|
36
|
+
pry
|
31
37
|
rake (~> 12.1)
|
32
38
|
rspec (~> 3.6)
|
33
39
|
|
data/README.md
CHANGED
@@ -36,7 +36,7 @@ memfree = meminfo.memfree
|
|
36
36
|
|
37
37
|
## Development
|
38
38
|
|
39
|
-
After checking out the
|
39
|
+
After checking out the repository, run `bin/setup` to install dependencies.
|
40
40
|
Then, run `bundle exec rake spec` to run the tests. You can also run
|
41
41
|
`bin/console` for an interactive prompt that will allow you to experiment.
|
42
42
|
|
data/lib/proc_parser/cpu_stat.rb
CHANGED
@@ -19,8 +19,6 @@ module ProcParser
|
|
19
19
|
guest_nice: 10,
|
20
20
|
}
|
21
21
|
|
22
|
-
attr_accessor :nb_cpu
|
23
|
-
|
24
22
|
def initialize(stat_file = '/proc/stat')
|
25
23
|
raise NoProcData, "This system doesn't have /proc/stat data." if !File.exist?(stat_file)
|
26
24
|
|
@@ -31,13 +29,6 @@ module ProcParser
|
|
31
29
|
@@attributes.each do |attribute, index|
|
32
30
|
instance_variable_set("@#{attribute}", firstline[index].to_i)
|
33
31
|
end
|
34
|
-
|
35
|
-
@nb_cpu = 0
|
36
|
-
file.each do |line|
|
37
|
-
splitted_line = line.strip.squeeze(' ').split(' ')
|
38
|
-
break if !splitted_line[0].start_with? 'cpu'
|
39
|
-
@nb_cpu += 1
|
40
|
-
end
|
41
32
|
end
|
42
33
|
end
|
43
34
|
|
@@ -63,7 +54,7 @@ module ProcParser
|
|
63
54
|
|
64
55
|
total = idlealltime + non_idlealltime
|
65
56
|
|
66
|
-
return non_idlealltime / total.to_f
|
57
|
+
return non_idlealltime / total.to_f
|
67
58
|
end
|
68
59
|
end
|
69
60
|
end
|
data/lib/proc_parser/mem_info.rb
CHANGED
@@ -81,8 +81,8 @@ module ProcParser
|
|
81
81
|
|
82
82
|
# Memory available in the system. It is not just the free memory.
|
83
83
|
#
|
84
|
-
# The available memory is actually what the `free` command line tool calls `-/+ buffers/cache`.
|
85
|
-
# uses information from /proc/meminfo: it sums the MemFree, the Buffers and the Cached.
|
84
|
+
# The available memory is actually what the `free` command line tool calls `-/+ buffers/cache`.
|
85
|
+
# It uses information from /proc/meminfo: it sums the MemFree, the Buffers and the Cached.
|
86
86
|
#
|
87
87
|
# cf. `free` source code: https://github.com/mmalecki/procps/blob/fe4c4a7314f32907b9f558ad0d8b8d0ff1cc76be/free.c#L97
|
88
88
|
# cf. man 5 proc
|
data/lib/proc_parser/version.rb
CHANGED
data/proc_parser.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: proc_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Étienne Michon
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.6'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
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'
|
55
69
|
description: |-
|
56
70
|
ProcParser provides a Ruby wrapper for /proc data such as mem_info, stat
|
57
71
|
and loadavg
|