Method: ScoutRailsProxy::Environment#processors

Defined in:
lib/scout_rails_proxy/environment.rb

#processorsObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/scout_rails_proxy/environment.rb', line 26

def processors
  return @processors if @processors
  unless @processors
    proc_file = '/proc/cpuinfo'
    if !File.exist?(proc_file)
      @processors = 1
    elsif `cat #{proc_file} | grep 'model name' | wc -l` =~ /(\d+)/
      @processors = $1.to_i
    end
    if @processors < 1
      @processors = 1
    end 
  end
  @processors
end