[PATCH 2/5] score: Delete _Thread_Ticks_per_timeslice

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Apr 4 15:07:38 UTC 2014


Use the Configuration instead.
---
 cpukit/posix/src/pthreadsetschedparam.c       |    4 +++-
 cpukit/posix/src/sched_rr_get_interval.c      |    9 ++++++---
 cpukit/rtems/src/taskmode.c                   |    3 ++-
 cpukit/score/include/rtems/score/threadimpl.h |    5 -----
 cpukit/score/src/schedulerdefaulttick.c       |    4 +++-
 cpukit/score/src/thread.c                     |    2 --
 cpukit/score/src/threaddispatch.c             |    3 ++-
 cpukit/score/src/threadinitialize.c           |    3 ++-
 testsuites/sptests/spsize/size.c              |    1 -
 9 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/cpukit/posix/src/pthreadsetschedparam.c b/cpukit/posix/src/pthreadsetschedparam.c
index 4b62179..d5d0a5b 100644
--- a/cpukit/posix/src/pthreadsetschedparam.c
+++ b/cpukit/posix/src/pthreadsetschedparam.c
@@ -30,6 +30,7 @@
 #include <rtems/posix/time.h>
 #include <rtems/score/threadimpl.h>
 #include <rtems/score/watchdogimpl.h>
