Module: LinuxStat::Nproc
- Defined in:
- ext/nproc/nproc.c
Class Method Summary collapse
Class Method Details
.count_cpu_for_pid(pid) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'ext/nproc/nproc.c', line 8 static VALUE count_cpu_for_pid(VALUE obj, VALUE pid) { cpu_set_t set; CPU_ZERO(&set); pid_t pid_int = (pid_t)NUM2LONG(pid); if (sched_getaffinity(pid_int, sizeof(set), &set) == -1) return Qnil; return INT2FIX(CPU_COUNT(&set)); } |