forked from Imagelibrary/rtems
2007-10-26 Glenn Humphrey <glenn.humphrey@OARcorp.com>
* 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.
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
2007-10-26 Glenn Humphrey <glenn.humphrey@OARcorp.com>
|
||||
|
||||
* 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.
|
||||
|
||||
2007-10-19 Joel Sherrill <joel.sherrill@OARcorp.com>
|
||||
|
||||
* telnetd/icmds.c: Add header to file.
|
||||
|
||||
@@ -86,15 +86,12 @@ void rtems_cpu_usage_report_with_plugin(
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS)
|
||||
(*print)( context, "--- CPU Usage times are seconds:microseconds ---\n" );
|
||||
#endif
|
||||
(*print)( context, "CPU Usage by thread\n"
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
|
||||
" ID NAME SECONDS PERCENT\n"
|
||||
#else
|
||||
" ID NAME TICKS PERCENT\n"
|
||||
#endif
|
||||
#if defined(RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS)
|
||||
" ID NAME SECONDS PERCENT\n"
|
||||
#else
|
||||
" ID NAME TICKS PERCENT\n"
|
||||
#endif
|
||||
);
|
||||
|
||||
for ( api_index = 1 ;
|
||||
@@ -112,7 +109,7 @@ void rtems_cpu_usage_report_with_plugin(
|
||||
|
||||
rtems_object_get_name( the_thread->Object.id, sizeof(name), name );
|
||||
|
||||
(*print)( context, "0x%08" PRIx32 " %4s ", the_thread->Object.id, name );
|
||||
(*print)( context, "0x%08" PRIx32 " %4s ", the_thread->Object.id, name );
|
||||
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
|
||||
/*
|
||||
@@ -134,7 +131,7 @@ void rtems_cpu_usage_report_with_plugin(
|
||||
*/
|
||||
|
||||
(*print)( context,
|
||||
"%2" PRId32 ":%06" PRId32 " %3" PRId32 ".%02" PRId32 "\n",
|
||||
"%3" PRId32 ".%06" PRId32 " %3" PRId32 ".%03" PRId32 "\n",
|
||||
ran.tv_sec, ran.tv_nsec / TOD_NANOSECONDS_PER_MICROSECOND,
|
||||
ival, fval
|
||||
);
|
||||
@@ -144,7 +141,7 @@ void rtems_cpu_usage_report_with_plugin(
|
||||
fval = ival % 100;
|
||||
ival /= 100;
|
||||
(*print)( context,
|
||||
"%8" PRId32 " %3" PRId32 ".%02" PRId32"\n",
|
||||
"%8" PRId32 " %3" PRId32 ".%02" PRId32"\n",
|
||||
the_thread->ticks_executed,
|
||||
ival,
|
||||
fval
|
||||
@@ -165,7 +162,7 @@ void rtems_cpu_usage_report_with_plugin(
|
||||
"Ticks since last reset = %" PRId32 "\n",
|
||||
_Watchdog_Ticks_since_boot - CPU_usage_Ticks_at_last_reset
|
||||
);
|
||||
(*print)( context, "Total Units = %" PRId32 "\n\n", total_units );
|
||||
(*print)( context, "Total Units = %" PRId32 "\n", total_units );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
/* We print to 1/10's of milliseconds */
|
||||
#define NANOSECONDS_DIVIDER 1000
|
||||
#define PERCENT_FMT "%04" PRId32
|
||||
#define NANOSECONDS_FMT "%" PRId32
|
||||
#define NANOSECONDS_FMT "%06" PRId32
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -55,12 +55,11 @@ void rtems_rate_monotonic_report_statistics_with_plugin(
|
||||
return;
|
||||
|
||||
(*print)( context, "Period information by period\n" );
|
||||
#if defined(RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS)
|
||||
(*print)( context, "--- Period times are seconds:microseconds ---\n" );
|
||||
#endif
|
||||
|
||||
#if defined(RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS)
|
||||
(*print)( context, "--- CPU Usage times are seconds:microseconds ---\n" );
|
||||
(*print)( context, "--- CPU times are in seconds ---\n" );
|
||||
#endif
|
||||
#if defined(RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS)
|
||||
(*print)( context, "--- Wall times are in seconds ---\n" );
|
||||
#endif
|
||||
/*
|
||||
Layout by columns -- in memory of Hollerith :)
|
||||
@@ -71,19 +70,36 @@ ididididid NNNN ccccc mmmmmm X
|
||||
|
||||
Uncomment the following if you are tinkering with the formatting.
|
||||
Be sure to test the various cases.
|
||||
*/
|
||||
(*print)( context,"\
|
||||
1234567890123456789012345678901234567890123456789012345678901234567890123456789\
|
||||
\n");
|
||||
(*print)( context, " ID OWNER COUNT MISSED CPU TIME "
|
||||
*/
|
||||
(*print)( context, " ID OWNER COUNT MISSED "
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
|
||||
" "
|
||||
#endif
|
||||
"CPU TIME "
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
|
||||
" "
|
||||
#endif
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS
|
||||
" "
|
||||
" "
|
||||
#endif
|
||||
" WALL TIME\n"
|
||||
);
|
||||
(*print)( context, " "
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
|
||||
" "
|
||||
#endif
|
||||
"MIN/MAX/AVG "
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
|
||||
" "
|
||||
#endif
|
||||
#ifdef RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS
|
||||
" "
|
||||
#endif
|
||||
" MIN/MAX/AVG\n"
|
||||
);
|
||||
|
||||
/*
|
||||
* Cycle through all possible ids and try to report on each one. If it
|
||||
@@ -100,9 +116,6 @@ ididididid NNNN ccccc mmmmmm X
|
||||
status = rtems_rate_monotonic_get_status( id, &the_status );
|
||||
if ( status != RTEMS_SUCCESSFUL )
|
||||
continue;
|
||||
|
||||
if ( the_stats.count == 0 )
|
||||
continue;
|
||||
|
||||
name[ 0 ] = '\0';
|
||||
|
||||
@@ -120,6 +133,15 @@ ididididid NNNN ccccc mmmmmm X
|
||||
the_stats.count, the_stats.missed_count
|
||||
);
|
||||
|
||||
/*
|
||||
* If the count is zero, don't print statistics
|
||||
*/
|
||||
|
||||
if (the_stats.count == 0) {
|
||||
(*print)( context, "\n" );
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* print CPU Usage part of statistics
|
||||
*/
|
||||
@@ -133,9 +155,9 @@ ididididid NNNN ccccc mmmmmm X
|
||||
&cpu_average
|
||||
);
|
||||
(*print)( context,
|
||||
"%" PRId32 ":" NANOSECONDS_FMT "/" /* min cpu time */
|
||||
"%" PRId32 ":" NANOSECONDS_FMT "/" /* max cpu time */
|
||||
"%" PRId32 ":" NANOSECONDS_FMT " ", /* avg cpu time */
|
||||
"%" PRId32 "." NANOSECONDS_FMT "/" /* min cpu time */
|
||||
"%" PRId32 "." NANOSECONDS_FMT "/" /* max cpu time */
|
||||
"%" PRId32 "." NANOSECONDS_FMT " ", /* avg cpu time */
|
||||
the_stats.min_cpu_time.tv_sec,
|
||||
the_stats.min_cpu_time.tv_nsec / NANOSECONDS_DIVIDER,
|
||||
the_stats.max_cpu_time.tv_sec,
|
||||
@@ -169,9 +191,9 @@ ididididid NNNN ccccc mmmmmm X
|
||||
&wall_average
|
||||
);
|
||||
(*print)( context,
|
||||
"%" PRId32 ":" PERCENT_FMT "/" /* min wall time */
|
||||
"%" PRId32 ":" PERCENT_FMT "/" /* max wall time */
|
||||
"%" PRId32 ":" PERCENT_FMT "\n", /* avg wall time */
|
||||
"%" PRId32 "." NANOSECONDS_FMT "/" /* min wall time */
|
||||
"%" PRId32 "." NANOSECONDS_FMT "/" /* max wall time */
|
||||
"%" PRId32 "." NANOSECONDS_FMT "\n", /* avg wall time */
|
||||
the_stats.min_wall_time.tv_sec,
|
||||
the_stats.min_wall_time.tv_nsec / NANOSECONDS_DIVIDER,
|
||||
the_stats.max_wall_time.tv_sec,
|
||||
|
||||
@@ -42,18 +42,20 @@ void _Timespec_Divide(
|
||||
right = rhs->tv_sec * (uint64_t)TOD_NANOSECONDS_PER_SECOND;
|
||||
right += rhs->tv_nsec;
|
||||
|
||||
if ( rhs == 0 ) {
|
||||
*ival_percentage = 0;
|
||||
if ( right == 0 ) {
|
||||
*ival_percentage = 0;
|
||||
*fval_percentage = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Put it back in the timespec result
|
||||
* Put it back in the timespec result.
|
||||
*
|
||||
* TODO: Rounding on the last digit of the fval.
|
||||
*/
|
||||
|
||||
answer = (left * 100000) / right;
|
||||
|
||||
*fval_percentage = answer % 1000;
|
||||
*ival_percentage = answer / 1000;
|
||||
*fval_percentage = answer % 1000;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user