OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [newlib/] [libc/] [machine/] [powerpc/] [times.c] - Blame information for rev 158

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
/* Time support routines for PowerPC.
2
 *
3
 * Written by Aldy Hernandez.
4
 */
5
 
6
#include <_ansi.h>
7
#include <reent.h>
8
#include <sys/time.h>
9
#include <sys/times.h>
10
#include <sys/resource.h>
11
 
12
clock_t
13
times (struct tms *tp)
14
{
15
  struct rusage usage;
16
  union {
17
    struct rusage r;
18
    /* Newlib's rusage has only 2 fields.  We need to make room for
19
       when we call the system's rusage.  This should be enough.  */
20
    int filler[32];
21
  } host_ru;
22
 
23
  getrusage (RUSAGE_SELF, (void *)&host_ru);
24
 
25
  if (tp)
26
    {
27
      tp->tms_utime = host_ru.r.ru_utime.tv_sec * 1000
28
        + host_ru.r.ru_utime.tv_usec;
29
      tp->tms_stime = host_ru.r.ru_stime.tv_sec * 1000
30
        + host_ru.r.ru_stime.tv_usec;
31
      tp->tms_cutime = 0;        /* user time, children */
32
      tp->tms_cstime = 0;        /* system time, children */
33
    }
34
 
35
  return tp->tms_utime;
36
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.