scout_rails 1.0.2.pre2 → 1.0.2.pre3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.markdown CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  * Net::HTTP instrumentation
4
4
  * ActionController::Metal instrumentation
5
+ * Determining number of processors
5
6
 
6
7
  # 1.0.1
7
8
 
@@ -37,7 +37,7 @@ module ScoutRails
37
37
  @layaway = ScoutRails::Layaway.new
38
38
  @config = ScoutRails::Config.new(options[:config_path])
39
39
  @metric_lookup = Hash.new
40
- @process_cpu=ScoutRails::Instruments::Process::ProcessCpu.new(1) # TODO: the argument is the number of processors
40
+ @process_cpu=ScoutRails::Instruments::Process::ProcessCpu.new(environment.processors)
41
41
  @process_memory=ScoutRails::Instruments::Process::ProcessMemory.new
42
42
  end
43
43
 
@@ -191,7 +191,7 @@ module ScoutRails
191
191
  def run_samplers
192
192
  begin
193
193
  cpu_util=@process_cpu.run # returns a hash
194
- logger.debug "Process CPU: #{cpu_util.inspect}"
194
+ logger.debug "Process CPU: #{cpu_util.inspect} [#{environment.processors} CPU(s)]"
195
195
  store.track!("CPU/Utilization",cpu_util) if cpu_util
196
196
  rescue => e
197
197
  logger.info "Error reading ProcessCpu"
@@ -23,6 +23,19 @@ module ScoutRails
23
23
  end
24
24
  end
25
25
 
26
+ def processors
27
+ return @processors if @processors
28
+ unless @processors
29
+ if `cat /proc/cpuinfo | grep 'model name' | wc -l` =~ /(\d+)/
30
+ @processors = $1.to_i
31
+ end
32
+ if @processors < 1
33
+ @processors = 1
34
+ end
35
+ end
36
+ @processors
37
+ end
38
+
26
39
  def root
27
40
  if framework == :rails
28
41
  RAILS_ROOT.to_s
@@ -1,3 +1,3 @@
1
1
  module ScoutRails
2
- VERSION = "1.0.2.pre2"
2
+ VERSION = "1.0.2.pre3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scout_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2.pre2
4
+ version: 1.0.2.pre3
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-07-26 00:00:00.000000000 Z
13
+ date: 2012-07-30 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: Monitors a Ruby on Rails application and reports detailed metrics on
16
16
  performance to Scout, a hosted monitoring service.