summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorGlenn Humphrey <glenn.humphrey@oarcorp.com>2007-10-26 21:31:04 +0000
committerGlenn Humphrey <glenn.humphrey@oarcorp.com>2007-10-26 21:31:04 +0000
commit0f4f543279acc81d3fd3b0023bc5810387db07c0 (patch)
tree766b0eda232f0ceded88530a3245707702da35a6 /cpukit
parent2007-10-19 Joel Sherrill <joel.sherrill@OARcorp.com> (diff)
downloadrtems-0f4f543279acc81d3fd3b0023bc5810387db07c0.tar.bz2
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.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/ChangeLog7
-rw-r--r--cpukit/libmisc/cpuuse/cpuusagereport.c19
-rw-r--r--cpukit/rtems/src/ratemonreportstatistics.c58
-rw-r--r--cpukit/score/src/timespecdivide.c10
4 files changed, 61 insertions, 33 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog
index c12a977db9..b4b12d8271 100644
--- a/cpukit/ChangeLog
+++ b/cpukit/ChangeLog
@@ -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.
diff --git a/cpukit/libmisc/cpuuse/cpuusagereport.c b/cpukit/libmisc/cpuuse/cpuusagereport.c
index 2a4c569e26..3fee85c269 100644
--- a/cpukit/libmisc/cpuuse/cpuusagereport.c
+++ b/cpukit/libmisc/cpuuse/cpuusagereport.c
@@ -86,15 +86,12 @@ void rtems_cpu_usage_report_with_plugin(
}
#endif
+ (*print)( context, "CPU Usage by thread\n"
#if defined(RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS)
- (*print)( context, "--- CPU Usage times are seconds:microseconds ---\n" );
+ " ID NAME SECONDS PERCENT\n"
+ #else
+ " ID NAME TICKS PERCENT\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
);
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
}
diff --git a/cpukit/rtems/src/ratemonreportstatistics.c b/cpukit/rtems/src/ratemonreportstatistics.c
index 039b700034..b26fce55ad 100644
--- a/cpukit/rtems/src/ratemonreportstatistics.c
+++ b/cpukit/rtems/src/ratemonreportstatistics.c
@@ -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';
@@ -121,6 +134,15 @@ ididididid NNNN ccccc mmmmmm X
);
/*
+ * 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,
diff --git a/cpukit/score/src/timespecdivide.c b/cpukit/score/src/timespecdivide.c
index c40d02757f..91e6319848 100644
--- a/cpukit/score/src/timespecdivide.c
+++ b/cpukit/score/src/timespecdivide.c
@@ -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;
}