Class: SystemProcessors

Inherits:
Object
  • Object
show all
Defined in:
lib/processors.rb

Overview

Base and factory for processor probes

Constant Summary collapse

UNLIMITED =
-1

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#architectureObject

DONE

enum x86_64, ARM64



10
11
12
# File 'lib/processors.rb', line 10

def architecture
  @architecture
end

#core_countObject

DONE

number of total cores enabled



11
12
13
# File 'lib/processors.rb', line 11

def core_count
  @core_count
end

#countObject

DONE

number of processors



9
10
11
# File 'lib/processors.rb', line 9

def count
  @count
end

#familyObject

DONE

family number



18
19
20
# File 'lib/processors.rb', line 18

def family
  @family
end

#l2_cacheObject

DONE

L2 cache in KB



13
14
15
# File 'lib/processors.rb', line 13

def l2_cache
  @l2_cache
end

#l3_cacheObject

DONE

L3 cache in KB



14
15
16
# File 'lib/processors.rb', line 14

def l3_cache
  @l3_cache
end

#manufacturerObject

DONE

manufacturer descriptor: i.e. GenuineIntel



15
16
17
# File 'lib/processors.rb', line 15

def manufacturer
  @manufacturer
end

#modelObject

DONE

model/version number



16
17
18
# File 'lib/processors.rb', line 16

def model
  @model
end

#model_nameObject

DONE

model/version descriptor



17
18
19
# File 'lib/processors.rb', line 17

def model_name
  @model_name
end

#speedObject

DONE

current speed in GigaHertz



8
9
10
# File 'lib/processors.rb', line 8

def speed
  @speed
end

#thread_countObject

DONE

total number of threads



12
13
14
# File 'lib/processors.rb', line 12

def thread_count
  @thread_count
end

Class Method Details

.probeObject



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/processors.rb', line 20

def self.probe
  case RbConfig::CONFIG['host_os']
  when /linux/
    LinuxSystemProcessors.new
  when /darwin/
    MacSystemProcessors.new
  when /cygwin|mswin|mingw32|mingw|bccwin|wince|emx/
    WindowsSystemProcessors.new
  else
    RbConfig::CONFIG['host_os']
  end
end