Module: AixFacterHelper

Defined in:
lib/aix_facter_helper.rb,
lib/aix_facter_helper/version.rb,
ext/aix_facter_helper/aix_facter_helper.c

Defined Under Namespace

Classes: Error

Constant Summary collapse

VERSION =
"0.1.2"

Class Method Summary collapse

Class Method Details

.getLoadAveragesObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'ext/aix_facter_helper/aix_facter_helper.c', line 13

VALUE aixFacterHelper_getLoadAverages(VALUE self) {
  VALUE result = Qnil;
  long long averages[3];
  int buf_size = 3 * sizeof(long long);
  int rc = getkerninfo(KINFO_GET_AVENRUN, (char*)averages, &buf_size, 0);
  if (rc < 0) {
    return result;
  }
  result = rb_ary_new();
  rb_ary_push(result, DBL2NUM(to_load_avg(averages[0])));
  rb_ary_push(result, DBL2NUM(to_load_avg(averages[1])));
  rb_ary_push(result, DBL2NUM(to_load_avg(averages[2])));
  return result;
}