4.104.114.84.95
Line | |
---|
1 | /* |
---|
2 | * RTEMS _times Implementation |
---|
3 | * |
---|
4 | * |
---|
5 | * COPYRIGHT (c) 1989-1997. |
---|
6 | * On-Line Applications Research Corporation (OAR). |
---|
7 | * Copyright assigned to U.S. Government, 1994. |
---|
8 | * |
---|
9 | * The license and distribution terms for this file may be |
---|
10 | * found in the file LICENSE in this distribution or at |
---|
11 | * http://www.OARcorp.com/rtems/license.html. |
---|
12 | * |
---|
13 | * $Id$ |
---|
14 | */ |
---|
15 | |
---|
16 | #include <rtems.h> |
---|
17 | |
---|
18 | #include <sys/times.h> |
---|
19 | #include <time.h> |
---|
20 | #include <sys/time.h> |
---|
21 | #include <errno.h> |
---|
22 | #include <assert.h> |
---|
23 | |
---|
24 | clock_t _times( |
---|
25 | struct tms *ptms |
---|
26 | ) |
---|
27 | { |
---|
28 | rtems_status_code status; |
---|
29 | rtems_interval ticks_since_boot; |
---|
30 | |
---|
31 | if ( !ptms ) { |
---|
32 | errno = EFAULT; |
---|
33 | return -1; |
---|
34 | } |
---|
35 | |
---|
36 | /* "POSIX" does not seem to allow for not having a TOD */ |
---|
37 | status = rtems_clock_get( |
---|
38 | RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, |
---|
39 | &ticks_since_boot |
---|
40 | ); |
---|
41 | if ( status != RTEMS_SUCCESSFUL ) { |
---|
42 | assert( 0 ); |
---|
43 | return -1; |
---|
44 | } |
---|
45 | |
---|
46 | /* |
---|
47 | * RTEMS has no notion of system versus user time and does |
---|
48 | * not (as of 3.2.0) keep track of CPU usage on a per task basis. |
---|
49 | */ |
---|
50 | |
---|
51 | ptms->tms_utime = ticks_since_boot; |
---|
52 | ptms->tms_stime = 0; |
---|
53 | ptms->tms_cutime = 0; |
---|
54 | ptms->tms_cstime = 0; |
---|
55 | |
---|
56 | return 0; |
---|
57 | } |
---|
58 | |
---|
59 | clock_t times( |
---|
60 | struct tms *ptms |
---|
61 | ) |
---|
62 | { |
---|
63 | return _times( ptms ); |
---|
64 | } |
---|
65 | |
---|
66 | clock_t _times_r( |
---|
67 | struct _reent *ptr, |
---|
68 | struct tms *ptms |
---|
69 | ) |
---|
70 | { |
---|
71 | return _times(ptms); |
---|
72 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.