Sha256: 96ea564e97275a8491233c760b9844146330506c8223d00156cb76d641c1402c

Contents?: true

Size: 654 Bytes

Versions: 22

Compression:

Stored size: 654 Bytes

Contents

# frozen_string_literal: true

module Facter
  module Resolvers
    class LoadAverages < BaseResolver
      init_resolver

      class << self
        private

        def post_resolve(fact_name, _options)
          @fact_list.fetch(fact_name) { read_load_averages(fact_name) }
        end

        def read_load_averages(fact_name)
          require 'facter/util/resolvers/ffi/load_averages'

          log.debug('loading cpu load averages')
          @fact_list[:load_averages] = %w[1m 5m 15m].zip(Facter::Util::Resolvers::Ffi::LoadAverages
            .read_load_averages).to_h

          @fact_list[fact_name]
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
facter-4.3.1 lib/facter/resolvers/load_averages.rb
facter-4.3.0 lib/facter/resolvers/load_averages.rb
facter-4.2.14 lib/facter/resolvers/load_averages.rb
facter-4.2.13 lib/facter/resolvers/load_averages.rb
facter-4.2.12 lib/facter/resolvers/load_averages.rb
facter-4.2.11 lib/facter/resolvers/load_averages.rb
facter-4.2.10 lib/facter/resolvers/load_averages.rb
facter-4.2.9 lib/facter/resolvers/load_averages.rb
facter-4.2.8 lib/facter/resolvers/load_averages.rb
facter-4.2.7 lib/facter/resolvers/load_averages.rb
facter-4.2.6 lib/facter/resolvers/load_averages.rb
facter-4.2.5 lib/facter/resolvers/load_averages.rb
facter-4.2.4 lib/facter/resolvers/load_averages.rb
facter-4.2.3 lib/facter/resolvers/load_averages.rb
facter-4.2.2 lib/facter/resolvers/load_averages.rb
facter-4.2.1 lib/facter/resolvers/load_averages.rb
facter-4.2.0 lib/facter/resolvers/load_averages.rb
facter-4.1.1 lib/facter/resolvers/load_averages.rb
facter-4.1.0 lib/facter/resolvers/load_averages.rb
facter-4.0.52 lib/facter/resolvers/load_averages.rb