summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2007-05-15 20:16:16 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2007-05-15 20:16:16 +0000
commite1bce866cf503c34f2914b76c9978bc598096013 (patch)
treed2419a46c38bc4d0eed2eaee219ec946de075596 /cpukit/rtems
parent2007-05-15 Ray Xu <rayx@gmail.com> (diff)
downloadrtems-e1bce866cf503c34f2914b76c9978bc598096013.tar.bz2
2007-05-15 Joel Sherrill <joel.sherrill@oarcorp.com>
* 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.
Diffstat (limited to 'cpukit/rtems')
-rw-r--r--cpukit/rtems/Makefile.am6
-rw-r--r--cpukit/rtems/include/rtems.h23
-rw-r--r--cpukit/rtems/include/rtems/rtems/ratemon.h101
-rw-r--r--cpukit/rtems/inline/rtems/rtems/ratemon.inl2
-rw-r--r--cpukit/rtems/src/ratemoncancel.c5
-rw-r--r--cpukit/rtems/src/ratemoncreate.c7
-rw-r--r--cpukit/rtems/src/ratemondelete.c5
-rw-r--r--cpukit/rtems/src/ratemongetstatistics.c71
-rw-r--r--cpukit/rtems/src/ratemongetstatus.c6
-rw-r--r--cpukit/rtems/src/ratemonident.c5
-rw-r--r--cpukit/rtems/src/ratemonperiod.c77
-rw-r--r--cpukit/rtems/src/ratemonreportstatistics.c90
-rw-r--r--cpukit/rtems/src/ratemonresetall.c56
-rw-r--r--cpukit/rtems/src/ratemonresetstatistics.c66
-rw-r--r--cpukit/rtems/src/ratemontimeout.c5
-rw-r--r--cpukit/rtems/src/rtemsobjectgetname.c34
16 files changed, 525 insertions, 34 deletions
diff --git a/cpukit/rtems/Makefile.am b/cpukit/rtems/Makefile.am
index b4bd102927..13405c03a4 100644
--- a/cpukit/rtems/Makefile.am
+++ b/cpukit/rtems/Makefile.am
@@ -52,7 +52,7 @@ include_rtems_rtems_HEADERS += inline/rtems/rtems/asr.inl \
inline/rtems/rtems/timer.inl
## src
-librtems_a_SOURCES =
+librtems_a_SOURCES = src/rtemsobjectgetname.c
## TASK_C_FILES
librtems_a_SOURCES += src/tasks.c src/taskcreate.c src/taskdelete.c \
@@ -64,7 +64,9 @@ librtems_a_SOURCES += src/tasks.c src/taskcreate.c src/taskdelete.c \
## RATEMON_C_FILES
librtems_a_SOURCES += src/ratemon.c src/ratemoncancel.c src/ratemoncreate.c \
- src/ratemondelete.c src/ratemongetstatus.c src/ratemonident.c \
+ src/ratemondelete.c src/ratemongetstatus.c src/ratemongetstatistics.c \
+ src/ratemonresetstatistics.c src/ratemonresetall.c \
+ src/ratemonreportstatistics.c src/ratemonident.c \
src/ratemonperiod.c src/ratemontimeout.c
## INTR_C_FILES
diff --git a/cpukit/rtems/include/rtems.h b/cpukit/rtems/include/rtems.h
index b4eb12a1c7..c6329fe41b 100644
--- a/cpukit/rtems/include/rtems.h
+++ b/cpukit/rtems/include/rtems.h
@@ -126,7 +126,7 @@ extern "C" {
* object ID.
*
* Input parameters:
- * id - message queue id
+ * id - object id
*
* Output parameters:
* *name - user defined object name
@@ -139,6 +139,27 @@ rtems_status_code rtems_object_id_to_name(
rtems_name *name
);
+/*
+ * rtems_object_get_name
+ *
+ * This directive returns the name associated with the specified
+ * object ID.
+ *
+ * Input parameters:
+ * id - object id
+ *
+ * Output parameters:
+ * *name - user defined object name
+ * name - if successful
+ * NULL - if unsuccessful
+ */
+
+char *rtems_object_get_name(
+ rtems_id id,
+ size_t length,
+ char *name
+);
+
#ifdef __cplusplus
}
#endif
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 <rtems/score/object.h>
#include <rtems/score/thread.h>
#include <rtems/score/watchdog.h>
+#include <rtems/rtems/status.h>
+
+#include <string.h>
/*
* The following enumerated type defines the states in which a
@@ -59,10 +62,26 @@ 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;
@@ -171,6 +191,52 @@ rtems_status_code rtems_rate_monotonic_get_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
*
* DESCRIPTION:
@@ -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 <rtems/rtems/ratemon.inl>
#endif
diff --git a/cpukit/rtems/inline/rtems/rtems/ratemon.inl b/cpukit/rtems/inline/rtems/rtems/ratemon.inl
index 97f177d66e..bae2940617 100644
--- a/cpukit/rtems/inline/rtems/rtems/ratemon.inl
+++ b/cpukit/rtems/inline/rtems/rtems/ratemon.inl
@@ -6,7 +6,7 @@
* This file contains the static inline implementation of the inlined
* routines in the Rate Monotonic Manager.
*
- * COPYRIGHT (c) 1989-1999.
+ * COPYRIGHT (c) 1989-2007.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
diff --git a/cpukit/rtems/src/ratemoncancel.c b/cpukit/rtems/src/ratemoncancel.c
index 254a1f51f9..fff77eb448 100644
--- a/cpukit/rtems/src/ratemoncancel.c
+++ b/cpukit/rtems/src/ratemoncancel.c
@@ -1,8 +1,7 @@
/*
- * Rate Monotonic Manager
+ * Rate Monotonic Manager -- Cancel 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
diff --git a/cpukit/rtems/src/ratemoncreate.c b/cpukit/rtems/src/ratemoncreate.c
index 5585a8ea36..01dffcca58 100644
--- a/cpukit/rtems/src/ratemoncreate.c
+++ b/cpukit/rtems/src/ratemoncreate.c
@@ -1,8 +1,7 @@
/*
- * Rate Monotonic Manager
+ * Rate Monotonic Manager -- Create 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
@@ -68,6 +67,8 @@ rtems_status_code rtems_rate_monotonic_create(
_Watchdog_Initialize( &the_period->Timer, NULL, 0, NULL );
+ _Rate_monotonic_Reset_statistics( the_period );
+
_Objects_Open(
&_Rate_monotonic_Information,
&the_period->Object,
diff --git a/cpukit/rtems/src/ratemondelete.c b/cpukit/rtems/src/ratemondelete.c
index b49311acbb..7eeabb2415 100644
--- a/cpukit/rtems/src/ratemondelete.c
+++ b/cpukit/rtems/src/ratemondelete.c
@@ -1,8 +1,7 @@
/*
- * Rate Monotonic Manager
+ * Rate Monotonic Manager -- Delete 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
diff --git a/cpukit/rtems/src/ratemongetstatistics.c b/cpukit/rtems/src/ratemongetstatistics.c
new file mode 100644
index 0000000000..aae74b0328
--- /dev/null
+++ b/cpukit/rtems/src/ratemongetstatistics.c
@@ -0,0 +1,71 @@
+/*
+ * Rate Monotonic Manager -- Get Statistics
+ *
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/support.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/ratemon.h>
+#include <rtems/score/thread.h>
+
+/*PAGE
+ *
+ * rtems_rate_monotonic_get_statistics
+ *
+ * This directive allows a thread to obtain statistics information on a
+ * period.
+ *
+ * Input parameters:
+ * id - rate monotonic id
+ * statistics - pointer to statistics control block
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ *
+ */
+
+rtems_status_code rtems_rate_monotonic_get_statistics(
+ Objects_Id id,
+ rtems_rate_monotonic_period_statistics *statistics
+)
+{
+ Objects_Locations location;
+ Rate_monotonic_Control *the_period;
+
+ if ( !statistics )
+ return RTEMS_INVALID_ADDRESS;
+
+ the_period = _Rate_monotonic_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_REMOTE: /* should never return this */
+ return RTEMS_INTERNAL_ERROR;
+
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+
+ case OBJECTS_LOCAL:
+
+ *statistics = the_period->Statistics;
+
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
diff --git a/cpukit/rtems/src/ratemongetstatus.c b/cpukit/rtems/src/ratemongetstatus.c
index e6363a7a71..d059e1ae3b 100644
--- a/cpukit/rtems/src/ratemongetstatus.c
+++ b/cpukit/rtems/src/ratemongetstatus.c
@@ -1,8 +1,7 @@
/*
- * Rate Monotonic Manager
+ * Rate Monotonic Manager -- Get Status
*
- *
- * COPYRIGHT (c) 1989-1999.
+ * COPYRIGHT (c) 1989-2007.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -61,6 +60,7 @@ rtems_status_code rtems_rate_monotonic_get_status(
return RTEMS_INVALID_ID;
case OBJECTS_LOCAL:
+ status->owner = ((the_period->owner) ? the_period->owner->Object.id : 0);
status->state = the_period->state;
if ( status->state == RATE_MONOTONIC_INACTIVE ) {
diff --git a/cpukit/rtems/src/ratemonident.c b/cpukit/rtems/src/ratemonident.c
index b81b92042e..bfe7ad4148 100644
--- a/cpukit/rtems/src/ratemonident.c
+++ b/cpukit/rtems/src/ratemonident.c
@@ -1,8 +1,7 @@
/*
- * Rate Monotonic Manager
+ * Rate Monotonic Manager -- Name to Id Lookup
*
- *
- * COPYRIGHT (c) 1989-1999.
+ * COPYRIGHT (c) 1989-2007.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
diff --git a/cpukit/rtems/src/ratemonperiod.c b/cpukit/rtems/src/ratemonperiod.c
index e722c41ca7..83ae0e040d 100644
--- a/cpukit/rtems/src/ratemonperiod.c
+++ b/cpukit/rtems/src/ratemonperiod.c
@@ -1,8 +1,7 @@
/*
- * Rate Monotonic Manager
+ * Rate Monotonic Manager - Period Blocking and Status
*
- *
- * COPYRIGHT (c) 1989-1999.
+ * COPYRIGHT (c) 1989-2007.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -24,6 +23,61 @@
#include <rtems/rtems/ratemon.h>
#include <rtems/score/thread.h>
+void _Rate_monotonic_Update_statistics(
+ Rate_monotonic_Control *the_period
+)
+{
+ uint32_t ticks_since_last_period;
+ uint32_t ticks_executed_since_last_period;
+
+ /*
+ * Assume we are only called in states where it is appropriate
+ * to update the statistics. This should only be RATE_MONOTONIC_ACTIVE
+ * and RATE_MONOTONIC_EXPIRED.
+ */
+
+ /*
+ * Grab basic information
+ */
+
+ ticks_since_last_period =
+ _Watchdog_Ticks_since_boot - the_period->time_at_period;
+
+ ticks_executed_since_last_period = the_period->owner->ticks_executed -
+ the_period->owner_ticks_executed_at_period;
+
+ /*
+ * Now update the statistics
+ */
+
+ the_period->Statistics.count++;
+ if ( the_period->state == RATE_MONOTONIC_EXPIRED )
+ the_period->Statistics.missed_count++;
+ the_period->Statistics.total_cpu_time += ticks_executed_since_last_period;
+ the_period->Statistics.total_wall_time += ticks_since_last_period;
+
+ /*
+ * Update CPU time
+ */
+
+ if ( ticks_executed_since_last_period < the_period->Statistics.min_cpu_time )
+ the_period->Statistics.min_cpu_time = ticks_executed_since_last_period;
+
+ if ( ticks_executed_since_last_period > the_period->Statistics.max_cpu_time )
+ the_period->Statistics.max_cpu_time = ticks_executed_since_last_period;
+
+ /*
+ * Update Wall time
+ */
+
+ if ( ticks_since_last_period < the_period->Statistics.min_wall_time )
+ the_period->Statistics.min_wall_time = ticks_since_last_period;
+
+ if ( ticks_since_last_period > the_period->Statistics.max_wall_time )
+ the_period->Statistics.max_wall_time = ticks_since_last_period;
+}
+
+
/*PAGE
*
* rtems_rate_monotonic_period
@@ -86,7 +140,12 @@ rtems_status_code rtems_rate_monotonic_period(
_ISR_Disable( level );
switch ( the_period->state ) {
case RATE_MONOTONIC_INACTIVE:
+ /*
+ * No need to update statistics -- there are not a period active
+ */
+
_ISR_Enable( level );
+
the_period->state = RATE_MONOTONIC_ACTIVE;
_Watchdog_Initialize(
&the_period->Timer,
@@ -106,6 +165,12 @@ rtems_status_code rtems_rate_monotonic_period(
return RTEMS_SUCCESSFUL;
case RATE_MONOTONIC_ACTIVE:
+
+ /*
+ * Update statistics from the concluding period
+ */
+ _Rate_monotonic_Update_statistics( the_period );
+
/*
* This tells the _Rate_monotonic_Timeout that this task is
* in the process of blocking on the period and that we
@@ -143,7 +208,13 @@ rtems_status_code rtems_rate_monotonic_period(
break;
case RATE_MONOTONIC_EXPIRED:
+ /*
+ * Update statistics from the concluding period
+ */
+ _Rate_monotonic_Update_statistics( the_period );
+
_ISR_Enable( level );
+
the_period->state = RATE_MONOTONIC_ACTIVE;
the_period->owner_ticks_executed_at_period =
_Thread_Executing->ticks_executed;
diff --git a/cpukit/rtems/src/ratemonreportstatistics.c b/cpukit/rtems/src/ratemonreportstatistics.c
new file mode 100644
index 0000000000..352bd1d946
--- /dev/null
+++ b/cpukit/rtems/src/ratemonreportstatistics.c
@@ -0,0 +1,90 @@
+/*
+ * Rate Monotonic Manager -- Report Statistics for All Periods
+ *
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <inttypes.h>
+
+#include <rtems/bspIo.h>
+
+/*
+ * This directive allows a thread to print the statistics information
+ * on ALL period instances which have non-zero counts using printk.
+ *
+ * The implementation of this directive straddles the fence between
+ * inside and outside of RTEMS. It is presented as part of the Manager
+ * but actually uses other services of the Manager.
+ */
+void rtems_rate_montonic_report_statistics( void )
+{
+ rtems_status_code status;
+ rtems_id id;
+ rtems_rate_monotonic_period_statistics the_stats;
+ rtems_rate_monotonic_period_status the_status;
+ char name[5];
+ uint32_t ival_cpu, fval_cpu;
+ uint32_t ival_wall, fval_wall;
+
+ printk(
+ "Period information by period\n"
+ " ID OWNER PERIODS MISSED CPU TIME WALL TIME\n"
+ );
+
+ /*
+ * Cycle through all possible ids and try to report on each one. If it
+ * is a period that is inactive, we just get an error back. No big deal.
+ */
+ for ( id=_Rate_monotonic_Information.minimum_id ;
+ id <= _Rate_monotonic_Information.maximum_id ;
+ id++ ) {
+ status = rtems_rate_monotonic_get_statistics( id, &the_stats );
+ if ( status != RTEMS_SUCCESSFUL )
+ continue;
+
+ /* If the above passed, so should this but check it anyway */
+ status = rtems_rate_monotonic_get_status( id, &the_status );
+ if ( status != RTEMS_SUCCESSFUL )
+ continue;
+
+ if ( the_stats.count == 0 )
+ continue;
+
+ ival_cpu = the_stats.total_cpu_time * 100 / the_stats.count;
+
+ name[ 0 ] = '\0';
+
+ if ( the_status.owner ) {
+ rtems_object_get_name( the_status.owner, sizeof(name), name );
+ }
+
+ fval_cpu = ival_cpu % 100;
+ ival_cpu /= 100;
+ ival_wall = the_stats.total_wall_time * 100 / the_stats.count;
+ fval_wall = ival_wall % 100;
+ ival_wall /= 100;
+ printk(
+ "0x%08" PRIx32 " %4s %6" PRId32 " %3" PRId32 " "
+ "%" PRId32 "/%" PRId32 "/%" PRId32 ".%02" PRId32 " "
+ "%" PRId32 "/%" PRId32 "/%" PRId32 ".%02" PRId32 "\n",
+ id, name,
+ the_stats.count, the_stats.missed_count,
+ the_stats.min_cpu_time, the_stats.max_cpu_time, ival_cpu, fval_cpu,
+ the_stats.min_wall_time, the_stats.max_wall_time, ival_wall, fval_wall
+ );
+ }
+}
diff --git a/cpukit/rtems/src/ratemonresetall.c b/cpukit/rtems/src/ratemonresetall.c
new file mode 100644
index 0000000000..8b91ddd3e5
--- /dev/null
+++ b/cpukit/rtems/src/ratemonresetall.c
@@ -0,0 +1,56 @@
+/*
+ * Rate Monotonic Manager -- Reset Statistics for All Periods
+ *
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/support.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/ratemon.h>
+#include <rtems/score/thread.h>
+
+/*
+ * rtems_rate_montonic_reset_all_statistics
+ */
+void rtems_rate_montonic_reset_all_statistics( void )
+{
+ Objects_Id id;
+ rtems_status_code status;
+
+ /*
+ * Prevent allocation or deallocation of any of the periods while
+ * we are cycling. Also this is an optimization which ensures that
+ * we only disable/enable once. The call to
+ * rtems_rate_monotonic_reset_statistics will be in a nested dispatch
+ * disabled critical section.
+ */
+ _Thread_Disable_dispatch();
+
+ /*
+ * Cycle through all possible ids and try to reset each one. If it
+ * is a period that is inactive, we just get an error back. No big deal.
+ */
+ for ( id=_Rate_monotonic_Information.minimum_id ;
+ id <= _Rate_monotonic_Information.maximum_id ;
+ id++ ) {
+ status = rtems_rate_monotonic_reset_statistics( id );
+ }
+
+ /*
+ * Done so exit thread dispatching disabled critical section.
+ */
+ _Thread_Enable_dispatch();
+}
diff --git a/cpukit/rtems/src/ratemonresetstatistics.c b/cpukit/rtems/src/ratemonresetstatistics.c
new file mode 100644
index 0000000000..6d8f9c5e11
--- /dev/null
+++ b/cpukit/rtems/src/ratemonresetstatistics.c
@@ -0,0 +1,66 @@
+/*
+ * Rate Monotonic Manager -- Reset Statistics
+ *
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/support.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/ratemon.h>
+#include <rtems/score/thread.h>
+
+/*PAGE
+ *
+ * rtems_rate_monotonic_reset_statistics
+ *
+ * This directive allows a thread to reset the statistics information
+ * on a specific period instance.
+ *
+ * Input parameters:
+ * id - rate monotonic id
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ *
+ */
+
+rtems_status_code rtems_rate_monotonic_reset_statistics(
+ Objects_Id id
+)
+{
+ Objects_Locations location;
+ Rate_monotonic_Control *the_period;
+
+ the_period = _Rate_monotonic_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_REMOTE: /* should never return this */
+ return RTEMS_INTERNAL_ERROR;
+
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+
+ case OBJECTS_LOCAL:
+
+ _Rate_monotonic_Reset_statistics( the_period );
+
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
diff --git a/cpukit/rtems/src/ratemontimeout.c b/cpukit/rtems/src/ratemontimeout.c
index deb9a18bc6..3649d574d5 100644
--- a/cpukit/rtems/src/ratemontimeout.c
+++ b/cpukit/rtems/src/ratemontimeout.c
@@ -1,8 +1,7 @@
/*
- * Rate Monotonic Manager
+ * Rate Monotonic Manager -- Period End Timeout Handler
*
- *
- * COPYRIGHT (c) 1989-1999.
+ * COPYRIGHT (c) 1989-2007.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
diff --git a/cpukit/rtems/src/rtemsobjectgetname.c b/cpukit/rtems/src/rtemsobjectgetname.c
new file mode 100644
index 0000000000..2fbf39425d
--- /dev/null
+++ b/cpukit/rtems/src/rtemsobjectgetname.c
@@ -0,0 +1,34 @@
+/*
+ * RTEMS Object Helper -- Obtain Name of Object as String
+ *
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/object.h>
+
+/*
+ * This method objects the name of an object and returns its name
+ * in the form of a C string. It attempts to be careful about
+ * overflowing the user's string and about returning unprintable characters.
+ */
+
+char *rtems_object_get_name(
+ Objects_Id id,
+ size_t length,
+ char *name
+)
+{
+ return _Objects_Get_name_as_string( id, length, name );
+}