Module: LinuxStat::Nproc
- Defined in:
- ext/nproc/nproc.c
Class Method Summary collapse
Class Method Details
.count_cpu_for_pid(pid) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'ext/nproc/nproc.c', line 18 static VALUE count_cpu_for_pid(VALUE obj, VALUE pid) { cpu_set_t set ; CPU_ZERO(&set) ; char status = sched_getaffinity(FIX2INT(pid), sizeof(set), &set) ; if (status < 0) return Qnil ; return INT2FIX(CPU_COUNT(&set)) ; } |