Last change
on this file since 612 was
444,
checked in by satin@…, 6 years ago
|
add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc
|
File size:
1.0 KB
|
Line | |
---|
1 | /* sim-times.c - times support routines for PowerPC. |
---|
2 | * |
---|
3 | * Written by Aldy Hernandez. |
---|
4 | * |
---|
5 | * This file is licensed with the default Red Hat license |
---|
6 | * found in COPYING.NEWLIB. |
---|
7 | * http://sourceware.org/cgi-bin/cvsweb.cgi/src/COPYING.NEWLIB?rev=1.32&content-type=text/x-cvsweb-markup&cvsroot=src |
---|
8 | */ |
---|
9 | |
---|
10 | #include <_ansi.h> |
---|
11 | #include <reent.h> |
---|
12 | #include <sys/time.h> |
---|
13 | #include <sys/times.h> |
---|
14 | #include <sys/resource.h> |
---|
15 | |
---|
16 | clock_t |
---|
17 | times (struct tms *tp) |
---|
18 | { |
---|
19 | struct rusage usage; |
---|
20 | union { |
---|
21 | struct rusage r; |
---|
22 | /* Newlib's rusage has only 2 fields. We need to make room for |
---|
23 | when we call the system's rusage. This should be enough. */ |
---|
24 | int filler[32]; |
---|
25 | } host_ru; |
---|
26 | |
---|
27 | getrusage (RUSAGE_SELF, (void *)&host_ru); |
---|
28 | |
---|
29 | if (tp) |
---|
30 | { |
---|
31 | tp->tms_utime = host_ru.r.ru_utime.tv_sec * 1000 |
---|
32 | + host_ru.r.ru_utime.tv_usec; |
---|
33 | tp->tms_stime = host_ru.r.ru_stime.tv_sec * 1000 |
---|
34 | + host_ru.r.ru_stime.tv_usec; |
---|
35 | tp->tms_cutime = 0; /* user time, children */ |
---|
36 | tp->tms_cstime = 0; /* system time, children */ |
---|
37 | } |
---|
38 | |
---|
39 | return tp->tms_utime; |
---|
40 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.