summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-11-24 11:51:28 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-12-07 14:22:01 +0100
commit3899bc1a4b3294306ae2fd3f8ff0ee10365d9f4b (patch)
tree3912fc89bbde8a64a20111e02c618e85eb7bb000 /cpukit/rtems
parentscore: Rename Objects_Information::allocation_size (diff)
downloadrtems-3899bc1a4b3294306ae2fd3f8ff0ee10365d9f4b.tar.bz2
score: Optimize object lookup
Use the maximum ID for the ID to object translation. Using the maximum ID gets rid of an additional load from the object information in _Objects_Get(). In addition, object lookups fail for every ID in case the object information is cleared to zero. This makes it a bit more robust during system startup (see new tests in spconfig02). The local table no longer needs a NULL pointer entry at array index zero. Adjust all the object iteration loops accordingly. Remove Objects_Information::minimum_id since it contains only redundant information. Add _Objects_Get_minimum_id() to get the minimum ID. Update #3621.
Diffstat (limited to 'cpukit/rtems')
-rw-r--r--cpukit/rtems/src/ratemonreportstatistics.c10
-rw-r--r--cpukit/rtems/src/ratemonresetall.c12
-rw-r--r--cpukit/rtems/src/rtemsobjectgetclassinfo.c2
3 files changed, 16 insertions, 8 deletions
diff --git a/cpukit/rtems/src/ratemonreportstatistics.c b/cpukit/rtems/src/ratemonreportstatistics.c
index 1f7542f8df..cf04a787e3 100644
--- a/cpukit/rtems/src/ratemonreportstatistics.c
+++ b/cpukit/rtems/src/ratemonreportstatistics.c
@@ -35,6 +35,7 @@ void rtems_rate_monotonic_report_statistics_with_plugin(
)
{
rtems_status_code status;
+ rtems_id maximum_id;
rtems_id id;
rtems_rate_monotonic_period_statistics the_stats;
rtems_rate_monotonic_period_status the_status;
@@ -67,9 +68,12 @@ ididididid NNNN ccccc mmmmmm X
* 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++ ) {
+ maximum_id = _Rate_monotonic_Information.maximum_id;
+ for (
+ id = _Objects_Get_minimum_id( maximum_id ) ;
+ id <= maximum_id ;
+ ++id
+ ) {
status = rtems_rate_monotonic_get_statistics( id, &the_stats );
if ( status != RTEMS_SUCCESSFUL )
continue;
diff --git a/cpukit/rtems/src/ratemonresetall.c b/cpukit/rtems/src/ratemonresetall.c
index a8418e82c4..c9e9089528 100644
--- a/cpukit/rtems/src/ratemonresetall.c
+++ b/cpukit/rtems/src/ratemonresetall.c
@@ -25,7 +25,8 @@
*/
void rtems_rate_monotonic_reset_all_statistics( void )
{
- Objects_Id id;
+ rtems_id maximum_id;
+ rtems_id id;
/*
* Prevent allocation or deallocation of any of the periods while we are
@@ -37,9 +38,12 @@ void rtems_rate_monotonic_reset_all_statistics( void )
* 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++ ) {
+ maximum_id = _Rate_monotonic_Information.maximum_id;
+ for (
+ id = _Objects_Get_minimum_id( maximum_id ) ;
+ id <= maximum_id ;
+ ++id
+ ) {
(void) rtems_rate_monotonic_reset_statistics( id );
}
diff --git a/cpukit/rtems/src/rtemsobjectgetclassinfo.c b/cpukit/rtems/src/rtemsobjectgetclassinfo.c
index ffcbd96cae..3ebe3535f5 100644
--- a/cpukit/rtems/src/rtemsobjectgetclassinfo.c
+++ b/cpukit/rtems/src/rtemsobjectgetclassinfo.c
@@ -44,7 +44,7 @@ rtems_status_code rtems_object_get_class_information(
/*
* Return information about this object class to the user.
*/
- info->minimum_id = obj_info->minimum_id;
+ info->minimum_id = _Objects_Get_minimum_id( obj_info->maximum_id );
info->maximum_id = obj_info->maximum_id;
info->auto_extend = obj_info->auto_extend;
info->maximum = obj_info->maximum;