/* * call-seq: * Process.times => aStructTms * * Returns a <code>Tms</code> structure (see <code>Struct::Tms</code> * on page 388) that contains user and system CPU times for this * process. * * t = Process.times * [ t.utime, t.stime ] #=> [0.0, 0.02] */ VALUE rb_proc_times(obj) VALUE obj; { #if defined(HAVE_TIMES) && !defined(__CHECKER__) #ifndef HZ # ifdef CLK_TCK # define HZ CLK_TCK # else # define HZ 60 # endif #endif /* HZ */ struct tms buf; volatile VALUE utime, stime, cutime, sctime; times(&buf); return rb_struct_new(S_Tms, utime = rb_float_new((double)buf.tms_utime / HZ), stime = rb_float_new((double)buf.tms_stime / HZ), cutime = rb_float_new((double)buf.tms_cutime / HZ), sctime = rb_float_new((double)buf.tms_cstime / HZ)); #else rb_notimplement(); #endif }