Changeset db498aba in rtems


Ignore:
Timestamp:
Mar 7, 2011, 2:55:05 PM (9 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
5f6e7415
Parents:
babaede
Message:

2011-03-07 Sebastian Huber <sebastian.huber@…>

  • libmisc/cpuuse/cpuusagereport.c: Fix calculation in case a thread dispatch happends in the meantime. The percent values will not sum up to one hundred percent.
Location:
cpukit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    rbabaede rdb498aba  
    33        * include/rtems/irq-extension.h: Documentation.
    44        * libmisc/monitor/mon-prmisc.c: Fix for multiprocessing configuration.
     5        * libmisc/cpuuse/cpuusagereport.c: Fix calculation in case a thread
     6        dispatch happends in the meantime.  The percent values will not sum up
     7        to one hundred percent.
    58
    692011-03-04      Ralf Corsépius <ralf.corsepius@rtems.org>
  • cpukit/libmisc/cpuuse/cpuusagereport.c

    rbabaede rdb498aba  
    5454  uint32_t             ival, fval;
    5555  #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
    56     Timestamp_Control  uptime, total, ran, last_context_switch;
     56    Timestamp_Control  uptime, total, ran, uptime_at_last_reset;
    5757  #else
    5858    uint32_t           total_units = 0;
     
    6868   */
    6969  #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
    70     last_context_switch = _Thread_Time_of_last_context_switch;
    71     _TOD_Get_uptime( &uptime );
    72     _Timestamp_Subtract( &CPU_usage_Uptime_at_last_reset, &uptime, &total );
     70    uptime_at_last_reset = CPU_usage_Uptime_at_last_reset;
    7371  #else
    7472    for ( api_index = 1 ; api_index <= OBJECTS_APIS_LAST ; api_index++ ) {
     
    134132          if ( _Thread_Executing->Object.id == the_thread->Object.id ) {
    135133            Timestamp_Control used;
    136             _Timestamp_Subtract( &last_context_switch, &uptime, &used );
     134            Timestamp_Control last = _Thread_Time_of_last_context_switch;
     135            _TOD_Get_uptime( &uptime );
     136            _Timestamp_Subtract( &last, &uptime, &used );
    137137            _Timestamp_Add_to( &ran, &used );
    138           };
     138          } else {
     139            _TOD_Get_uptime( &uptime );
     140          }
     141          _Timestamp_Subtract( &uptime_at_last_reset, &uptime, &total );
    139142          _Timestamp_Divide( &ran, &total, &ival, &fval );
    140143
Note: See TracChangeset for help on using the changeset viewer.