Changeset b0ac06f8 in rtems


Ignore:
Timestamp:
10/26/07 21:30:59 (16 years ago)
Author:
Glenn Humphrey <glenn.humphrey@…>
Branches:
4.10, 4.11, 4.9, 5, master
Children:
43e3429
Parents:
0e87deaa
Message:

2007-10-26 Glenn Humphrey <glenn.humphrey@…>

  • libmisc/cpuuse/cpuusagereport.c, rtems/src/ratemonreportstatistics.c: Cleaned up reports and fixed a bug related the printf format which resulted in lack of leading zeroes and misleading magnitude.
  • score/src/timespecdivide.c: Fixed bugs related to zero divide case.
Location:
cpukit
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    r0e87deaa rb0ac06f8  
     12007-10-26      Glenn Humphrey <glenn.humphrey@OARcorp.com>
     2
     3        * libmisc/cpuuse/cpuusagereport.c, rtems/src/ratemonreportstatistics.c:
     4        Cleaned up reports and fixed a bug related the printf format which
     5        resulted in lack of leading zeroes and misleading magnitude.
     6        * score/src/timespecdivide.c: Fixed bugs related to zero divide case.
     7
    182007-10-26      Joel Sherrill <joel.sherrill@OARcorp.com>
    29
  • cpukit/libmisc/cpuuse/cpuusagereport.c

    r0e87deaa rb0ac06f8  
    8787  #endif
    8888 
     89  (*print)( context, "CPU Usage by thread\n"
    8990  #if defined(RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS)
    90     (*print)( context, "--- CPU Usage times are seconds:microseconds ---\n" );
     91     "   ID        NAME     SECONDS   PERCENT\n"
     92  #else
     93     "   ID        NAME     TICKS   PERCENT\n"
    9194  #endif
    92   (*print)( context, "CPU Usage by thread\n"
    93     #ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
    94           "   ID        NAME     SECONDS  PERCENT\n"
    95     #else
    96           "   ID        NAME     TICKS    PERCENT\n"
    97     #endif
    9895  );
    9996
     
    113110        rtems_object_get_name( the_thread->Object.id, sizeof(name), name );
    114111 
    115         (*print)( context, "0x%08" PRIx32 "   %4s    ", the_thread->Object.id, name );
     112        (*print)( context, "0x%08" PRIx32 "   %4s   ", the_thread->Object.id, name );
    116113
    117114        #ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
     
    135132
    136133          (*print)( context,
    137             "%2" PRId32 ":%06" PRId32 " %3" PRId32 ".%02" PRId32 "\n",
     134            "%3" PRId32 ".%06" PRId32 "  %3" PRId32 ".%03" PRId32 "\n",
    138135            ran.tv_sec, ran.tv_nsec / TOD_NANOSECONDS_PER_MICROSECOND,
    139136            ival, fval
     
    145142          ival /= 100;
    146143          (*print)( context,
    147             "%8" PRId32 "     %3" PRId32 ".%02" PRId32"\n",
     144            "%8" PRId32 "  %3" PRId32 ".%02" PRId32"\n",
    148145            the_thread->ticks_executed,
    149146            ival,
     
    166163      _Watchdog_Ticks_since_boot - CPU_usage_Ticks_at_last_reset
    167164    );
    168     (*print)( context, "Total Units = %" PRId32 "\n\n", total_units );
     165    (*print)( context, "Total Units = %" PRId32 "\n", total_units );
    169166  #endif
    170167}
  • cpukit/rtems/src/ratemonreportstatistics.c

    r0e87deaa rb0ac06f8  
    3030  #define NANOSECONDS_DIVIDER 1000
    3131  #define PERCENT_FMT     "%04" PRId32
    32   #define NANOSECONDS_FMT "%" PRId32
     32  #define NANOSECONDS_FMT "%06" PRId32
    3333#endif
    3434
     
    5656
    5757  (*print)( context, "Period information by period\n" );
     58#if defined(RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS)
     59  (*print)( context, "--- CPU times are in seconds ---\n" );
     60#endif
    5861#if defined(RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS)
    59   (*print)( context, "--- Period times are seconds:microseconds ---\n" );
    60 #endif
    61    
    62 #if defined(RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS)
    63   (*print)( context, "--- CPU Usage times are seconds:microseconds ---\n" );
     62  (*print)( context, "--- Wall times are in seconds ---\n" );
    6463#endif
    6564/*
     
    7271  Uncomment the following if you are tinkering with the formatting.
    7372  Be sure to test the various cases.
    74 */
    7573  (*print)( context,"\
    76741234567890123456789012345678901234567890123456789012345678901234567890123456789\
    7775\n");
    78   (*print)( context, "   ID     OWNER COUNT MISSED     CPU TIME     "
     76*/
     77  (*print)( context, "   ID     OWNER COUNT MISSED     "
     78       #ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
     79          "     "
     80       #endif
     81          "CPU TIME     "
    7982       #ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
    8083          "    "
    8184       #endif
    8285       #ifdef RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS
    83           "   "
     86          "      "
    8487       #endif
    8588          "   WALL TIME\n"
     89  );
     90  (*print)( context, "                               "
     91       #ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
     92          "     "
     93       #endif
     94          "MIN/MAX/AVG    "
     95       #ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
     96          "    "
     97       #endif
     98       #ifdef RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS
     99          "      "
     100       #endif
     101          "  MIN/MAX/AVG\n"
    86102  );
    87103
     
    101117    if ( status != RTEMS_SUCCESSFUL )
    102118      continue;
    103    
    104     if ( the_stats.count == 0 )
    105       continue;
    106119
    107120    name[ 0 ] = '\0';
     
    122135
    123136    /*
     137     *  If the count is zero, don't print statistics
     138     */
     139
     140    if (the_stats.count == 0) {
     141      (*print)( context, "\n" );
     142      continue;
     143    }
     144
     145    /*
    124146     *  print CPU Usage part of statistics
    125147     */
     
    134156      );
    135157      (*print)( context,
    136         "%" PRId32 ":"  NANOSECONDS_FMT "/"        /* min cpu time */
    137         "%" PRId32 ":"  NANOSECONDS_FMT "/"        /* max cpu time */
    138         "%" PRId32 ":"  NANOSECONDS_FMT " ",       /* avg cpu time */
     158        "%" PRId32 "."  NANOSECONDS_FMT "/"        /* min cpu time */
     159        "%" PRId32 "."  NANOSECONDS_FMT "/"        /* max cpu time */
     160        "%" PRId32 "."  NANOSECONDS_FMT " ",       /* avg cpu time */
    139161        the_stats.min_cpu_time.tv_sec,
    140162          the_stats.min_cpu_time.tv_nsec / NANOSECONDS_DIVIDER,
     
    170192      );
    171193      (*print)( context,
    172         "%" PRId32 ":" PERCENT_FMT "/"        /* min wall time */
    173         "%" PRId32 ":" PERCENT_FMT "/"        /* max wall time */
    174         "%" PRId32 ":" PERCENT_FMT "\n",      /* avg wall time */
     194        "%" PRId32 "." NANOSECONDS_FMT "/"        /* min wall time */
     195        "%" PRId32 "." NANOSECONDS_FMT "/"        /* max wall time */
     196        "%" PRId32 "." NANOSECONDS_FMT "\n",      /* avg wall time */
    175197        the_stats.min_wall_time.tv_sec,
    176198          the_stats.min_wall_time.tv_nsec / NANOSECONDS_DIVIDER,
  • cpukit/score/src/timespecdivide.c

    r0e87deaa rb0ac06f8  
    4343  right += rhs->tv_nsec;
    4444
    45   if ( rhs == 0 ) {
     45  if ( right == 0 ) {
    4646    *ival_percentage = 0;
    47     *ival_percentage = 0;
     47    *fval_percentage = 0;
    4848    return;
    4949  }
    5050
    5151  /*
    52    *  Put it back in the timespec result
     52   *  Put it back in the timespec result.
     53   *
     54   *  TODO: Rounding on the last digit of the fval.
    5355   */
    5456
    5557  answer = (left * 100000) / right;
    5658
     59  *ival_percentage = answer / 1000;
    5760  *fval_percentage = answer % 1000;
    58   *ival_percentage = answer / 1000;
    5961}
Note: See TracChangeset for help on using the changeset viewer.