Ticket #2182: 0001-libcsupport-scale-times-call-to-microseconds.patch

File 0001-libcsupport-scale-times-call-to-microseconds.patch, 1.5 KB (added by Gedare Bloom, on 02/25/15 at 19:53:06)

Corresponding fix in RTEMS for different proposed fix in newlib.

  • cpukit/libcsupport/src/__times.c

    From 9a8a70db792aeedae2363bca580ded341fa8480e Mon Sep 17 00:00:00 2001
    From: Gedare Bloom <gedare@rtems.org>
    Date: Wed, 25 Feb 2015 14:52:10 -0500
    Subject: [PATCH] libcsupport: scale times() call to microseconds
    
    ---
     cpukit/libcsupport/src/__times.c | 13 +++++++------
     1 file changed, 7 insertions(+), 6 deletions(-)
    
    diff --git a/cpukit/libcsupport/src/__times.c b/cpukit/libcsupport/src/__times.c
    index b92fd63..5a1f9eb 100644
    a b clock_t _times( 
    4343   struct tms  *ptms
    4444)
    4545{
    46   rtems_interval ticks;
     46  rtems_interval ticks, us_per_tick;
    4747  Thread_Control *executing;
    4848
    4949  if ( !ptms )
    clock_t _times( 
    5454   */
    5555
    5656  ticks = rtems_clock_get_ticks_since_boot();
     57  us_per_tick = rtems_configuration_get_microseconds_per_tick();
    5758
    5859  /*
    5960   *  RTEMS technically has no notion of system versus user time
    clock_t _times( 
    9091        &fractional_ticks
    9192      );
    9293      _Thread_Enable_dispatch();
    93       ptms->tms_utime = ticks_of_executing / 100;
     94      ptms->tms_utime = ticks_of_executing * us_per_tick;
    9495    }
    9596  #else
    9697    executing = _Thread_Get_executing();
    97     ptms->tms_utime  = executing->cpu_time_used;
     98    ptms->tms_utime  = executing->cpu_time_used * us_per_tick;
    9899  #endif
    99   ptms->tms_stime  = ticks;
     100  ptms->tms_stime  = ticks * us_per_tick;
    100101  ptms->tms_cutime = 0;
    101102  ptms->tms_cstime = 0;
    102103
    103   return ticks;
    104 } 
     104  return ticks * us_per_tick;
     105}
    105106
    106107/**
    107108 *  times() system call wrapper for _times() above.