cpuLoadAvg static method

double cpuLoadAvg()

Get system cpu load average

Implementation

static double cpuLoadAvg() {
  if (_libsysres == null) {
    throw Exception(
      'SystemResources are not initialized, call init() before using this method.',
    );
  }

  final fn = _libsysres!
      .lookup<ffi.NativeFunction<ffi.Float Function()>>('get_cpu_load')
      .asFunction<GetCpuLoad>();

  return fn();
}