diff options
author | Gedare Bloom <gedare@rtems.org> | 2015-02-25 14:52:10 -0500 |
---|---|---|
committer | Gedare Bloom <gedare@rtems.org> | 2015-03-04 15:38:52 -0500 |
commit | 76f37656a254fbf43265aca30c8b25f3b4d81571 (patch) | |
tree | ee1ab4a4fb098dfe64bf231252e1669db51454fa /cpukit/libcsupport/src/__times.c | |
parent | score: ISR lock C/C++ compatiblity issue (diff) | |
download | rtems-76f37656a254fbf43265aca30c8b25f3b4d81571.tar.bz2 |
libcsupport: scale times() call to microseconds
Diffstat (limited to 'cpukit/libcsupport/src/__times.c')
-rw-r--r-- | cpukit/libcsupport/src/__times.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/cpukit/libcsupport/src/__times.c b/cpukit/libcsupport/src/__times.c index b92fd6362b..5a1f9eba4d 100644 --- a/cpukit/libcsupport/src/__times.c +++ b/cpukit/libcsupport/src/__times.c @@ -43,7 +43,7 @@ clock_t _times( struct tms *ptms ) { - rtems_interval ticks; + rtems_interval ticks, us_per_tick; Thread_Control *executing; if ( !ptms ) @@ -54,6 +54,7 @@ clock_t _times( */ ticks = rtems_clock_get_ticks_since_boot(); + us_per_tick = rtems_configuration_get_microseconds_per_tick(); /* * RTEMS technically has no notion of system versus user time @@ -90,18 +91,18 @@ clock_t _times( &fractional_ticks ); _Thread_Enable_dispatch(); - ptms->tms_utime = ticks_of_executing / 100; + ptms->tms_utime = ticks_of_executing * us_per_tick; } #else executing = _Thread_Get_executing(); - ptms->tms_utime = executing->cpu_time_used; + ptms->tms_utime = executing->cpu_time_used * us_per_tick; #endif - ptms->tms_stime = ticks; + ptms->tms_stime = ticks * us_per_tick; ptms->tms_cutime = 0; ptms->tms_cstime = 0; - return ticks; -} + return ticks * us_per_tick; +} /** * times() system call wrapper for _times() above. |