times()
public
Returns a Tms structure (see Struct::Tms on page 388) that contains user
and system CPU times for this
process.
t = Process.times
[ t.utime, t.stime ]
VALUE
rb_proc_times(VALUE obj)
{
const double hertz =
#ifdef HAVE__SC_CLK_TCK
(double)sysconf(_SC_CLK_TCK);
#else
#ifndef HZ
# ifdef CLK_TCK
# define HZ CLK_TCK
# else
# define HZ 60
# endif
#endif /* HZ */
HZ;
#endif
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));
}