Changeset 793dd46 in rtems


Ignore:
Timestamp:
Jul 18, 2007, 9:31:49 PM (13 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
280e1308
Parents:
ead311b
Message:

2007-07-18 Joel Sherrill <joel.sherrill@…>

  • libmisc/Makefile.am, libmisc/cpuuse/cpuusagereport.c, libmisc/cpuuse/cpuusagereset.c: Fix bug where cpu usage calculation was always using uptime not time since last cpu usage reset when using nanoseconds granularity.
  • libmisc/cpuuse/cpuusagedata.c: New file.
Location:
cpukit
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    read311b r793dd46  
     12007-07-18      Joel Sherrill <joel.sherrill@oarcorp.com>
     2
     3        * libmisc/Makefile.am, libmisc/cpuuse/cpuusagereport.c,
     4        libmisc/cpuuse/cpuusagereset.c: Fix bug where cpu usage calculation
     5        was always using uptime not time since last cpu usage reset when
     6        using nanoseconds granularity.
     7        * libmisc/cpuuse/cpuusagedata.c: New file.
     8
    192007-07-13      Joel Sherrill <joel.sherrill@oarcorp.com>
    210
  • cpukit/libmisc/Makefile.am

    read311b r793dd46  
    2121noinst_LIBRARIES += libcpuuse.a
    2222libcpuuse_a_SOURCES = cpuuse/cpuusagereport.c cpuuse/cpuusagereset.c \
    23     cpuuse/cpuuse.h
     23    cpuuse/cpuuse.h cpuuse/cpuusagedata.c
    2424
    2525## devnull
  • cpukit/libmisc/cpuuse/cpuusagereport.c

    read311b r793dd46  
    3636#endif
    3737
    38 #ifndef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
    39   uint32_t   CPU_usage_Ticks_at_last_reset;
     38#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
     39  extern struct timespec    CPU_usage_Uptime_at_last_reset;
     40#else
     41  extern uint32_t           CPU_usage_Ticks_at_last_reset;
    4042#endif
    4143
     
    5456  uint32_t             ival, fval;
    5557  #ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
    56     struct timespec    uptime;
     58    struct timespec    uptime, total;
    5759  #else
    5860    uint32_t           total_units = 0;
     
    6668  #ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
    6769    _TOD_Get_uptime( &uptime );
     70    _Timespec_Subtract( &CPU_usage_Uptime_at_last_reset, &uptime, &total );
    6871  #else
    6972    for ( api_index = 1 ; api_index <= OBJECTS_APIS_LAST ; api_index++ ) {
     
    108111
    109112        #ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
    110           _Timespec_Divide( &the_thread->cpu_time_used, &uptime, &ival, &fval );
     113          _Timespec_Divide( &the_thread->cpu_time_used, &total, &ival, &fval );
    111114
    112115          printk(
     
    136139
    137140  #ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
    138     printk( "Uptime %d.%06d seconds\n\n",
    139        uptime.tv_sec,
    140        uptime.tv_nsec / TOD_NANOSECONDS_PER_MICROSECOND
     141    printk( "Time since last reset %d.%06d seconds\n",
     142       total.tv_sec,
     143       total.tv_nsec / TOD_NANOSECONDS_PER_MICROSECOND
    141144    );
    142145  #else
  • cpukit/libmisc/cpuuse/cpuusagereset.c

    read311b r793dd46  
    4141void rtems_cpu_usage_reset( void )
    4242{
    43   #ifndef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
     43  #ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
     44    extern struct timespec CPU_usage_Uptime_at_last_reset;
     45   
     46    _TOD_Get_uptime( &CPU_usage_Uptime_at_last_reset );
     47  #else
    4448    extern uint32_t   CPU_usage_Ticks_at_last_reset;
    4549
    4650    CPU_usage_Ticks_at_last_reset = _Watchdog_Ticks_since_boot;
     51
    4752  #endif
    4853
Note: See TracChangeset for help on using the changeset viewer.