cpu-memory-stats 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "cpu-memory-stats"
8
- s.version = "0.0.3"
8
+ s.version = "0.0.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ondrej Bartas"]
12
- s.date = "2012-08-03"
12
+ s.date = "2013-03-15"
13
13
  s.description = "Simple gem for getting information about cpu and memory usage (Mac OS X, BSD)"
14
14
  s.email = "ondrej@bartas.cz"
15
15
  s.extra_rdoc_files = [
@@ -34,7 +34,7 @@ Gem::Specification.new do |s|
34
34
  s.homepage = "http://github.com/ondrejbartas/cpu-memory-stats"
35
35
  s.licenses = ["MIT"]
36
36
  s.require_paths = ["lib"]
37
- s.rubygems_version = "1.8.10"
37
+ s.rubygems_version = "1.8.24"
38
38
  s.summary = "Get system CPU and Memory usage"
39
39
 
40
40
  if s.respond_to? :specification_version then
@@ -7,25 +7,25 @@ module CpuMemoryStats
7
7
  class Bsd
8
8
 
9
9
  def get_stats
10
-
11
- output = { :cpu => {} }
12
-
10
+
11
+ output = { :cpu => {} }
12
+
13
13
  output[:load_avg] = `sysctl -n vm.loadavg`.gsub(/\{|\}/,"").strip.split(" ").collect{|i| i.strip.to_f.round(2)}
14
-
14
+
15
15
  cpu = `sysctl -n kern.cp_time`.strip.split(" ").collect{|i| i.strip.to_i}
16
16
  cpu_start = Hash[[:user, :nice, :system, :interupt, :idle].zip(cpu)]
17
- sleep(1)
17
+ sleep(0.01)
18
18
  cpu = `sysctl -n kern.cp_time`.strip.split(" ").collect{|i| i.strip.to_i}
19
19
  cpu_end = Hash[[:user, :nice, :system, :interupt, :idle].zip(cpu)]
20
20
 
21
21
  cpu_end.each do |key, value|
22
22
  output[:cpu][key] = value - cpu_start[key]
23
- end
23
+ end
24
24
 
25
25
  output[:memory] = {
26
- :wired => `sysctl -n vm.stats.vm.v_wire_count`.to_i,
27
- :active => `sysctl -n vm.stats.vm.v_active_count`.to_i,
28
- :inactive => `sysctl -n vm.stats.vm.v_inactive_count`.to_i,
26
+ :wired => `sysctl -n vm.stats.vm.v_wire_count`.to_i,
27
+ :active => `sysctl -n vm.stats.vm.v_active_count`.to_i,
28
+ :inactive => `sysctl -n vm.stats.vm.v_inactive_count`.to_i,
29
29
  :used => 0, #fix missing columns
30
30
  :free => `sysctl -n vm.stats.vm.v_free_count`.to_i
31
31
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cpu-memory-stats
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-03 00:00:00.000000000 Z
12
+ date: 2013-03-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
16
- requirement: &70202344471320 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: 1.1.5
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70202344471320
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 1.1.5
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: jeweler
27
- requirement: &70202344470720 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ~>
@@ -32,7 +37,12 @@ dependencies:
32
37
  version: 1.8.4
33
38
  type: :development
34
39
  prerelease: false
35
- version_requirements: *70202344470720
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 1.8.4
36
46
  description: Simple gem for getting information about cpu and memory usage (Mac OS
37
47
  X, BSD)
38
48
  email: ondrej@bartas.cz
@@ -70,7 +80,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
70
80
  version: '0'
71
81
  segments:
72
82
  - 0
73
- hash: 2166164586050326453
83
+ hash: 4104429316326283446
74
84
  required_rubygems_version: !ruby/object:Gem::Requirement
75
85
  none: false
76
86
  requirements:
@@ -79,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
89
  version: '0'
80
90
  requirements: []
81
91
  rubyforge_project:
82
- rubygems_version: 1.8.10
92
+ rubygems_version: 1.8.24
83
93
  signing_key:
84
94
  specification_version: 3
85
95
  summary: Get system CPU and Memory usage