times()
public
Returns a Tms structure (see Struct::Tms) that contains user and system CPU
times for this process, and also
for children processes.
t = Process.times
[ t.utime, t.stime, t.cutime, t.cstime ]
Show source
VALUE
rb_proc_times(VALUE obj)
{
const double hertz =
(double)sysconf(_SC_CLK_TCK);
HZ;
struct tms buf;
volatile VALUE utime, stime, cutime, sctime;
times(&buf);
return rb_struct_new(rb_cProcessTms,
utime = DBL2NUM(buf.tms_utime / hertz),
stime = DBL2NUM(buf.tms_stime / hertz),
cutime = DBL2NUM(buf.tms_cutime / hertz),
sctime = DBL2NUM(buf.tms_cstime / hertz));
}