Module: Facter::Aix::FfiHelper
- Defined in:
- lib/facter/resolvers/aix/ffi/ffi_helper.rb
Defined Under Namespace
Modules: Libc
Constant Summary collapse
- KINFO_GET_AVENRUN =
1
- KINFO_READ =
8 << 8
Class Method Summary collapse
Class Method Details
.read_load_averages ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/facter/resolvers/aix/ffi/ffi_helper.rb', line 24 def self.read_load_averages averages = FFI::MemoryPointer.new(:long_long, 3) averages_size = FFI::MemoryPointer.new(:int, 1) averages_size.write_int(averages.size) return if Libc.getkerninfo(KINFO_READ | KINFO_GET_AVENRUN, averages, averages_size, 0).negative? averages.read_array_of_long_long(3).map { |x| (x / 65_536.0).round(5) } end |