Module: Facter::Util::Resolvers::Ffi::LoadAverages

Extended by:
FFI::Library
Defined in:
lib/facter/util/resolvers/ffi/load_averages.rb

Overview

Since:

  • 2.0.0

Class Method Summary collapse

Class Method Details

.read_load_averagesObject

Since:

  • 2.0.0



15
16
17
18
19
20
21
22
# File 'lib/facter/util/resolvers/ffi/load_averages.rb', line 15

def self.read_load_averages
  raw_loadavg = ::FFI::MemoryPointer.new(:double, 3)

  res = LoadAverages.getloadavg(raw_loadavg, 3)
  return unless res == 3

  raw_loadavg.read_array_of_double(res)
end