+#include <rtems/config.h>
 
 int pthread_setschedparam(
   pthread_t           thread,
@@ -83,7 +84,8 @@ int pthread_setschedparam(
         case SCHED_OTHER:
         case SCHED_FIFO:
         case SCHED_RR:
-          the_thread->cpu_time_budget = _Thread_Ticks_per_timeslice;
+          the_thread->cpu_time_budget =
+            rtems_configuration_get_ticks_per_timeslice();
 
           the_thread->real_priority =
             _POSIX_Priority_To_core( api->schedparam.sched_priority );
diff --git a/cpukit/posix/src/sched_rr_get_interval.c b/cpukit/posix/src/sched_rr_get_interval.c
index 060cea0..1cb78ea 100644
--- a/cpukit/posix/src/sched_rr_get_interval.c
+++ b/cpukit/posix/src/sched_rr_get_interval.c
@@ -24,9 +24,8 @@
 #include <sched.h>
 #include <errno.h>
 
-#include <rtems/system.h>
-#include <rtems/score/threadimpl.h>
 #include <rtems/score/timespec.h>
+#include <rtems/config.h>
 #include <rtems/seterr.h>
 
 int sched_rr_get_interval(
@@ -44,6 +43,10 @@ int sched_rr_get_interval(
   if ( !interval )
     rtems_set_errno_and_return_minus_one( EINVAL );
 
-  _Timespec_From_ticks( _Thread_Ticks_per_timeslice, interval );
+  _Timespec_From_ticks(
+    rtems_configuration_get_ticks_per_timeslice(),
+    interval
+  );
+
   return 0;
 }
diff --git a/cpukit/rtems/src/taskmode.c b/cpukit/rtems/src/taskmode.c
index 2bcbd1d..eeb3e0f 100644
--- a/cpukit/rtems/src/taskmode.c
+++ b/cpukit/rtems/src/taskmode.c
@@ -105,7 +105,8 @@ rtems_status_code rtems_task_mode(
   if ( mask & RTEMS_TIMESLICE_MASK ) {
     if ( _Modes_Is_timeslice(mode_set) ) {
       executing->budget_algorithm = THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE;
-      executing->cpu_time_budget  = _Thread_Ticks_per_timeslice;
+      executing->cpu_time_budget =
+        rtems_configuration_get_ticks_per_timeslice();
     } else
       executing->budget_algorithm = THREAD_CPU_BUDGET_ALGORITHM_NONE;
   }
diff --git a/cpukit/score/include/rtems/score/threadimpl.h b/cpukit/score/include/rtems/score/threadimpl.h
index f109d39..41b90e3 100644
--- a/cpukit/score/include/rtems/score/threadimpl.h
+++ b/cpukit/score/include/rtems/score/threadimpl.h
@@ -58,11 +58,6 @@ SCORE_EXTERN void *rtems_ada_self;
 SCORE_EXTERN Objects_Information _Thread_Internal_information;
 
 /**
- *  The following is used to manage the length of a timeslice quantum.
- */
-SCORE_EXTERN uint32_t   _Thread_Ticks_per_timeslice;
-
-/**
  *  The following points to the thread whose floating point
  *  context is currently loaded.
  */
diff --git a/cpukit/score/src/schedulerdefaulttick.c b/cpukit/score/src/schedulerdefaulttick.c
index 1976a74..3b3d9a0 100644
--- a/cpukit/score/src/schedulerdefaulttick.c
+++ b/cpukit/score/src/schedulerdefaulttick.c
@@ -22,6 +22,7 @@
 #include <rtems/score/schedulerimpl.h>
 #include <rtems/score/threadimpl.h>
 #include <rtems/score/smp.h>
+#include <rtems/config.h>
 
 static void _Scheduler_default_Tick_for_executing(
   Scheduler_Control *scheduler,
@@ -69,7 +70,8 @@ static void _Scheduler_default_Tick_for_executing(
          *  FIFO for this priority and a new heir is selected.
          */
         _Scheduler_Yield( scheduler, executing );
-        executing->cpu_time_budget = _Thread_Ticks_per_timeslice;
+        executing->cpu_time_budget =
+          rtems_configuration_get_ticks_per_timeslice();
       }
       break;
 
diff --git a/cpukit/score/src/thread.c b/cpukit/score/src/thread.c
index 589e474..a77fe5f 100644
--- a/cpukit/score/src/thread.c
+++ b/cpukit/score/src/thread.c
@@ -50,8 +50,6 @@ void _Thread_Handler_initialization(void)
   _Thread_Allocated_fp      = NULL;
 #endif
 
-  _Thread_Ticks_per_timeslice  = ticks_per_timeslice;
-
   #if defined(RTEMS_MULTIPROCESSING)
     _Thread_MP_Handler_initialization( maximum_proxies );
   #endif
diff --git a/cpukit/score/src/threaddispatch.c b/cpukit/score/src/threaddispatch.c
index ae69a5c..40a2efb 100644
--- a/cpukit/score/src/threaddispatch.c
+++ b/cpukit/score/src/threaddispatch.c
@@ -28,6 +28,7 @@
 #include <rtems/score/todimpl.h>
 #include <rtems/score/userextimpl.h>
 #include <rtems/score/wkspace.h>
+#include <rtems/config.h>
 
 static Thread_Action *_Thread_Get_post_switch_action(
   Thread_Control *executing
@@ -121,7 +122,7 @@ void _Thread_Dispatch( void )
     rtems_ada_self = heir->rtems_ada_self;
 #endif
     if ( heir->budget_algorithm == THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE )
-      heir->cpu_time_budget = _Thread_Ticks_per_timeslice;
+      heir->cpu_time_budget = rtems_configuration_get_ticks_per_timeslice();
 
 #if !defined( RTEMS_SMP )
     _ISR_Enable( level );
diff --git a/cpukit/score/src/threadinitialize.c b/cpukit/score/src/threadinitialize.c
index 490fc25..79cbd7c 100644
--- a/cpukit/score/src/threadinitialize.c
+++ b/cpukit/score/src/threadinitialize.c
@@ -188,7 +188,8 @@ bool _Thread_Initialize(
       break;
     #if defined(RTEMS_SCORE_THREAD_ENABLE_EXHAUST_TIMESLICE)
       case THREAD_CPU_BUDGET_ALGORITHM_EXHAUST_TIMESLICE:
-        the_thread->cpu_time_budget = _Thread_Ticks_per_timeslice;
+        the_thread->cpu_time_budget =
+          rtems_configuration_get_ticks_per_timeslice();
         break;
     #endif
     #if defined(RTEMS_SCORE_THREAD_ENABLE_SCHEDULER_CALLOUT)
diff --git a/testsuites/sptests/spsize/size.c b/testsuites/sptests/spsize/size.c
index 1d4c96b..6acdaa6 100644
--- a/testsuites/sptests/spsize/size.c
+++ b/testsuites/sptests/spsize/size.c
@@ -385,7 +385,6 @@ uninitialized =
 /*tasksimpl.h*/ (sizeof _RTEMS_tasks_Information)         +
 
 /*thread.h*/    (sizeof _Thread_Dispatch_disable_level)   +
-                (sizeof _Thread_Ticks_per_timeslice)      +
                 (sizeof _Thread_Executing)                +
                 (sizeof _Thread_Heir)                     +
 #if (CPU_HARDWARE_FP == 1) || (CPU_SOFTWARE_FP == 1)
-- 
1.7.7




More information about the devel mailing list