Ticket #1636: rtems-cvs_v1.diff
File rtems-cvs_v1.diff, 57.5 KB (added by Gedare Bloom, on 08/12/10 at 18:31:59) |
---|
-
cpukit/rtems/Makefile.am
RCS file: /usr1/CVS/rtems/cpukit/rtems/Makefile.am,v retrieving revision 1.52 diff -u -p -r1.52 Makefile.am
include_rtems_rtems_HEADERS = include/rt 25 25 include/rtems/rtems/intr.h include/rtems/rtems/message.h \ 26 26 include/rtems/rtems/modes.h include/rtems/rtems/object.h \ 27 27 include/rtems/rtems/options.h include/rtems/rtems/part.h \ 28 include/rtems/rtems/periodic.h \ 28 29 include/rtems/rtems/ratemon.h include/rtems/rtems/region.h \ 29 30 include/rtems/rtems/rtemsapi.h include/rtems/rtems/sem.h \ 30 31 include/rtems/rtems/signal.h include/rtems/rtems/status.h \ … … librtems_a_SOURCES += src/tasks.c src/ta 71 72 src/taskvariableadd.c src/taskvariabledelete.c src/taskvariableget.c \ 72 73 src/taskvariable_invoke_dtor.c src/taskdata.c 73 74 75 ## PERIODIC_C_FILES 76 librtems_a_SOURCES += src/periodiccancel.c src/periodicident.c \ 77 src/periodiccreate.c src/periodicperiod.c src/periodicdelete.c \ 78 src/periodicreportstatistics.c src/periodicgetstatistics.c \ 79 src/periodicresetall.c src/periodicgetstatus.c \ 80 src/periodicresetstatistics.c 81 74 82 ## RATEMON_C_FILES 75 83 librtems_a_SOURCES += src/ratemon.c src/ratemoncancel.c src/ratemoncreate.c \ 76 84 src/ratemondelete.c src/ratemongetstatus.c src/ratemongetstatistics.c \ 77 85 src/ratemonresetstatistics.c src/ratemonresetall.c \ 78 86 src/ratemonreportstatistics.c src/ratemonident.c \ 79 src/ratemonperiod.c src/ratemon timeout.c src/ratemondata.c87 src/ratemonperiod.c src/ratemondata.c 80 88 81 89 ## INTR_C_FILES 82 90 librtems_a_SOURCES += src/intrbody.c src/intrcatch.c -
cpukit/rtems/preinstall.am
RCS file: /usr1/CVS/rtems/cpukit/rtems/preinstall.am,v retrieving revision 1.14 diff -u -p -r1.14 preinstall.am
$(PROJECT_INCLUDE)/rtems/rtems/part.h: i 87 87 $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/rtems/part.h 88 88 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/rtems/part.h 89 89 90 $(PROJECT_INCLUDE)/rtems/rtems/periodic.h: include/rtems/rtems/periodic.h $(PROJECT_INCLUDE)/rtems/rtems/$(dirstamp) 91 $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/rtems/periodic.h 92 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/rtems/periodic.h 93 90 94 $(PROJECT_INCLUDE)/rtems/rtems/ratemon.h: include/rtems/rtems/ratemon.h $(PROJECT_INCLUDE)/rtems/rtems/$(dirstamp) 91 95 $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/rtems/ratemon.h 92 96 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/rtems/ratemon.h -
cpukit/rtems/include/rtems/rtems/ratemon.h
RCS file: /usr1/CVS/rtems/cpukit/rtems/include/rtems/rtems/ratemon.h,v retrieving revision 1.42 diff -u -p -r1.42 ratemon.h
28 28 #ifndef _RTEMS_RTEMS_RATEMON_H 29 29 #define _RTEMS_RTEMS_RATEMON_H 30 30 31 /**32 * This constant is defined to extern most of the time when using33 * this header file. However by defining it to nothing, the data34 * declared in this header file can be instantiated. This is done35 * in a single per manager file.36 */37 #ifndef RTEMS_RATEMON_EXTERN38 #define RTEMS_RATEMON_EXTERN extern39 #endif40 41 31 #include <rtems/bspIo.h> 42 32 43 33 /** … … 59 49 extern "C" { 60 50 #endif 61 51 62 /** 63 * This is the public type used for the rate monotonic timing 64 * statistics. 65 */ 66 #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ 67 #include <rtems/score/timespec.h> 68 69 typedef struct timespec rtems_rate_monotonic_period_time_t; 70 #else 71 typedef uint32_t rtems_rate_monotonic_period_time_t; 72 #endif 73 74 /** 75 * This is the internal type used for the rate monotonic timing 76 * statistics. 77 */ 78 #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ 79 #include <rtems/score/timestamp.h> 80 81 typedef Timestamp_Control Rate_monotonic_Period_time_t; 82 #else 83 typedef uint32_t Rate_monotonic_Period_time_t; 84 #endif 85 86 #include <rtems/score/object.h> 87 #include <rtems/score/thread.h> 88 #include <rtems/score/watchdog.h> 52 #include <rtems/rtems/periodic.h> 89 53 #include <rtems/rtems/status.h> 90 54 #include <rtems/rtems/support.h> 91 55 56 #include <rtems/score/periodic.h> 57 92 58 #include <string.h> 93 59 60 typedef rtems_periodic_period_states rtems_rate_monotonic_period_states; 94 61 95 /** 96 * The following enumerated type defines the states in which a 97 * period may be. 98 */ 99 typedef enum { 100 /** 101 * This value indicates the period is off the watchdog chain, 102 * and has never been initialized. 103 */ 104 RATE_MONOTONIC_INACTIVE, 105 106 /** 107 * This value indicates the period is on the watchdog chain, and 108 * the owner is blocked waiting on it. 109 */ 110 RATE_MONOTONIC_OWNER_IS_BLOCKING, 111 112 /** 113 * This value indicates the period is on the watchdog chain, and 114 * running. The owner should be executed or blocked waiting on 115 * another object. 116 */ 117 RATE_MONOTONIC_ACTIVE, 118 119 /** 120 * This value indicates the period is on the watchdog chain, and 121 * has expired. The owner should be blocked waiting for the next period. 122 */ 123 RATE_MONOTONIC_EXPIRED_WHILE_BLOCKING, 124 125 /** 126 * This value indicates the period is off the watchdog chain, and 127 * has expired. The owner is still executing and has taken too much 128 * all time to complete this iteration of the period. 129 */ 130 RATE_MONOTONIC_EXPIRED 131 } rtems_rate_monotonic_period_states; 132 133 /** 134 * The following constant is the interval passed to the rate_monontonic_period 135 * directive to obtain status information. 136 */ 137 #define RTEMS_PERIOD_STATUS WATCHDOG_NO_TIMEOUT 138 139 /** 140 * The following defines the PUBLIC data structure that has the 141 * statistics kept on each period instance. 142 * 143 * @note The public structure uses struct timespec while the 144 * internal one uses Timestamp_Control. 145 */ 146 typedef struct { 147 /** This field contains the number of periods executed. */ 148 uint32_t count; 149 /** This field contains the number of periods missed. */ 150 uint32_t missed_count; 151 152 /** This field contains the least amount of CPU time used in a period. */ 153 rtems_thread_cpu_usage_t min_cpu_time; 154 /** This field contains the highest amount of CPU time used in a period. */ 155 rtems_thread_cpu_usage_t max_cpu_time; 156 /** This field contains the total amount of wall time used in a period. */ 157 rtems_thread_cpu_usage_t total_cpu_time; 158 159 /** This field contains the least amount of wall time used in a period. */ 160 rtems_rate_monotonic_period_time_t min_wall_time; 161 /** This field contains the highest amount of wall time used in a period. */ 162 rtems_rate_monotonic_period_time_t max_wall_time; 163 /** This field contains the total amount of CPU time used in a period. */ 164 rtems_rate_monotonic_period_time_t total_wall_time; 165 } rtems_rate_monotonic_period_statistics; 166 167 /** 168 * The following defines the INTERNAL data structure that has the 169 * statistics kept on each period instance. 170 */ 171 typedef struct { 172 /** This field contains the number of periods executed. */ 173 uint32_t count; 174 /** This field contains the number of periods missed. */ 175 uint32_t missed_count; 176 177 /** This field contains the least amount of CPU time used in a period. */ 178 Thread_CPU_usage_t min_cpu_time; 179 /** This field contains the highest amount of CPU time used in a period. */ 180 Thread_CPU_usage_t max_cpu_time; 181 /** This field contains the total amount of wall time used in a period. */ 182 Thread_CPU_usage_t total_cpu_time; 183 184 /** This field contains the least amount of wall time used in a period. */ 185 Rate_monotonic_Period_time_t min_wall_time; 186 /** This field contains the highest amount of wall time used in a period. */ 187 Rate_monotonic_Period_time_t max_wall_time; 188 /** This field contains the total amount of CPU time used in a period. */ 189 Rate_monotonic_Period_time_t total_wall_time; 190 } Rate_monotonic_Statistics; 191 192 /** 193 * The following defines the period status structure. 194 */ 195 typedef struct { 196 /** This is the Id of the thread using this period. */ 197 rtems_id owner; 198 199 /** This is the current state of this period. */ 200 rtems_rate_monotonic_period_states state; 201 202 /** 203 * This is the length of wall time that has passed since this period 204 * was last initiated. If the period is expired or has not been initiated, 205 * then this field has no meaning. 206 */ 207 rtems_rate_monotonic_period_time_t since_last_period; 208 209 /** 210 * This is the amount of CPU time that has been used since this period 211 * was last initiated. If the period is expired or has not been initiated, 212 * then this field has no meaning. 213 */ 214 rtems_thread_cpu_usage_t executed_since_last_period; 215 } rtems_rate_monotonic_period_status; 216 217 /** 218 * The following structure defines the control block used to manage 219 * each period. 220 */ 221 typedef struct { 222 /** This field is the object management portion of a Period instance. */ 223 Objects_Control Object; 224 225 /** This is the timer used to provide the unblocking mechanism. */ 226 Watchdog_Control Timer; 227 228 /** This field indicates the current state of the period. */ 229 rtems_rate_monotonic_period_states state; 230 231 /** 232 * This field contains the length of the next period to be 233 * executed. 234 */ 235 uint32_t next_length; 236 237 /** 238 * This field contains a pointer to the TCB for the thread 239 * which owns and uses this period instance. 240 */ 241 Thread_Control *owner; 242 243 /** 244 * This field contains the cpu usage value of the owning thread when 245 * the period was initiated. It is used to compute the period's 246 * statistics. 247 */ 248 Thread_CPU_usage_t cpu_usage_period_initiated; 249 250 /** 251 * This field contains the wall time value when the period 252 * was initiated. It is used to compute the period's statistics. 253 */ 254 Rate_monotonic_Period_time_t time_period_initiated; 255 256 /** 257 * This field contains the statistics maintained for the period. 258 */ 259 Rate_monotonic_Statistics Statistics; 260 } Rate_monotonic_Control; 62 typedef rtems_periodic_period_statistics rtems_rate_monotonic_period_statistics; 261 63 262 /** 263 * @brief Rate Monotonic Period Class Management Structure 264 * 265 * This instance of Objects_Information is used to manage the 266 * set of rate monotonic period instances. 267 */ 268 RTEMS_RATEMON_EXTERN Objects_Information _Rate_monotonic_Information; 64 typedef rtems_periodic_period_status rtems_rate_monotonic_period_status; 269 65 270 /** 271 * @brief Rate Monotonic Manager Initialization 272 * 273 * This routine performs the initialization necessary for this manager. 274 */ 275 void _Rate_monotonic_Manager_initialization(void); 66 typedef Periodic_Control Rate_monotonic_Control; 276 67 277 68 /** 278 69 * @brief rtems_rate_monotonic_create … … rtems_status_code rtems_rate_monotonic_p 393 184 ); 394 185 395 186 /** 396 * @brief _Rate_monotonic_Timeout 397 * 398 * This routine is invoked when the period represented 399 * by ID expires. If the thread which owns this period is blocked 400 * waiting for the period to expire, then it is readied and the 401 * period is restarted. If the owning thread is not waiting for the 402 * period to expire, then the period is placed in the EXPIRED 403 * state and not restarted. 404 */ 405 void _Rate_monotonic_Timeout( 406 rtems_id id, 407 void *ignored 408 ); 409 410 /** 411 * @brief _Rate_monotonic_Get_status( 412 * 413 * This routine is invoked to compute the elapsed wall time and cpu 414 * time for a period. 415 * 416 * @param[in] the_period points to the period being operated upon. 417 * @param[out] wall_since_last_period is set to the wall time elapsed 418 * since the period was initiated. 419 * @param[out] cpu_since_last_period is set to the cpu time used by the 420 * owning thread since the period was initiated. 421 * 422 * @return This routine returns true if the status can be determined 423 * and false otherwise. 424 */ 425 bool _Rate_monotonic_Get_status( 426 Rate_monotonic_Control *the_period, 427 Rate_monotonic_Period_time_t *wall_since_last_period, 428 Thread_CPU_usage_t *cpu_since_last_period 429 ); 430 431 /** 432 * @brief _Rate_monotonic_Initiate_statistics( 433 * 434 * This routine is invoked when a period is initiated via an explicit 435 * call to rtems_rate_monotonic_period for the period's first iteration 436 * or from _Rate_monotonic_Timeout for period iterations 2-n. 437 * 438 * @param[in] the_period points to the period being operated upon. 439 */ 440 void _Rate_monotonic_Initiate_statistics( 441 Rate_monotonic_Control *the_period 442 ); 443 444 /** 445 * @brief _Rate_monotonic_Reset_wall_time_statistics 446 * 447 * This method resets the statistics information for a period instance. 448 */ 449 #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ 450 #define _Rate_monotonic_Reset_wall_time_statistics( _the_period ) \ 451 do { \ 452 /* set the minimums to a large value */ \ 453 _Timestamp_Set( \ 454 &(_the_period)->Statistics.min_wall_time, \ 455 0x7fffffff, \ 456 0x7fffffff \ 457 ); \ 458 } while (0) 459 #else 460 #define _Rate_monotonic_Reset_wall_time_statistics( _the_period ) \ 461 do { \ 462 /* set the minimum to a large value */ \ 463 (_the_period)->Statistics.min_wall_time = 0xffffffff; \ 464 } while (0) 465 #endif 466 467 /** 468 * @brief Rate_monotonic_Reset_cpu_use_statistics 187 * @brief Rate Monotonic Manager Initialization 469 188 * 470 * This helper method resets the period CPU usage statistics structure.189 * This routine performs the initialization necessary for this manager. 471 190 */ 472 #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ 473 #define _Rate_monotonic_Reset_cpu_use_statistics( _the_period ) \ 474 do { \ 475 /* set the minimums to a large value */ \ 476 _Timestamp_Set( \ 477 &(_the_period)->Statistics.min_cpu_time, \ 478 0x7fffffff, \ 479 0x7fffffff \ 480 ); \ 481 } while (0) 482 #else 483 #define _Rate_monotonic_Reset_cpu_use_statistics( _the_period ) \ 484 do { \ 485 /* set the minimum to a large value */ \ 486 (_the_period)->Statistics.min_cpu_time = 0xffffffff; \ 487 } while (0) 488 #endif 191 void _Rate_monotonic_Manager_initialization(void); 489 192 490 /**491 * @brief Rate_monotonic_Reset_statistics492 *493 * This helper method resets the period wall time statistics structure.494 */495 #define _Rate_monotonic_Reset_statistics( _the_period ) \496 do { \497 memset( \498 &(_the_period)->Statistics, \499 0, \500 sizeof( rtems_rate_monotonic_period_statistics ) \501 ); \502 _Rate_monotonic_Reset_cpu_use_statistics( _the_period ); \503 _Rate_monotonic_Reset_wall_time_statistics( _the_period ); \504 } while (0)505 193 506 194 #ifndef __RTEMS_APPLICATION__ 507 195 #include <rtems/rtems/ratemon.inl> -
cpukit/rtems/inline/rtems/rtems/ratemon.inl
RCS file: /usr1/CVS/rtems/cpukit/rtems/inline/rtems/rtems/ratemon.inl,v retrieving revision 1.16 diff -u -p -r1.16 ratemon.inl
27 27 * @{ 28 28 */ 29 29 30 /**31 * @brief Rate_monotonic_Allocate32 *33 * This function allocates a period control block from34 * the inactive chain of free period control blocks.35 */36 RTEMS_INLINE_ROUTINE Rate_monotonic_Control *_Rate_monotonic_Allocate( void )37 {38 return (Rate_monotonic_Control *)39 _Objects_Allocate( &_Rate_monotonic_Information );40 }41 30 42 /**43 * @brief Rate_monotonic_Free44 *45 * This routine allocates a period control block from46 * the inactive chain of free period control blocks.47 */48 RTEMS_INLINE_ROUTINE void _Rate_monotonic_Free (49 Rate_monotonic_Control *the_period50 )51 {52 _Objects_Free( &_Rate_monotonic_Information, &the_period->Object );53 }54 55 /**56 * @brief Rate_monotonic_Get57 *58 * This function maps period IDs to period control blocks.59 * If ID corresponds to a local period, then it returns60 * the_period control pointer which maps to ID and location61 * is set to OBJECTS_LOCAL. Otherwise, location is set62 * to OBJECTS_ERROR and the_period is undefined.63 */64 RTEMS_INLINE_ROUTINE Rate_monotonic_Control *_Rate_monotonic_Get (65 Objects_Id id,66 Objects_Locations *location67 )68 {69 return (Rate_monotonic_Control *)70 _Objects_Get( &_Rate_monotonic_Information, id, location );71 }72 73 /**74 * @brief Rate_monotonic_Is_active75 *76 * This function returns TRUE if the_period is in the ACTIVE state,77 * and FALSE otherwise.78 */79 RTEMS_INLINE_ROUTINE bool _Rate_monotonic_Is_active (80 Rate_monotonic_Control *the_period81 )82 {83 return (the_period->state == RATE_MONOTONIC_ACTIVE);84 }85 86 /**87 * @brief Rate_monotonic_Is_inactive88 *89 * This function returns TRUE if the_period is in the ACTIVE state,90 * and FALSE otherwise.91 */92 RTEMS_INLINE_ROUTINE bool _Rate_monotonic_Is_inactive (93 Rate_monotonic_Control *the_period94 )95 {96 return (the_period->state == RATE_MONOTONIC_INACTIVE);97 }98 99 /**100 * @brief Rate_monotonic_Is_expired101 *102 * This function returns TRUE if the_period is in the EXPIRED state,103 * and FALSE otherwise.104 */105 RTEMS_INLINE_ROUTINE bool _Rate_monotonic_Is_expired (106 Rate_monotonic_Control *the_period107 )108 {109 return (the_period->state == RATE_MONOTONIC_EXPIRED);110 }111 112 /**113 * @brief Rate_monotonic_Is_null114 *115 * This function returns TRUE if the_period is NULL and FALSE otherwise.116 */117 RTEMS_INLINE_ROUTINE bool _Rate_monotonic_Is_null (118 Rate_monotonic_Control *the_period119 )120 {121 return (the_period == NULL);122 }123 31 124 32 /**@}*/ 125 33 -
cpukit/rtems/src/ratemon.c
RCS file: /usr1/CVS/rtems/cpukit/rtems/src/ratemon.c,v retrieving revision 1.24 diff -u -p -r1.24 ratemon.c
22 22 #include <rtems/rtems/support.h> 23 23 #include <rtems/score/isr.h> 24 24 #include <rtems/score/object.h> 25 #include <rtems/rtems/periodic.h> 25 26 #include <rtems/rtems/ratemon.h> 26 27 #include <rtems/score/thread.h> 27 28 … … 42 43 43 44 void _Rate_monotonic_Manager_initialization(void) 44 45 { 45 _Objects_Initialize_information( 46 &_Rate_monotonic_Information, /* object information table */ 47 OBJECTS_CLASSIC_API, /* object API */ 48 OBJECTS_RTEMS_PERIODS, /* object class */ 49 Configuration_RTEMS_API.maximum_periods, 50 /* maximum objects of this class */ 51 sizeof( Rate_monotonic_Control ),/* size of this object's control block */ 52 false, /* true if the name is a string */ 53 RTEMS_MAXIMUM_NAME_LENGTH /* maximum length of an object name */ 54 #if defined(RTEMS_MULTIPROCESSING) 55 , 56 false, /* true if this is a global object class */ 57 NULL /* Proxy extraction support callout */ 58 #endif 59 ); 46 _Periodic_Manager_initialization(); 60 47 } -
cpukit/rtems/src/ratemoncancel.c
RCS file: /usr1/CVS/rtems/cpukit/rtems/src/ratemoncancel.c,v retrieving revision 1.10 diff -u -p -r1.10 ratemoncancel.c
20 20 #include <rtems/rtems/support.h> 21 21 #include <rtems/score/isr.h> 22 22 #include <rtems/score/object.h> 23 #include <rtems/rtems/periodic.h> 23 24 #include <rtems/rtems/ratemon.h> 24 25 #include <rtems/score/thread.h> 25 26 … … rtems_status_code rtems_rate_monotonic_c 41 42 rtems_id id 42 43 ) 43 44 { 44 Rate_monotonic_Control *the_period; 45 Objects_Locations location; 46 47 the_period = _Rate_monotonic_Get( id, &location ); 48 switch ( location ) { 49 50 case OBJECTS_LOCAL: 51 if ( !_Thread_Is_executing( the_period->owner ) ) { 52 _Thread_Enable_dispatch(); 53 return RTEMS_NOT_OWNER_OF_RESOURCE; 54 } 55 (void) _Watchdog_Remove( &the_period->Timer ); 56 the_period->state = RATE_MONOTONIC_INACTIVE; 57 _Thread_Enable_dispatch(); 58 return RTEMS_SUCCESSFUL; 59 60 #if defined(RTEMS_MULTIPROCESSING) 61 case OBJECTS_REMOTE: 62 #endif 63 case OBJECTS_ERROR: 64 break; 65 } 66 67 return RTEMS_INVALID_ID; 45 return rtems_periodic_cancel(id); 68 46 } -
cpukit/rtems/src/ratemoncreate.c
RCS file: /usr1/CVS/rtems/cpukit/rtems/src/ratemoncreate.c,v retrieving revision 1.10 diff -u -p -r1.10 ratemoncreate.c
20 20 #include <rtems/rtems/support.h> 21 21 #include <rtems/score/isr.h> 22 22 #include <rtems/score/object.h> 23 #include <rtems/rtems/periodic.h> 23 24 #include <rtems/rtems/ratemon.h> 24 25 #include <rtems/score/thread.h> 25 26 … … rtems_status_code rtems_rate_monotonic_c 45 46 rtems_id *id 46 47 ) 47 48 { 48 Rate_monotonic_Control *the_period; 49 50 if ( !rtems_is_name_valid( name ) ) 51 return RTEMS_INVALID_NAME; 52 53 if ( !id ) 54 return RTEMS_INVALID_ADDRESS; 55 56 _Thread_Disable_dispatch(); /* to prevent deletion */ 57 58 the_period = _Rate_monotonic_Allocate(); 59 60 if ( !the_period ) { 61 _Thread_Enable_dispatch(); 62 return RTEMS_TOO_MANY; 63 } 64 65 the_period->owner = _Thread_Executing; 66 the_period->state = RATE_MONOTONIC_INACTIVE; 67 68 _Watchdog_Initialize( &the_period->Timer, NULL, 0, NULL ); 69 70 _Rate_monotonic_Reset_statistics( the_period ); 71 72 _Objects_Open( 73 &_Rate_monotonic_Information, 74 &the_period->Object, 75 (Objects_Name) name 76 ); 77 78 *id = the_period->Object.id; 79 _Thread_Enable_dispatch(); 80 return RTEMS_SUCCESSFUL; 49 return rtems_periodic_create( name, id ); 81 50 } -
cpukit/rtems/src/ratemondata.c
RCS file: /usr1/CVS/rtems/cpukit/rtems/src/ratemondata.c,v retrieving revision 1.1 diff -u -p -r1.1 ratemondata.c
9 9 * http://www.rtems.com/license/LICENSE. 10 10 * 11 11 * $Id: ratemondata.c,v 1.1 2007/05/21 23:19:20 joel Exp $ 12 * 13 * Note: this file is deprecated. 12 14 */ 13 15 14 16 #if HAVE_CONFIG_H -
cpukit/rtems/src/ratemondelete.c
RCS file: /usr1/CVS/rtems/cpukit/rtems/src/ratemondelete.c,v retrieving revision 1.9 diff -u -p -r1.9 ratemondelete.c
20 20 #include <rtems/rtems/support.h> 21 21 #include <rtems/score/isr.h> 22 22 #include <rtems/score/object.h> 23 #include <rtems/rtems/periodic.h> 23 24 #include <rtems/rtems/ratemon.h> 24 25 #include <rtems/score/thread.h> 25 26 … … rtems_status_code rtems_rate_monotonic_d 41 42 rtems_id id 42 43 ) 43 44 { 44 Rate_monotonic_Control *the_period; 45 Objects_Locations location; 46 47 the_period = _Rate_monotonic_Get( id, &location ); 48 switch ( location ) { 49 50 case OBJECTS_LOCAL: 51 _Objects_Close( &_Rate_monotonic_Information, &the_period->Object ); 52 (void) _Watchdog_Remove( &the_period->Timer ); 53 the_period->state = RATE_MONOTONIC_INACTIVE; 54 _Rate_monotonic_Free( the_period ); 55 _Thread_Enable_dispatch(); 56 return RTEMS_SUCCESSFUL; 57 58 #if defined(RTEMS_MULTIPROCESSING) 59 case OBJECTS_REMOTE: /* should never return this */ 60 #endif 61 case OBJECTS_ERROR: 62 break; 63 } 64 65 return RTEMS_INVALID_ID; 45 return rtems_periodic_delete(id); 66 46 } -
cpukit/rtems/src/ratemongetstatistics.c
RCS file: /usr1/CVS/rtems/cpukit/rtems/src/ratemongetstatistics.c,v retrieving revision 1.7 diff -u -p -r1.7 ratemongetstatistics.c
20 20 #include <rtems/rtems/support.h> 21 21 #include <rtems/score/isr.h> 22 22 #include <rtems/score/object.h> 23 #include <rtems/rtems/periodic.h> 23 24 #include <rtems/rtems/ratemon.h> 24 25 #include <rtems/score/thread.h> 25 26 … … rtems_status_code rtems_rate_monotonic_g 45 46 rtems_rate_monotonic_period_statistics *statistics 46 47 ) 47 48 { 48 Objects_Locations location; 49 Rate_monotonic_Control *the_period; 50 rtems_rate_monotonic_period_statistics *dst; 51 Rate_monotonic_Statistics *src; 52 53 if ( !statistics ) 54 return RTEMS_INVALID_ADDRESS; 55 56 the_period = _Rate_monotonic_Get( id, &location ); 57 switch ( location ) { 58 59 case OBJECTS_LOCAL: 60 dst = statistics; 61 src = &the_period->Statistics; 62 dst->count = src->count; 63 dst->missed_count = src->missed_count; 64 #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ 65 _Timestamp_To_timespec( &src->min_cpu_time, &dst->min_cpu_time ); 66 _Timestamp_To_timespec( &src->max_cpu_time, &dst->max_cpu_time ); 67 _Timestamp_To_timespec( &src->total_cpu_time, &dst->total_cpu_time ); 68 _Timestamp_To_timespec( &src->min_wall_time, &dst->min_wall_time ); 69 _Timestamp_To_timespec( &src->max_wall_time, &dst->max_wall_time ); 70 _Timestamp_To_timespec( &src->total_wall_time, &dst->total_wall_time ); 71 #else 72 dst->min_cpu_time = src->min_cpu_time; 73 dst->max_cpu_time = src->max_cpu_time; 74 dst->total_cpu_time = src->total_cpu_time; 75 dst->min_wall_time = src->min_wall_time; 76 dst->max_wall_time = src->max_wall_time; 77 dst->total_wall_time = src->total_wall_time; 78 #endif 79 80 _Thread_Enable_dispatch(); 81 return RTEMS_SUCCESSFUL; 82 83 #if defined(RTEMS_MULTIPROCESSING) 84 case OBJECTS_REMOTE: /* should never return this */ 85 #endif 86 case OBJECTS_ERROR: 87 break; 88 } 89 90 return RTEMS_INVALID_ID; 49 return rtems_periodic_get_statistics( id, statistics ); 91 50 } -
cpukit/rtems/src/ratemongetstatus.c
RCS file: /usr1/CVS/rtems/cpukit/rtems/src/ratemongetstatus.c,v retrieving revision 1.18 diff -u -p -r1.18 ratemongetstatus.c
20 20 #include <rtems/rtems/support.h> 21 21 #include <rtems/score/isr.h> 22 22 #include <rtems/score/object.h> 23 #include <rtems/rtems/periodic.h> 23 24 #include <rtems/rtems/ratemon.h> 24 25 #include <rtems/score/thread.h> 25 26 … … rtems_status_code rtems_rate_monotonic_g 49 50 rtems_rate_monotonic_period_status *status 50 51 ) 51 52 { 52 Thread_CPU_usage_t executed; 53 Objects_Locations location; 54 Rate_monotonic_Period_time_t since_last_period; 55 Rate_monotonic_Control *the_period; 56 bool valid_status; 57 58 if ( !status ) 59 return RTEMS_INVALID_ADDRESS; 60 61 the_period = _Rate_monotonic_Get( id, &location ); 62 switch ( location ) { 63 64 case OBJECTS_LOCAL: 65 status->owner = the_period->owner->Object.id; 66 status->state = the_period->state; 67 68 /* 69 * If the period is inactive, there is no information. 70 */ 71 if ( status->state == RATE_MONOTONIC_INACTIVE ) { 72 #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ 73 _Timespec_Set_to_zero( &status->since_last_period ); 74 _Timespec_Set_to_zero( &status->executed_since_last_period ); 75 #else 76 status->since_last_period = 0; 77 status->executed_since_last_period = 0; 78 #endif 79 80 } else { 81 82 /* 83 * Grab the current status. 84 */ 85 valid_status = 86 _Rate_monotonic_Get_status( 87 the_period, &since_last_period, &executed 88 ); 89 if (!valid_status) { 90 _Thread_Enable_dispatch(); 91 return RTEMS_NOT_DEFINED; 92 } 93 94 #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ 95 _Timestamp_To_timespec( 96 &since_last_period, &status->since_last_period 97 ); 98 _Timestamp_To_timespec( 99 &executed, &status->executed_since_last_period 100 ); 101 #else 102 status->since_last_period = since_last_period; 103 status->executed_since_last_period = executed; 104 #endif 105 } 106 107 _Thread_Enable_dispatch(); 108 return RTEMS_SUCCESSFUL; 109 110 #if defined(RTEMS_MULTIPROCESSING) 111 case OBJECTS_REMOTE: /* should never return this */ 112 #endif 113 case OBJECTS_ERROR: 114 break; 115 } 116 117 return RTEMS_INVALID_ID; 53 return rtems_periodic_get_status( id, status ); 118 54 } -
cpukit/rtems/src/ratemonident.c
RCS file: /usr1/CVS/rtems/cpukit/rtems/src/ratemonident.c,v retrieving revision 1.11 diff -u -p -r1.11 ratemonident.c
20 20 #include <rtems/rtems/support.h> 21 21 #include <rtems/score/isr.h> 22 22 #include <rtems/score/object.h> 23 #include <rtems/rtems/periodic.h> 23 24 #include <rtems/rtems/ratemon.h> 24 25 #include <rtems/score/thread.h> 25 26 … … rtems_status_code rtems_rate_monotonic_i 45 46 rtems_id *id 46 47 ) 47 48 { 48 Objects_Name_or_id_lookup_errors status; 49 50 status = _Objects_Name_to_id_u32( 51 &_Rate_monotonic_Information, 52 name, 53 OBJECTS_SEARCH_LOCAL_NODE, 54 id 55 ); 56 57 return _Status_Object_name_errors_to_status[ status ]; 49 return rtems_periodic_ident( name, id ); 58 50 } -
cpukit/rtems/src/ratemonperiod.c
RCS file: /usr1/CVS/rtems/cpukit/rtems/src/ratemonperiod.c,v retrieving revision 1.29 diff -u -p -r1.29 ratemonperiod.c
1 1 /* 2 * Rate Monotonic Manager - Period Blocking and Status2 * Rate Monotonic Manager - Period Blocking 3 3 * 4 4 * COPYRIGHT (c) 1989-2010. 5 5 * On-Line Applications Research Corporation (OAR). … … 20 20 #include <rtems/rtems/support.h> 21 21 #include <rtems/score/isr.h> 22 22 #include <rtems/score/object.h> 23 #include <rtems/rtems/periodic.h> 23 24 #include <rtems/rtems/ratemon.h> 24 25 #include <rtems/score/thread.h> 25 26 26 bool _Rate_monotonic_Get_status(27 Rate_monotonic_Control *the_period,28 Rate_monotonic_Period_time_t *wall_since_last_period,29 Thread_CPU_usage_t *cpu_since_last_period30 )31 {32 #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__33 Timestamp_Control uptime;34 #endif35 Thread_Control *owning_thread = the_period->owner;36 Thread_CPU_usage_t used;37 38 /*39 * Determine elapsed wall time since period initiated.40 */41 #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__42 _TOD_Get_uptime( &uptime );43 _Timestamp_Subtract(44 &the_period->time_period_initiated, &uptime, wall_since_last_period45 );46 #else47 *wall_since_last_period =48 _Watchdog_Ticks_since_boot - the_period->time_period_initiated;49 #endif50 51 /*52 * Determine cpu usage since period initiated.53 */54 used = owning_thread->cpu_time_used;55 56 #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__57 if (owning_thread == _Thread_Executing) {58 59 Thread_CPU_usage_t ran;60 61 /* How much time time since last context switch */62 _Timestamp_Subtract(63 &_Thread_Time_of_last_context_switch, &uptime, &ran64 );65 66 /* cpu usage += ran */67 _Timestamp_Add_to( &used, &ran );68 69 /*70 * The cpu usage info was reset while executing. Can't71 * determine a status.72 */73 if (_Timestamp_Less_than(&used, &the_period->cpu_usage_period_initiated))74 return false;75 76 /* used = current cpu usage - cpu usage at start of period */77 _Timestamp_Subtract(78 &the_period->cpu_usage_period_initiated,79 &used,80 cpu_since_last_period81 );82 }83 #else84 /*85 * The cpu usage info was reset while executing. Can't86 * determine a status.87 */88 if (used < the_period->cpu_usage_period_initiated)89 return false;90 91 *cpu_since_last_period = used - the_period->cpu_usage_period_initiated;92 #endif93 return true;94 }95 96 void _Rate_monotonic_Initiate_statistics(97 Rate_monotonic_Control *the_period98 )99 {100 Thread_Control *owning_thread = the_period->owner;101 102 /*103 * If using nanosecond statistics, we need to obtain the uptime.104 */105 #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__106 Timestamp_Control uptime;107 108 _TOD_Get_uptime( &uptime );109 #endif110 111 /*112 * Set the starting point and the CPU time used for the statistics.113 */114 #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__115 the_period->time_period_initiated = uptime;116 #else117 the_period->time_period_initiated = _Watchdog_Ticks_since_boot;118 #endif119 120 the_period->cpu_usage_period_initiated = owning_thread->cpu_time_used;121 122 /*123 * If using nanosecond statistics and the period's thread is currently124 * executing, then we need to take into account how much time the125 * executing thread has run since the last context switch. When this126 * routine is invoked from rtems_rate_monotonic_period, the owner will127 * be the executing thread. When this routine is invoked from128 * _Rate_monotonic_Timeout, it will not.129 */130 #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__131 if (owning_thread == _Thread_Executing) {132 133 rtems_thread_cpu_usage_t ran;134 135 /*136 * Adjust the CPU time used to account for the time since last137 * context switch.138 */139 _Timespec_Subtract(140 &_Thread_Time_of_last_context_switch, &uptime, &ran141 );142 143 _Timespec_Add_to( &the_period->cpu_usage_period_initiated, &ran );144 }145 #endif146 }147 148 void _Rate_monotonic_Update_statistics(149 Rate_monotonic_Control *the_period150 )151 {152 Thread_CPU_usage_t executed;153 Rate_monotonic_Period_time_t since_last_period;154 Rate_monotonic_Statistics *stats;155 bool valid_status;156 157 /*158 * Assume we are only called in states where it is appropriate159 * to update the statistics. This should only be RATE_MONOTONIC_ACTIVE160 * and RATE_MONOTONIC_EXPIRED.161 */162 163 /*164 * Update the counts.165 */166 stats = &the_period->Statistics;167 stats->count++;168 169 if ( the_period->state == RATE_MONOTONIC_EXPIRED )170 stats->missed_count++;171 172 /*173 * Grab status for time statistics.174 */175 valid_status =176 _Rate_monotonic_Get_status( the_period, &since_last_period, &executed );177 if (!valid_status)178 return;179 180 /*181 * Update CPU time182 */183 #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__184 _Timestamp_Add_to( &stats->total_cpu_time, &executed );185 186 if ( _Timestamp_Less_than( &executed, &stats->min_cpu_time ) )187 stats->min_cpu_time = executed;188 189 if ( _Timestamp_Greater_than( &executed, &stats->max_cpu_time ) )190 stats->max_cpu_time = executed;191 #else192 stats->total_cpu_time += executed;193 194 if ( executed < stats->min_cpu_time )195 stats->min_cpu_time = executed;196 197 if ( executed > stats->max_cpu_time )198 stats->max_cpu_time = executed;199 #endif200 201 /*202 * Update Wall time203 */204 #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__205 _Timestamp_Add_to( &stats->total_wall_time, &since_last_period );206 207 if ( _Timestamp_Less_than( &since_last_period, &stats->min_wall_time ) )208 stats->min_wall_time = since_last_period;209 210 if ( _Timestamp_Greater_than( &since_last_period, &stats->max_wall_time ) )211 stats->max_wall_time = since_last_period;212 #else213 214 /* Sanity check wall time */215 if ( since_last_period < executed )216 since_last_period = executed;217 218 stats->total_wall_time += since_last_period;219 220 if ( since_last_period < stats->min_wall_time )221 stats->min_wall_time = since_last_period;222 223 if ( since_last_period > stats->max_wall_time )224 stats->max_wall_time = since_last_period;225 #endif226 }227 228 229 27 /*PAGE 230 28 * 231 29 * rtems_rate_monotonic_period … … rtems_status_code rtems_rate_monotonic_p 246 44 rtems_interval length 247 45 ) 248 46 { 249 Rate_monotonic_Control *the_period; 250 Objects_Locations location; 251 rtems_status_code return_value; 252 rtems_rate_monotonic_period_states local_state; 253 ISR_Level level; 254 255 the_period = _Rate_monotonic_Get( id, &location ); 256 257 switch ( location ) { 258 case OBJECTS_LOCAL: 259 if ( !_Thread_Is_executing( the_period->owner ) ) { 260 _Thread_Enable_dispatch(); 261 return RTEMS_NOT_OWNER_OF_RESOURCE; 262 } 263 264 if ( length == RTEMS_PERIOD_STATUS ) { 265 switch ( the_period->state ) { 266 case RATE_MONOTONIC_INACTIVE: 267 return_value = RTEMS_NOT_DEFINED; 268 break; 269 case RATE_MONOTONIC_EXPIRED: 270 case RATE_MONOTONIC_EXPIRED_WHILE_BLOCKING: 271 return_value = RTEMS_TIMEOUT; 272 break; 273 case RATE_MONOTONIC_ACTIVE: 274 default: /* unreached -- only to remove warnings */ 275 return_value = RTEMS_SUCCESSFUL; 276 break; 277 } 278 _Thread_Enable_dispatch(); 279 return( return_value ); 280 } 281 282 _ISR_Disable( level ); 283 if ( the_period->state == RATE_MONOTONIC_INACTIVE ) { 284 _ISR_Enable( level ); 285 286 /* 287 * Baseline statistics information for the beginning of a period. 288 */ 289 _Rate_monotonic_Initiate_statistics( the_period ); 290 291 the_period->state = RATE_MONOTONIC_ACTIVE; 292 _Watchdog_Initialize( 293 &the_period->Timer, 294 _Rate_monotonic_Timeout, 295 id, 296 NULL 297 ); 298 299 the_period->next_length = length; 300 301 _Watchdog_Insert_ticks( &the_period->Timer, length ); 302 _Thread_Enable_dispatch(); 303 return RTEMS_SUCCESSFUL; 304 } 305 306 if ( the_period->state == RATE_MONOTONIC_ACTIVE ) { 307 /* 308 * Update statistics from the concluding period. 309 */ 310 _Rate_monotonic_Update_statistics( the_period ); 311 312 /* 313 * This tells the _Rate_monotonic_Timeout that this task is 314 * in the process of blocking on the period and that we 315 * may be changing the length of the next period. 316 */ 317 the_period->state = RATE_MONOTONIC_OWNER_IS_BLOCKING; 318 the_period->next_length = length; 319 320 _ISR_Enable( level ); 321 322 _Thread_Executing->Wait.id = the_period->Object.id; 323 _Thread_Set_state( _Thread_Executing, STATES_WAITING_FOR_PERIOD ); 324 325 /* 326 * Did the watchdog timer expire while we were actually blocking 327 * on it? 328 */ 329 _ISR_Disable( level ); 330 local_state = the_period->state; 331 the_period->state = RATE_MONOTONIC_ACTIVE; 332 _ISR_Enable( level ); 333 334 /* 335 * If it did, then we want to unblock ourself and continue as 336 * if nothing happen. The period was reset in the timeout routine. 337 */ 338 if ( local_state == RATE_MONOTONIC_EXPIRED_WHILE_BLOCKING ) 339 _Thread_Clear_state( _Thread_Executing, STATES_WAITING_FOR_PERIOD ); 340 341 _Thread_Enable_dispatch(); 342 return RTEMS_SUCCESSFUL; 343 } 344 345 if ( the_period->state == RATE_MONOTONIC_EXPIRED ) { 346 /* 347 * Update statistics from the concluding period 348 */ 349 _Rate_monotonic_Update_statistics( the_period ); 350 351 _ISR_Enable( level ); 352 353 the_period->state = RATE_MONOTONIC_ACTIVE; 354 the_period->next_length = length; 355 356 _Watchdog_Insert_ticks( &the_period->Timer, length ); 357 _Thread_Enable_dispatch(); 358 return RTEMS_TIMEOUT; 359 } 360 361 /* 362 * These should never happen so just return invalid Id. 363 * - RATE_MONOTONIC_OWNER_IS_BLOCKING: 364 * - RATE_MONOTONIC_EXPIRED_WHILE_BLOCKING: 365 */ 366 #if defined(RTEMS_MULTIPROCESSING) 367 case OBJECTS_REMOTE: /* should never return this */ 368 #endif 369 case OBJECTS_ERROR: 370 break; 371 } 372 373 return RTEMS_INVALID_ID; 47 return rtems_periodic_period( id, length ); 374 48 } -
cpukit/rtems/src/ratemonreportstatistics.c
RCS file: /usr1/CVS/rtems/cpukit/rtems/src/ratemonreportstatistics.c,v retrieving revision 1.12 diff -u -p -r1.12 ratemonreportstatistics.c
20 20 #include <ctype.h> 21 21 #include <inttypes.h> 22 22 23 #include <rtems/rtems/periodic.h> 24 23 25 #include <rtems/bspIo.h> 24 26 #include <rtems/score/timespec.h> 25 27 26 #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__27 /* We print to 1/10's of milliseconds */28 #define NANOSECONDS_DIVIDER 100029 #define PERCENT_FMT "%04" PRId3230 #define NANOSECONDS_FMT "%06" PRId3231 #endif32 33 28 /* 34 29 * This directive allows a thread to print the statistics information 35 30 * on ALL period instances which have non-zero counts using printk. … … void rtems_rate_monotonic_report_statist 43 38 rtems_printk_plugin_t print 44 39 ) 45 40 { 46 rtems_status_code status; 47 rtems_id id; 48 rtems_rate_monotonic_period_statistics the_stats; 49 rtems_rate_monotonic_period_status the_status; 50 char name[5]; 51 52 if ( !print ) 53 return; 54 55 (*print)( context, "Period information by period\n" ); 56 #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ 57 (*print)( context, "--- CPU times are in seconds ---\n" ); 58 (*print)( context, "--- Wall times are in seconds ---\n" ); 59 #endif 60 /* 61 Layout by columns -- in memory of Hollerith :) 62 63 1234567890123456789012345678901234567890123456789012345678901234567890123456789\ 64 ID OWNER COUNT MISSED X 65 ididididid NNNN ccccc mmmmmm X 66 67 Uncomment the following if you are tinkering with the formatting. 68 Be sure to test the various cases. 69 (*print)( context,"\ 70 1234567890123456789012345678901234567890123456789012345678901234567890123456789\ 71 \n"); 72 */ 73 (*print)( context, " ID OWNER COUNT MISSED " 74 #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ 75 " " 76 #endif 77 "CPU TIME " 78 #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ 79 " " 80 #endif 81 " WALL TIME\n" 82 ); 83 (*print)( context, " " 84 #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ 85 " " 86 #endif 87 "MIN/MAX/AVG " 88 #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ 89 " " 90 #endif 91 " MIN/MAX/AVG\n" 92 ); 93 94 /* 95 * Cycle through all possible ids and try to report on each one. If it 96 * is a period that is inactive, we just get an error back. No big deal. 97 */ 98 for ( id=_Rate_monotonic_Information.minimum_id ; 99 id <= _Rate_monotonic_Information.maximum_id ; 100 id++ ) { 101 status = rtems_rate_monotonic_get_statistics( id, &the_stats ); 102 if ( status != RTEMS_SUCCESSFUL ) 103 continue; 104 105 /* If the above passed, so should this but check it anyway */ 106 status = rtems_rate_monotonic_get_status( id, &the_status ); 107 #if defined(RTEMS_DEBUG) 108 if ( status != RTEMS_SUCCESSFUL ) 109 continue; 110 #endif 111 112 rtems_object_get_name( the_status.owner, sizeof(name), name ); 113 114 /* 115 * Print part of report line that is not dependent on granularity 116 */ 117 (*print)( context, 118 "0x%08" PRIx32 " %4s %5" PRId32 " %6" PRId32 " ", 119 id, name, 120 the_stats.count, the_stats.missed_count 121 ); 122 123 /* 124 * If the count is zero, don't print statistics 125 */ 126 if (the_stats.count == 0) { 127 (*print)( context, "\n" ); 128 continue; 129 } 130 131 /* 132 * print CPU Usage part of statistics 133 */ 134 { 135 #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ 136 struct timespec cpu_average; 137 struct timespec *min_cpu = &the_stats.min_cpu_time; 138 struct timespec *max_cpu = &the_stats.max_cpu_time; 139 struct timespec *total_cpu = &the_stats.total_cpu_time; 140 141 _Timespec_Divide_by_integer( total_cpu, the_stats.count, &cpu_average ); 142 (*print)( context, 143 "%" PRId32 "." NANOSECONDS_FMT "/" /* min cpu time */ 144 "%" PRId32 "." NANOSECONDS_FMT "/" /* max cpu time */ 145 "%" PRId32 "." NANOSECONDS_FMT " ", /* avg cpu time */ 146 _Timespec_Get_seconds( min_cpu ), 147 _Timespec_Get_nanoseconds( min_cpu ) / NANOSECONDS_DIVIDER, 148 _Timespec_Get_seconds( max_cpu ), 149 _Timespec_Get_nanoseconds( max_cpu ) / NANOSECONDS_DIVIDER, 150 _Timespec_Get_seconds( &cpu_average ), 151 _Timespec_Get_nanoseconds( &cpu_average ) / NANOSECONDS_DIVIDER 152 ); 153 #else 154 uint32_t ival_cpu, fval_cpu; 155 156 ival_cpu = the_stats.total_cpu_time * 100 / the_stats.count; 157 fval_cpu = ival_cpu % 100; 158 ival_cpu /= 100; 159 160 (*print)( context, 161 "%3" PRId32 "/%4" PRId32 "/%3" PRId32 ".%02" PRId32 " ", 162 the_stats.min_cpu_time, the_stats.max_cpu_time, ival_cpu, fval_cpu 163 ); 164 #endif 165 } 166 167 /* 168 * print wall time part of statistics 169 */ 170 { 171 #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ 172 struct timespec wall_average; 173 struct timespec *min_wall = &the_stats.min_wall_time; 174 struct timespec *max_wall = &the_stats.max_wall_time; 175 struct timespec *total_wall = &the_stats.total_wall_time; 176 177 _Timespec_Divide_by_integer(total_wall, the_stats.count, &wall_average); 178 (*print)( context, 179 "%" PRId32 "." NANOSECONDS_FMT "/" /* min wall time */ 180 "%" PRId32 "." NANOSECONDS_FMT "/" /* max wall time */ 181 "%" PRId32 "." NANOSECONDS_FMT "\n", /* avg wall time */ 182 _Timespec_Get_seconds( min_wall ), 183 _Timespec_Get_nanoseconds( min_wall ) / NANOSECONDS_DIVIDER, 184 _Timespec_Get_seconds( max_wall ), 185 _Timespec_Get_nanoseconds( max_wall ) / NANOSECONDS_DIVIDER, 186 _Timespec_Get_seconds( &wall_average ), 187 _Timespec_Get_nanoseconds( &wall_average ) / NANOSECONDS_DIVIDER 188 ); 189 #else 190 uint32_t ival_wall, fval_wall; 191 192 ival_wall = the_stats.total_wall_time * 100 / the_stats.count; 193 fval_wall = ival_wall % 100; 194 ival_wall /= 100; 195 (*print)( context, 196 "%3" PRId32 "/%4" PRId32 "/%3" PRId32 ".%02" PRId32 "\n", 197 the_stats.min_wall_time, the_stats.max_wall_time, ival_wall, fval_wall 198 ); 199 #endif 200 } 201 } 41 rtems_periodic_report_statistics_with_plugin( context, print ); 202 42 } 203 43 204 44 void rtems_rate_monotonic_report_statistics( void ) 205 45 { 206 rtems_ rate_monotonic_report_statistics_with_plugin( NULL, printk_plugin );46 rtems_periodic_report_statistics_with_plugin( NULL, printk_plugin ); 207 47 } -
cpukit/rtems/src/ratemonresetall.c
RCS file: /usr1/CVS/rtems/cpukit/rtems/src/ratemonresetall.c,v retrieving revision 1.2 diff -u -p -r1.2 ratemonresetall.c
19 19 #include <rtems/rtems/status.h> 20 20 #include <rtems/rtems/support.h> 21 21 #include <rtems/score/object.h> 22 #include <rtems/rtems/periodic.h> 22 23 #include <rtems/rtems/ratemon.h> 23 24 #include <rtems/score/thread.h> 24 25 … … 27 28 */ 28 29 void rtems_rate_monotonic_reset_all_statistics( void ) 29 30 { 30 Objects_Id id; 31 rtems_status_code status; 32 33 /* 34 * Prevent allocation or deallocation of any of the periods while 35 * we are cycling. Also this is an optimization which ensures that 36 * we only disable/enable once. The call to 37 * rtems_rate_monotonic_reset_statistics will be in a nested dispatch 38 * disabled critical section. 39 */ 40 _Thread_Disable_dispatch(); 41 42 /* 43 * Cycle through all possible ids and try to reset each one. If it 44 * is a period that is inactive, we just get an error back. No big deal. 45 */ 46 for ( id=_Rate_monotonic_Information.minimum_id ; 47 id <= _Rate_monotonic_Information.maximum_id ; 48 id++ ) { 49 status = rtems_rate_monotonic_reset_statistics( id ); 50 } 51 52 /* 53 * Done so exit thread dispatching disabled critical section. 54 */ 55 _Thread_Enable_dispatch(); 31 rtems_periodic_reset_all_statistics(); 56 32 } -
cpukit/rtems/src/ratemonresetstatistics.c
RCS file: /usr1/CVS/rtems/cpukit/rtems/src/ratemonresetstatistics.c,v retrieving revision 1.4 diff -u -p -r1.4 ratemonresetstatistics.c
20 20 #include <rtems/rtems/support.h> 21 21 #include <rtems/score/isr.h> 22 22 #include <rtems/score/object.h> 23 #include <rtems/rtems/periodic.h> 23 24 #include <rtems/rtems/ratemon.h> 24 25 #include <rtems/score/thread.h> 25 26 … … rtems_status_code rtems_rate_monotonic_r 43 44 rtems_id id 44 45 ) 45 46 { 46 Objects_Locations location; 47 Rate_monotonic_Control *the_period; 48 49 the_period = _Rate_monotonic_Get( id, &location ); 50 switch ( location ) { 51 52 case OBJECTS_LOCAL: 53 _Rate_monotonic_Reset_statistics( the_period ); 54 _Thread_Enable_dispatch(); 55 return RTEMS_SUCCESSFUL; 56 57 #if defined(RTEMS_MULTIPROCESSING) 58 case OBJECTS_REMOTE: /* should never return this */ 59 #endif 60 case OBJECTS_ERROR: 61 break; 62 } 63 64 return RTEMS_INVALID_ID; 47 return rtems_periodic_reset_statistics( id ); 65 48 } -
cpukit/score/Makefile.am
RCS file: /usr1/CVS/rtems/cpukit/score/Makefile.am,v retrieving revision 1.87 diff -u -p -r1.87 Makefile.am
include_rtems_score_HEADERS = include/rt 25 25 include/rtems/score/heap.h include/rtems/score/protectedheap.h \ 26 26 include/rtems/score/interr.h include/rtems/score/isr.h \ 27 27 include/rtems/score/object.h include/rtems/score/percpu.h \ 28 include/rtems/score/periodic.h \ 28 29 include/rtems/score/priority.h include/rtems/score/prioritybitmap.h \ 29 30 include/rtems/score/stack.h include/rtems/score/states.h \ 30 31 include/rtems/score/sysstate.h include/rtems/score/thread.h \ … … include_rtems_score_HEADERS += inline/rt 53 54 inline/rtems/score/coremsg.inl inline/rtems/score/coremutex.inl \ 54 55 inline/rtems/score/coresem.inl inline/rtems/score/heap.inl \ 55 56 inline/rtems/score/isr.inl inline/rtems/score/object.inl \ 57 inline/rtems/score/periodic.inl \ 56 58 inline/rtems/score/priority.inl inline/rtems/score/prioritybitmap.inl \ 57 59 inline/rtems/score/stack.inl inline/rtems/score/states.inl \ 58 60 inline/rtems/score/sysstate.inl inline/rtems/score/thread.inl \ … … libscore_a_SOURCES += src/objectallocate 137 139 src/objectgetinfo.c src/objectgetinfoid.c src/objectapimaximumclass.c \ 138 140 src/objectnamespaceremove.c 139 141 142 ## PERIODIC_C_FILES 143 libscore_a_SOURCES += src/periodic.c \ 144 src/periodicgetstatus.c src/periodicstatistics.c src/periodictimeout.c 145 140 146 ## PROTECTED_HEAP_C_FILES 141 147 libscore_a_SOURCES += src/pheapallocate.c \ 142 148 src/pheapextend.c src/pheapfree.c src/pheapgetsize.c \ -
cpukit/score/preinstall.am
RCS file: /usr1/CVS/rtems/cpukit/score/preinstall.am,v retrieving revision 1.24 diff -u -p -r1.24 preinstall.am
$(PROJECT_INCLUDE)/rtems/score/percpu.h: 103 103 $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/percpu.h 104 104 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/percpu.h 105 105 106 $(PROJECT_INCLUDE)/rtems/score/periodic.h: include/rtems/score/periodic.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp) 107 $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/periodic.h 108 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/periodic.h 109 106 110 $(PROJECT_INCLUDE)/rtems/score/priority.h: include/rtems/score/priority.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp) 107 111 $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/priority.h 108 112 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/priority.h … … $(PROJECT_INCLUDE)/rtems/score/object.in 237 241 $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/object.inl 238 242 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/object.inl 239 243 244 $(PROJECT_INCLUDE)/rtems/score/periodic.inl: inline/rtems/score/periodic.inl $(PROJECT_INCLUDE)/rtems/score/$(dirstamp) 245 $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/periodic.inl 246 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/periodic.inl 247 240 248 $(PROJECT_INCLUDE)/rtems/score/priority.inl: inline/rtems/score/priority.inl $(PROJECT_INCLUDE)/rtems/score/$(dirstamp) 241 249 $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/priority.inl 242 250 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/priority.inl -
testsuites/sptests/sp69/init.c
RCS file: /usr1/CVS/rtems/testsuites/sptests/sp69/init.c,v retrieving revision 1.3 diff -u -p -r1.3 init.c
rtems_task Init( 47 47 48 48 /* Check status values. */ 49 49 rtems_test_assert( period_status.owner == rtems_task_self() ); 50 rtems_test_assert( period_status.state == RATE_MONOTONIC_INACTIVE );50 rtems_test_assert( period_status.state == PERIODIC_INACTIVE ); 51 51 #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ 52 52 rtems_test_assert( period_status.since_last_period.tv_sec == 0 ); 53 53 rtems_test_assert( period_status.since_last_period.tv_nsec == 0 ); -
testsuites/sptests/spintrcritical08/init.c
RCS file: /usr1/CVS/rtems/testsuites/sptests/spintrcritical08/init.c,v retrieving revision 1.4 diff -u -p -r1.4 init.c
rtems_id Main_task; 17 17 rtems_id Period; 18 18 volatile bool case_hit; 19 19 20 rtems_ rate_monotonic_period_states getState(void)20 rtems_periodic_period_states getState(void) 21 21 { 22 22 Objects_Locations location; 23 Rate_monotonic_Control*period;23 Periodic_Control *period; 24 24 25 period = (Rate_monotonic_Control *)_Objects_Get( 26 &_Rate_monotonic_Information, Period, &location ); 25 period = (Periodic_Control *)_Objects_Get( 26 &_Periodic_Information, Period, &location 27 ); 27 28 if ( location != OBJECTS_LOCAL ) { 28 29 puts( "Bad object lookup" ); 29 30 rtems_test_exit(0); … … rtems_timer_service_routine test_release 38 39 void *arg 39 40 ) 40 41 { 41 if ( getState() == RATE_MONOTONIC_EXPIRED_WHILE_BLOCKING )42 if ( getState() == PERIODIC_EXPIRED_WHILE_BLOCKING ) 42 43 case_hit = true; 43 44 } 44 45 … … rtems_task Init( 53 54 54 55 puts( "Init - Trying to generate period ending while blocking" ); 55 56 56 puts( "Init - rtems_ rate_monotonic_create - OK" );57 sc = rtems_ rate_monotonic_create(57 puts( "Init - rtems_periodic_create - OK" ); 58 sc = rtems_periodic_create( 58 59 rtems_build_name( 'P', 'E', 'R', '1' ), 59 60 &Period 60 61 ); 61 directive_failed( sc, "rtems_ rate_monotonic_create" );62 directive_failed( sc, "rtems_periodic_create" ); 62 63 63 64 Main_task = rtems_task_self(); 64 65 … … rtems_task Init( 70 71 if ( interrupt_critical_section_test_support_delay() ) 71 72 resets++; 72 73 73 sc = rtems_ rate_monotonic_period( Period, 1 );74 sc = rtems_periodic_period( Period, 1 ); 74 75 if ( sc == RTEMS_TIMEOUT ) 75 76 continue; 76 directive_failed( sc, "rtems_ monotonic_period");77 directive_failed( sc, "rtems_periodic_period"); 77 78 } 78 79 79 80 if ( case_hit ) { -
testsuites/sptests/spsize/size.c
RCS file: /usr1/CVS/rtems/testsuites/sptests/spsize/size.c,v retrieving revision 1.67 diff -u -p -r1.67 size.c
33 33 #endif 34 34 #include <rtems/rtems/part.h> 35 35 #include <rtems/score/priority.h> 36 #include <rtems/rtems/ratemon.h> 36 #include <rtems/score/periodic.h> 37 #include <rtems/rtems/periodic.h> 37 38 #include <rtems/rtems/region.h> 38 39 #include <rtems/rtems/sem.h> 39 40 #include <rtems/rtems/signal.h> … … void print_formula(void); 81 82 #define PER_PART \ 82 83 (long) (sizeof (Partition_Control) + NAME_PTR_SIZE) 83 84 #define PER_PERIOD \ 84 (long) (sizeof ( Rate_monotonic_Control) + NAME_PTR_SIZE)85 (long) (sizeof (Periodic_Control) + NAME_PTR_SIZE) 85 86 #define PER_PORT \ 86 87 (long) (sizeof (Dual_ported_memory_Control) + NAME_PTR_SIZE) 87 88 #define PER_EXTENSION \ … … uninitialized = 311 312 312 313 /*percpu.h*/ (sizeof _Per_CPU_Information) + 313 314 315 /*periodic.h*/ (sizeof _Periodic_Information) + 316 314 317 /*priority.h*/ (sizeof _Priority_Major_bit_map) + 315 318 (sizeof _Priority_Bit_map) + 316 319 317 /*ratemon.h*/ (sizeof _Rate_monotonic_Information) +318 319 320 /*region.h*/ (sizeof _Region_Information) + 320 321 321 322 #if defined(RTEMS_MULTIPROCESSING)