server_metrics 0.0.8 → 0.0.8.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -52,7 +52,7 @@ class ServerMetrics::Processes
52
52
  # and calculates CPU time for each process. Since CPU time has to be calculated relative to the last sample,
53
53
  # the collector has to be run twice to get CPU data.
54
54
  def calculate_processes
55
-
55
+ num_processors = ServerMetrics::SystemInfo.num_processors
56
56
  ## 1. get a list of all processes
57
57
  processes = Sys::ProcTable.ps.map{|p| ServerMetrics::Processes::Process.new(p) } # our Process object adds a method and adds some behavior
58
58
 
@@ -74,7 +74,7 @@ class ServerMetrics::Processes
74
74
  # a) p.recent_cpu / elapsed_jiffies = the amount of CPU time this process has taken divided by the total "time slots" the CPU has available
75
75
  # b) * 100 ... this turns it into a percentage
76
76
  # b) / num_processors ... this normalizes for the the number of processors in the system, so it reflects the amount of CPU power avaiable as a whole
77
- p.recent_cpu_percentage = ((p.recent_cpu.to_f / elapsed_jiffies.to_f ) * 100.0) / ServerMetrics::SystemInfo.num_processors.to_f
77
+ p.recent_cpu_percentage = ((p.recent_cpu.to_f / elapsed_jiffies.to_f ) * 100.0) / num_processors.to_f
78
78
  end
79
79
  end
80
80
  end
@@ -1,3 +1,3 @@
1
1
  module ServerMetrics
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.8.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: server_metrics
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.8.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-06 00:00:00.000000000 Z
12
+ date: 2013-11-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sys-proctable
@@ -171,7 +171,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
171
171
  version: '0'
172
172
  segments:
173
173
  - 0
174
- hash: -865855317494333286
174
+ hash: -1787592885794461316
175
175
  required_rubygems_version: !ruby/object:Gem::Requirement
176
176
  none: false
177
177
  requirements:
@@ -180,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
180
  version: '0'
181
181
  segments:
182
182
  - 0
183
- hash: -865855317494333286
183
+ hash: -1787592885794461316
184
184
  requirements: []
185
185
  rubyforge_project:
186
186
  rubygems_version: 1.8.25