Back to index

glibc  2.9
times.c File Reference
#include <errno.h>
#include <stddef.h>
#include <sys/resource.h>
#include <sys/times.h>
#include <sys/time.h>
#include <time.h>
#include <mach.h>
#include <mach/task_info.h>
#include <hurd.h>

Go to the source code of this file.


static clock_t clock_from_time_value (const time_value_t *t)
clock_t __times (struct tms *tms)

Function Documentation

clock_t __times ( struct tms tms)

Definition at line 41 of file times.c.

  struct task_basic_info bi;
  struct task_thread_times_info tti;
  mach_msg_type_number_t count;
  union { time_value_t tvt; struct timeval tv; } now;
  error_t err;

  err = __task_info (__mach_task_self (), TASK_BASIC_INFO,
                   (task_info_t) &bi, &count);
  if (err)
    return __hurd_fail (err);

  err = __task_info (__mach_task_self (), TASK_THREAD_TIMES_INFO,
                   (task_info_t) &tti, &count);
  if (err)
    return __hurd_fail (err);

  tms->tms_utime = (clock_from_time_value (&bi.user_time)
                  + clock_from_time_value (&tti.user_time));
  tms->tms_stime = (clock_from_time_value (&bi.system_time)
                  + clock_from_time_value (&tti.system_time));

  /* XXX This can't be implemented until getrusage(RUSAGE_CHILDREN) can be.  */
  tms->tms_cutime = tms->tms_cstime = 0;

  if (__gettimeofday (&, NULL) < 0)
    return -1;

  return (clock_from_time_value (&now.tvt)
         - clock_from_time_value (&bi.creation_time));

Here is the call graph for this function:

static clock_t clock_from_time_value ( const time_value_t *  t) [inline, static]

Definition at line 31 of file times.c.

  return t->seconds * 1000000 + t->microseconds;

Here is the caller graph for this function: