forked from Imagelibrary/rtems
added cpu_time_budget field to Thread_Control and removed the global variable
_Thread_Ticks_remaining_in_timeslice.
This commit is contained in:
@@ -150,6 +150,7 @@ typedef struct {
|
|||||||
/****************** end of common block ********************/
|
/****************** end of common block ********************/
|
||||||
boolean is_global;
|
boolean is_global;
|
||||||
boolean do_post_task_switch_extension;
|
boolean do_post_task_switch_extension;
|
||||||
|
unsigned32 cpu_time_budget;
|
||||||
Chain_Control *ready;
|
Chain_Control *ready;
|
||||||
Priority_Information Priority_map;
|
Priority_Information Priority_map;
|
||||||
Thread_Start_information Start;
|
Thread_Start_information Start;
|
||||||
@@ -210,10 +211,9 @@ SCORE_EXTERN unsigned32 _Thread_Dispatch_disable_level;
|
|||||||
SCORE_EXTERN unsigned32 _Thread_Maximum_extensions;
|
SCORE_EXTERN unsigned32 _Thread_Maximum_extensions;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The following data items are used to manage timeslicing.
|
* The following is used to manage the length of a timeslice quantum.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
SCORE_EXTERN unsigned32 _Thread_Ticks_remaining_in_timeslice;
|
|
||||||
SCORE_EXTERN unsigned32 _Thread_Ticks_per_timeslice;
|
SCORE_EXTERN unsigned32 _Thread_Ticks_per_timeslice;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -150,6 +150,7 @@ typedef struct {
|
|||||||
/****************** end of common block ********************/
|
/****************** end of common block ********************/
|
||||||
boolean is_global;
|
boolean is_global;
|
||||||
boolean do_post_task_switch_extension;
|
boolean do_post_task_switch_extension;
|
||||||
|
unsigned32 cpu_time_budget;
|
||||||
Chain_Control *ready;
|
Chain_Control *ready;
|
||||||
Priority_Information Priority_map;
|
Priority_Information Priority_map;
|
||||||
Thread_Start_information Start;
|
Thread_Start_information Start;
|
||||||
@@ -210,10 +211,9 @@ SCORE_EXTERN unsigned32 _Thread_Dispatch_disable_level;
|
|||||||
SCORE_EXTERN unsigned32 _Thread_Maximum_extensions;
|
SCORE_EXTERN unsigned32 _Thread_Maximum_extensions;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The following data items are used to manage timeslicing.
|
* The following is used to manage the length of a timeslice quantum.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
SCORE_EXTERN unsigned32 _Thread_Ticks_remaining_in_timeslice;
|
|
||||||
SCORE_EXTERN unsigned32 _Thread_Ticks_per_timeslice;
|
SCORE_EXTERN unsigned32 _Thread_Ticks_per_timeslice;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ void _Thread_Handler_initialization(
|
|||||||
|
|
||||||
_Thread_Maximum_extensions = maximum_extensions;
|
_Thread_Maximum_extensions = maximum_extensions;
|
||||||
|
|
||||||
_Thread_Ticks_remaining_in_timeslice = ticks_per_timeslice;
|
|
||||||
_Thread_Ticks_per_timeslice = ticks_per_timeslice;
|
_Thread_Ticks_per_timeslice = ticks_per_timeslice;
|
||||||
|
|
||||||
_Thread_Ready_chain = _Workspace_Allocate_or_fatal_error(
|
_Thread_Ready_chain = _Workspace_Allocate_or_fatal_error(
|
||||||
@@ -244,7 +243,7 @@ void _Thread_Dispatch( void )
|
|||||||
|
|
||||||
_User_extensions_Thread_switch( executing, heir );
|
_User_extensions_Thread_switch( executing, heir );
|
||||||
|
|
||||||
_Thread_Ticks_remaining_in_timeslice = _Thread_Ticks_per_timeslice;
|
heir->cpu_time_budget = _Thread_Ticks_per_timeslice;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the CPU has hardware floating point, then we must address saving
|
* If the CPU has hardware floating point, then we must address saving
|
||||||
@@ -874,8 +873,8 @@ void _Thread_Reset_timeslice( void )
|
|||||||
ready = executing->ready;
|
ready = executing->ready;
|
||||||
_ISR_Disable( level );
|
_ISR_Disable( level );
|
||||||
if ( _Chain_Has_only_one_node( ready ) ) {
|
if ( _Chain_Has_only_one_node( ready ) ) {
|
||||||
_Thread_Ticks_remaining_in_timeslice = _Thread_Ticks_per_timeslice;
|
|
||||||
_ISR_Enable( level );
|
_ISR_Enable( level );
|
||||||
|
executing->cpu_time_budget = _Thread_Ticks_per_timeslice;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_Chain_Extract_unprotected( &executing->Object.Node );
|
_Chain_Extract_unprotected( &executing->Object.Node );
|
||||||
@@ -911,7 +910,7 @@ void _Thread_Tickle_timeslice( void )
|
|||||||
!_States_Is_ready( _Thread_Executing->current_state ) )
|
!_States_Is_ready( _Thread_Executing->current_state ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( --_Thread_Ticks_remaining_in_timeslice == 0 ) {
|
if ( --_Thread_Executing->cpu_time_budget == 0 ) {
|
||||||
_Thread_Reset_timeslice();
|
_Thread_Reset_timeslice();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -310,7 +310,6 @@ uninitialized =
|
|||||||
/*thread.h*/ (sizeof _Thread_BSP_context) +
|
/*thread.h*/ (sizeof _Thread_BSP_context) +
|
||||||
(sizeof _Thread_Dispatch_disable_level) +
|
(sizeof _Thread_Dispatch_disable_level) +
|
||||||
(sizeof _Thread_Maximum_extensions) +
|
(sizeof _Thread_Maximum_extensions) +
|
||||||
(sizeof _Thread_Ticks_remaining_in_timeslice) +
|
|
||||||
(sizeof _Thread_Ticks_per_timeslice) +
|
(sizeof _Thread_Ticks_per_timeslice) +
|
||||||
(sizeof _Thread_Ready_chain) +
|
(sizeof _Thread_Ready_chain) +
|
||||||
(sizeof _Thread_Executing) +
|
(sizeof _Thread_Executing) +
|
||||||
|
|||||||
@@ -150,6 +150,7 @@ typedef struct {
|
|||||||
/****************** end of common block ********************/
|
/****************** end of common block ********************/
|
||||||
boolean is_global;
|
boolean is_global;
|
||||||
boolean do_post_task_switch_extension;
|
boolean do_post_task_switch_extension;
|
||||||
|
unsigned32 cpu_time_budget;
|
||||||
Chain_Control *ready;
|
Chain_Control *ready;
|
||||||
Priority_Information Priority_map;
|
Priority_Information Priority_map;
|
||||||
Thread_Start_information Start;
|
Thread_Start_information Start;
|
||||||
@@ -210,10 +211,9 @@ SCORE_EXTERN unsigned32 _Thread_Dispatch_disable_level;
|
|||||||
SCORE_EXTERN unsigned32 _Thread_Maximum_extensions;
|
SCORE_EXTERN unsigned32 _Thread_Maximum_extensions;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The following data items are used to manage timeslicing.
|
* The following is used to manage the length of a timeslice quantum.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
SCORE_EXTERN unsigned32 _Thread_Ticks_remaining_in_timeslice;
|
|
||||||
SCORE_EXTERN unsigned32 _Thread_Ticks_per_timeslice;
|
SCORE_EXTERN unsigned32 _Thread_Ticks_per_timeslice;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ void _Thread_Handler_initialization(
|
|||||||
|
|
||||||
_Thread_Maximum_extensions = maximum_extensions;
|
_Thread_Maximum_extensions = maximum_extensions;
|
||||||
|
|
||||||
_Thread_Ticks_remaining_in_timeslice = ticks_per_timeslice;
|
|
||||||
_Thread_Ticks_per_timeslice = ticks_per_timeslice;
|
_Thread_Ticks_per_timeslice = ticks_per_timeslice;
|
||||||
|
|
||||||
_Thread_Ready_chain = _Workspace_Allocate_or_fatal_error(
|
_Thread_Ready_chain = _Workspace_Allocate_or_fatal_error(
|
||||||
@@ -244,7 +243,7 @@ void _Thread_Dispatch( void )
|
|||||||
|
|
||||||
_User_extensions_Thread_switch( executing, heir );
|
_User_extensions_Thread_switch( executing, heir );
|
||||||
|
|
||||||
_Thread_Ticks_remaining_in_timeslice = _Thread_Ticks_per_timeslice;
|
heir->cpu_time_budget = _Thread_Ticks_per_timeslice;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the CPU has hardware floating point, then we must address saving
|
* If the CPU has hardware floating point, then we must address saving
|
||||||
@@ -874,8 +873,8 @@ void _Thread_Reset_timeslice( void )
|
|||||||
ready = executing->ready;
|
ready = executing->ready;
|
||||||
_ISR_Disable( level );
|
_ISR_Disable( level );
|
||||||
if ( _Chain_Has_only_one_node( ready ) ) {
|
if ( _Chain_Has_only_one_node( ready ) ) {
|
||||||
_Thread_Ticks_remaining_in_timeslice = _Thread_Ticks_per_timeslice;
|
|
||||||
_ISR_Enable( level );
|
_ISR_Enable( level );
|
||||||
|
executing->cpu_time_budget = _Thread_Ticks_per_timeslice;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_Chain_Extract_unprotected( &executing->Object.Node );
|
_Chain_Extract_unprotected( &executing->Object.Node );
|
||||||
@@ -911,7 +910,7 @@ void _Thread_Tickle_timeslice( void )
|
|||||||
!_States_Is_ready( _Thread_Executing->current_state ) )
|
!_States_Is_ready( _Thread_Executing->current_state ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( --_Thread_Ticks_remaining_in_timeslice == 0 ) {
|
if ( --_Thread_Executing->cpu_time_budget == 0 ) {
|
||||||
_Thread_Reset_timeslice();
|
_Thread_Reset_timeslice();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -310,7 +310,6 @@ uninitialized =
|
|||||||
/*thread.h*/ (sizeof _Thread_BSP_context) +
|
/*thread.h*/ (sizeof _Thread_BSP_context) +
|
||||||
(sizeof _Thread_Dispatch_disable_level) +
|
(sizeof _Thread_Dispatch_disable_level) +
|
||||||
(sizeof _Thread_Maximum_extensions) +
|
(sizeof _Thread_Maximum_extensions) +
|
||||||
(sizeof _Thread_Ticks_remaining_in_timeslice) +
|
|
||||||
(sizeof _Thread_Ticks_per_timeslice) +
|
(sizeof _Thread_Ticks_per_timeslice) +
|
||||||
(sizeof _Thread_Ready_chain) +
|
(sizeof _Thread_Ready_chain) +
|
||||||
(sizeof _Thread_Executing) +
|
(sizeof _Thread_Executing) +
|
||||||
|
|||||||
Reference in New Issue
Block a user