Method: CPU::MSR#initialize
- Defined in:
- lib/cpu/msr.rb
#initialize(processor_id) ⇒ MSR
Create a new wrapper for the msr kernel file associated with processor_id.
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/cpu/msr.rb', line 17 def initialize(processor_id) self.class.available? or self.class.load_module begin name = '/dev/cpu/%d/msr' % processor_id @io = IO.new IO.sysopen(name, 'rb') rescue Errno::ENOENT raise InvalidProcessorIdError, "'#{processor_id}' is not a valid processor_id on this machine" rescue StandardError => e raise NoSampleDataError, "could not read temperature from #{name}: #{e}" end end |