@@ -71,11 +71,12 @@ uint32_t g_oneshot_maxticks = UINT32_MAX;
71
71
****************************************************************************/
72
72
73
73
#if CONFIG_RR_INTERVAL > 0 || defined(CONFIG_SCHED_SPORADIC )
74
- static clock_t nxsched_cpu_scheduler (int cpu , clock_t elapsed ,
75
- bool noswitches );
74
+ static clock_t nxsched_cpu_scheduler (int cpu , clock_t ticks ,
75
+ clock_t elapsed , bool noswitches );
76
76
#endif
77
77
#if CONFIG_RR_INTERVAL > 0 || defined(CONFIG_SCHED_SPORADIC )
78
- static clock_t nxsched_process_scheduler (clock_t elapsed , bool noswitches );
78
+ static clock_t nxsched_process_scheduler (clock_t ticks , clock_t elapsed ,
79
+ bool noswitches );
79
80
#endif
80
81
static clock_t nxsched_timer_process (clock_t ticks , clock_t elapsed ,
81
82
bool noswitches );
@@ -101,12 +102,6 @@ static clock_t g_timer_tick;
101
102
static unsigned int g_timer_interval ;
102
103
#endif
103
104
104
- #ifdef CONFIG_SCHED_SPORADIC
105
- /* This is the time of the last scheduler assessment */
106
-
107
- static clock_t g_sched_time ;
108
- #endif
109
-
110
105
/****************************************************************************
111
106
* Private Functions
112
107
****************************************************************************/
@@ -184,8 +179,8 @@ int up_timer_tick_cancel(FAR clock_t *ticks)
184
179
****************************************************************************/
185
180
186
181
#if CONFIG_RR_INTERVAL > 0 || defined(CONFIG_SCHED_SPORADIC )
187
- static clock_t nxsched_cpu_scheduler (int cpu , clock_t elapsed ,
188
- bool noswitches )
182
+ static clock_t nxsched_cpu_scheduler (int cpu , clock_t ticks ,
183
+ clock_t elapsed , bool noswitches )
189
184
{
190
185
FAR struct tcb_s * rtcb = current_task (cpu );
191
186
FAR struct tcb_s * ntcb = current_task (cpu );
@@ -220,7 +215,7 @@ static clock_t nxsched_cpu_scheduler(int cpu, clock_t elapsed,
220
215
* committed to updating the scheduler for this TCB.
221
216
*/
222
217
223
- sporadic -> eventtime = g_sched_time ;
218
+ sporadic -> eventtime = ticks ;
224
219
225
220
/* Yes, check if the currently executing task has exceeded its
226
221
* budget.
@@ -242,7 +237,7 @@ static clock_t nxsched_cpu_scheduler(int cpu, clock_t elapsed,
242
237
{
243
238
/* Recurse just to get the correct return value */
244
239
245
- return nxsched_process_scheduler (0 , true);
240
+ return nxsched_process_scheduler (ticks , 0 , true);
246
241
}
247
242
248
243
/* Returning zero means that there is no interesting event to be timed */
@@ -259,6 +254,7 @@ static clock_t nxsched_cpu_scheduler(int cpu, clock_t elapsed,
259
254
* active task on a single CPU.
260
255
*
261
256
* Input Parameters:
257
+ * ticks - The number of ticks that represent current time.
262
258
* elapsed - The number of ticks that have elapsed on the interval timer.
263
259
* noswitches - True: Can't do context switches now.
264
260
*
@@ -276,7 +272,8 @@ static clock_t nxsched_cpu_scheduler(int cpu, clock_t elapsed,
276
272
****************************************************************************/
277
273
278
274
#if CONFIG_RR_INTERVAL > 0 || defined(CONFIG_SCHED_SPORADIC )
279
- static clock_t nxsched_process_scheduler (clock_t elapsed , bool noswitches )
275
+ static clock_t nxsched_process_scheduler (clock_t ticks , clock_t elapsed ,
276
+ bool noswitches )
280
277
{
281
278
#ifdef CONFIG_SMP
282
279
clock_t minslice = CLOCK_MAX ;
@@ -298,7 +295,7 @@ static clock_t nxsched_process_scheduler(clock_t elapsed, bool noswitches)
298
295
299
296
for (i = 0 ; i < CONFIG_SMP_NCPUS ; i ++ )
300
297
{
301
- timeslice = nxsched_cpu_scheduler (i , elapsed , noswitches );
298
+ timeslice = nxsched_cpu_scheduler (i , ticks , elapsed , noswitches );
302
299
if (timeslice > 0 && timeslice < minslice )
303
300
{
304
301
minslice = timeslice ;
@@ -311,11 +308,11 @@ static clock_t nxsched_process_scheduler(clock_t elapsed, bool noswitches)
311
308
#else
312
309
/* Perform scheduler operations on the single CPUs */
313
310
314
- return nxsched_cpu_scheduler (0 , elapsed , noswitches );
311
+ return nxsched_cpu_scheduler (0 , ticks , elapsed , noswitches );
315
312
#endif
316
313
}
317
314
#else
318
- # define nxsched_process_scheduler (t ,n ) (0)
315
+ # define nxsched_process_scheduler (t , e , n ) (0)
319
316
#endif
320
317
321
318
/****************************************************************************
@@ -407,7 +404,7 @@ static clock_t nxsched_timer_process(clock_t ticks, clock_t elapsed,
407
404
* active task.
408
405
*/
409
406
410
- tmp = nxsched_process_scheduler (elapsed , noswitches );
407
+ tmp = nxsched_process_scheduler (ticks , elapsed , noswitches );
411
408
412
409
#if CONFIG_RR_INTERVAL > 0 || defined(CONFIG_SCHED_SPORADIC )
413
410
if (tmp > 0 && tmp < rettime )
@@ -520,12 +517,6 @@ void nxsched_alarm_tick_expiration(clock_t ticks)
520
517
521
518
g_timer_tick = ticks ;
522
519
523
- #ifdef CONFIG_SCHED_SPORADIC
524
- /* Save the last time that the scheduler ran */
525
-
526
- g_sched_time = ticks ;
527
- #endif
528
-
529
520
/* Process the timer ticks and set up the next interval (or not) */
530
521
531
522
nexttime = nxsched_timer_process (ticks , elapsed , false);
@@ -586,12 +577,6 @@ void nxsched_timer_expiration(void)
586
577
elapsed = g_timer_interval ;
587
578
g_timer_interval = 0 ;
588
579
589
- #ifdef CONFIG_SCHED_SPORADIC
590
- /* Save the last time that the scheduler ran */
591
-
592
- up_timer_gettick (& g_sched_time );
593
- #endif
594
-
595
580
/* Process the timer ticks and set up the next interval (or not) */
596
581
597
582
nexttime = nxsched_timer_process (g_timer_tick , elapsed , false);
@@ -639,12 +624,6 @@ clock_t nxsched_cancel_timer(void)
639
624
640
625
up_alarm_tick_cancel (& g_timer_tick );
641
626
642
- #ifdef CONFIG_SCHED_SPORADIC
643
- /* Save the last time that the scheduler ran */
644
-
645
- g_sched_time = g_timer_tick ;
646
- #endif
647
-
648
627
/* Convert this to the elapsed time and update clock tickbase */
649
628
650
629
elapsed = g_timer_tick - ticks ;
@@ -675,12 +654,6 @@ clock_t nxsched_cancel_timer(void)
675
654
g_timer_interval = 0 ;
676
655
g_timer_tick += elapsed ;
677
656
678
- #ifdef CONFIG_SCHED_SPORADIC
679
- /* Save the last time that the scheduler ran */
680
-
681
- g_sched_time = g_timer_tick ;
682
- #endif
683
-
684
657
/* Process the timer ticks and return the next interval */
685
658
686
659
return nxsched_timer_process (g_timer_tick , elapsed , true);
@@ -712,12 +685,6 @@ void nxsched_resume_timer(void)
712
685
{
713
686
clock_t nexttime ;
714
687
715
- #ifdef CONFIG_SCHED_SPORADIC
716
- /* Save the last time that the scheduler ran */
717
-
718
- up_timer_gettick (& g_sched_time );
719
- #endif
720
-
721
688
/* Reassess the next deadline (by simply processing a zero ticks expired)
722
689
* and set up the next interval (or not).
723
690
*/
0 commit comments