From e1bce866cf503c34f2914b76c9978bc598096013 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Tue, 15 May 2007 20:16:16 +0000 Subject: 2007-05-15 Joel Sherrill * Makefile.am, preinstall.am, libmisc/Makefile.am, rtems/Makefile.am, rtems/include/rtems.h, rtems/include/rtems/rtems/ratemon.h, rtems/inline/rtems/rtems/ratemon.inl, rtems/src/ratemoncancel.c, rtems/src/ratemoncreate.c, rtems/src/ratemondelete.c, rtems/src/ratemongetstatus.c, rtems/src/ratemonident.c, rtems/src/ratemonperiod.c, rtems/src/ratemontimeout.c, score/Makefile.am, score/include/rtems/score/object.h, score/src/threadhandler.c, wrapup/Makefile.am: Integrate Rate Monotonic Statistics and Period Usage into Rate Monotonic Manager. Added the following directives: rtems_rate_monotonic_get_statistics, rtems_rate_monotonic_reset_statistics, rtems_rate_montonic_reset_all_statistics, rtems_rate_montonic_report_statistics, and rtems_object_get_name. Obsoleted the rtems/rtmonuse.h file as a public interface. * rtems/src/ratemongetstatistics.c, rtems/src/ratemonreportstatistics.c, rtems/src/ratemonresetall.c, rtems/src/ratemonresetstatistics.c, rtems/src/rtemsobjectgetname.c, score/src/objectgetnameasstring.c: New files. * libmisc/rtmonuse/rtmonuse.c, libmisc/rtmonuse/rtmonuse.h: Removed. --- cpukit/rtems/include/rtems/rtems/ratemon.h | 101 ++++++++++++++++++++++++++--- 1 file changed, 92 insertions(+), 9 deletions(-) (limited to 'cpukit/rtems/include/rtems/rtems/ratemon.h') diff --git a/cpukit/rtems/include/rtems/rtems/ratemon.h b/cpukit/rtems/include/rtems/rtems/ratemon.h index 0d9d5aa903..84e3454164 100644 --- a/cpukit/rtems/include/rtems/rtems/ratemon.h +++ b/cpukit/rtems/include/rtems/rtems/ratemon.h @@ -15,7 +15,7 @@ * + conclude current and start the next period * + obtain status information on a period * - * COPYRIGHT (c) 1989-1999. + * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -35,6 +35,9 @@ extern "C" { #include #include #include +#include + +#include /* * The following enumerated type defines the states in which a @@ -58,11 +61,27 @@ typedef enum { #define RTEMS_PERIOD_STATUS WATCHDOG_NO_TIMEOUT +/* + * The following defines the statistics kept on each period instance. + */ + +typedef struct { + uint32_t count; + uint32_t missed_count; + uint32_t min_cpu_time; + uint32_t max_cpu_time; + uint32_t total_cpu_time; + uint32_t min_wall_time; + uint32_t max_wall_time; + uint32_t total_wall_time; +} rtems_rate_monotonic_period_statistics; + /* * The following defines the period status structure. */ typedef struct { + Objects_Id owner; rtems_rate_monotonic_period_states state; uint32_t ticks_since_last_period; uint32_t ticks_executed_since_last_period; @@ -74,13 +93,14 @@ typedef struct { */ typedef struct { - Objects_Control Object; - Watchdog_Control Timer; - rtems_rate_monotonic_period_states state; - uint32_t owner_ticks_executed_at_period; - uint32_t time_at_period; - uint32_t next_length; - Thread_Control *owner; + Objects_Control Object; + Watchdog_Control Timer; + rtems_rate_monotonic_period_states state; + uint32_t owner_ticks_executed_at_period; + uint32_t time_at_period; + uint32_t next_length; + Thread_Control *owner; + rtems_rate_monotonic_period_statistics Statistics; } Rate_monotonic_Control; RTEMS_EXTERN Objects_Information _Rate_monotonic_Information; @@ -170,6 +190,52 @@ rtems_status_code rtems_rate_monotonic_get_status( rtems_rate_monotonic_period_status *status ); +/* + * rtems_rate_monotonic_get_statistics + * + * DESCRIPTION: + * + * This routine implements the rtems_rate_monotonic_get_statistics directive. + * Statistics gathered from the use of this period are returned. + */ + +rtems_status_code rtems_rate_monotonic_get_statistics( + Objects_Id id, + rtems_rate_monotonic_period_statistics *statistics +); + +/* + * rtems_rate_monotonic_reset_statistics + * + * DESCRIPTION: + * + * This directive allows a thread to reset the statistics information + * on a specific period instance. + */ +rtems_status_code rtems_rate_monotonic_reset_statistics( + Objects_Id id +); + +/* + * rtems_rate_montonic_reset_all_statistics + * + * DESCRIPTION: + * + * This directive allows a thread to reset the statistics information + * on ALL period instances. + */ +void rtems_rate_montonic_reset_all_statistics( void ); + +/* + * rtems_rate_montonic_report_statistics + * + * DESCRIPTION: + * + * This directive allows a thread to print the statistics information + * on ALL period instances which have non-zero counts using printk. + */ +void rtems_rate_montonic_report_statistics( void ); + /* * rtems_rate_monotonic_period * @@ -199,11 +265,28 @@ rtems_status_code rtems_rate_monotonic_period( * state and not restarted. */ -void _Rate_monotonic_Timeout ( +void _Rate_monotonic_Timeout( Objects_Id id, void *ignored ); +/* + * _Rate_monotonic_Reset_statistics + * + * DESCRIPTION: + * + * This method resets the statistics information for a period instance. + */ + +#define _Rate_monotonic_Reset_statistics( _the_period ) \ + do { \ + memset( \ + &(_the_period)->Statistics, \ + 0, \ + sizeof( rtems_rate_monotonic_period_statistics ) \ + ); \ + } while (0) + #ifndef __RTEMS_APPLICATION__ #include #endif -- cgit v1.2.3