forked from Imagelibrary/rtems
@@ -43,11 +43,9 @@ clock_t _times(
|
|||||||
struct tms *ptms
|
struct tms *ptms
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
uint32_t tick_interval;
|
uint32_t tick_interval;
|
||||||
struct bintime binuptime;
|
sbintime_t uptime;
|
||||||
sbintime_t uptime;
|
sbintime_t cpu_time_used;
|
||||||
struct bintime bin_cpu_time_used;
|
|
||||||
sbintime_t cpu_time_used;
|
|
||||||
|
|
||||||
if ( !ptms )
|
if ( !ptms )
|
||||||
rtems_set_errno_and_return_minus_one( EFAULT );
|
rtems_set_errno_and_return_minus_one( EFAULT );
|
||||||
@@ -57,8 +55,7 @@ clock_t _times(
|
|||||||
|
|
||||||
ptms = memset( ptms, 0, sizeof( *ptms ) );
|
ptms = memset( ptms, 0, sizeof( *ptms ) );
|
||||||
|
|
||||||
_TOD_Get_zero_based_uptime( &binuptime );
|
_TOD_Get_zero_based_uptime( &uptime );
|
||||||
uptime = bttosbt( binuptime );
|
|
||||||
ptms->tms_stime = ((clock_t) uptime) / tick_interval;
|
ptms->tms_stime = ((clock_t) uptime) / tick_interval;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -68,8 +65,7 @@ clock_t _times(
|
|||||||
* of ticks since boot and the number of ticks executed by this
|
* of ticks since boot and the number of ticks executed by this
|
||||||
* this thread.
|
* this thread.
|
||||||
*/
|
*/
|
||||||
_Thread_Get_CPU_time_used( _Thread_Get_executing(), &bin_cpu_time_used );
|
_Thread_Get_CPU_time_used( _Thread_Get_executing(), &cpu_time_used );
|
||||||
cpu_time_used = bttosbt( bin_cpu_time_used );
|
|
||||||
ptms->tms_utime = ((clock_t) cpu_time_used) / tick_interval;
|
ptms->tms_utime = ((clock_t) cpu_time_used) / tick_interval;
|
||||||
|
|
||||||
return ptms->tms_stime;
|
return ptms->tms_stime;
|
||||||
|
|||||||
Reference in New Issue
Block a user