From 8677cf75e577ce98a3e72087dcbdda0c83a0330c Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 6 Sep 2007 22:09:18 +0000 Subject: 2007-09-06 Joel Sherrill * rtems/src/ratemonperiod.c: Clean up. * rtems/src/ratemonreportstatistics.c: Clarify period statistics output. --- cpukit/ChangeLog | 5 +++++ cpukit/rtems/src/ratemonperiod.c | 12 +++++++----- cpukit/rtems/src/ratemonreportstatistics.c | 26 +++++++++++++++++--------- 3 files changed, 29 insertions(+), 14 deletions(-) (limited to 'cpukit') diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index f33232be6a..6b175832c9 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,8 @@ +2007-09-06 Joel Sherrill + + * rtems/src/ratemonperiod.c: Clean up. + * rtems/src/ratemonreportstatistics.c: Clarify period statistics output. + 2007-09-06 Joel Sherrill * libmisc/monitor/mon-monitor.c: Fix warnings and typo. diff --git a/cpukit/rtems/src/ratemonperiod.c b/cpukit/rtems/src/ratemonperiod.c index 50a0a2d912..8d0dca13d2 100644 --- a/cpukit/rtems/src/ratemonperiod.c +++ b/cpukit/rtems/src/ratemonperiod.c @@ -66,8 +66,8 @@ void _Rate_monotonic_Update_statistics( #ifdef RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS period_start = the_period->time_at_period; - the_period->time_at_period = uptime; _Timespec_Subtract( &period_start, &uptime, &since_last_period ); + the_period->time_at_period = uptime; #else ticks_since_last_period = _Watchdog_Ticks_since_boot - the_period->time_at_period; @@ -122,7 +122,6 @@ void _Rate_monotonic_Update_statistics( if ( _Timespec_Greater_than( &executed, &stats->max_cpu_time ) ) stats->max_cpu_time = executed; - #else stats->total_cpu_time += ticks_executed_since_last_period; @@ -148,10 +147,10 @@ void _Rate_monotonic_Update_statistics( #else _Timespec_Add_to( &stats->total_wall_time, &since_last_period ); - if ( _Timespec_Less_than( &since_last_period, &stats->min_wall_time ) ) + if ( _Timespec_Less_than( &since_last_period, &stats->min_wall_time ) ) stats->min_wall_time = since_last_period; - if ( _Timespec_Greater_than( &since_last_period, &stats->max_wall_time ) ) + if ( _Timespec_Greater_than( &since_last_period, &stats->max_wall_time ) ) stats->max_wall_time = since_last_period; #endif } @@ -260,7 +259,10 @@ rtems_status_code rtems_rate_monotonic_period( &ran ); - /* thread had executed before the last context switch also */ + /* The thread had executed before the last context switch also. + * + * the_period->owner_executed_at_period += ran + */ _Timespec_Add_to( &the_period->owner_executed_at_period, &ran ); } #else diff --git a/cpukit/rtems/src/ratemonreportstatistics.c b/cpukit/rtems/src/ratemonreportstatistics.c index 35f3c6d30b..7e03105e1a 100644 --- a/cpukit/rtems/src/ratemonreportstatistics.c +++ b/cpukit/rtems/src/ratemonreportstatistics.c @@ -27,8 +27,9 @@ #include /* We print to 1/10's of milliseconds */ - #define NANOSECONDS_DIVIDER 100000 - #define PERCENT_FMT "%04" PRId32 + #define NANOSECONDS_DIVIDER 1000 + #define PERCENT_FMT "%04" PRId32 + #define NANOSECONDS_FMT "%" PRId32 #endif /* @@ -48,6 +49,13 @@ void rtems_rate_monotonic_report_statistics( void ) char name[5]; printk( "Period information by period\n" ); +#if defined(RTEMS_ENABLE_NANOSECOND_RATE_MONOTONIC_STATISTICS) + printk( "--- Period times are seconds:microseconds ---\n" ); +#endif + +#if defined(RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS) + printk( "--- CPU Usage times are seconds:microseconds ---\n" ); +#endif /* Layout by columns -- in memory of Hollerith :) @@ -57,10 +65,10 @@ ididididid NNNN ccccc mmmmmm X Uncomment the following if you are tinkering with the formatting. Be sure to test the various cases. +*/ printk("\ 1234567890123456789012345678901234567890123456789012345678901234567890123456789\ \n"); -*/ printk( " ID OWNER COUNT MISSED CPU TIME " #ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS " " @@ -119,9 +127,9 @@ ididididid NNNN ccccc mmmmmm X &cpu_average ); printk( - "%" PRId32 "." PERCENT_FMT "/" /* min cpu time */ - "%" PRId32 "." PERCENT_FMT "/" /* max cpu time */ - "%" PRId32 "." PERCENT_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, @@ -155,9 +163,9 @@ ididididid NNNN ccccc mmmmmm X &wall_average ); printk( - "%" PRId32 "." PERCENT_FMT "/" /* min wall time */ - "%" PRId32 "." PERCENT_FMT "/" /* max wall time */ - "%" PRId32 "." PERCENT_FMT "\n", /* avg wall time */ + "%" PRId32 ":" PERCENT_FMT "/" /* min wall time */ + "%" PRId32 ":" PERCENT_FMT "/" /* max wall time */ + "%" PRId32 ":" PERCENT_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, -- cgit v1.2.3