From 27f0d424951674701ed833d84da3849e1a63d512 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Tue, 15 Oct 1996 21:38:43 +0000 Subject: added support for cpu time used field in tcb --- cpukit/score/src/thread.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'cpukit/score/src') diff --git a/cpukit/score/src/thread.c b/cpukit/score/src/thread.c index 9060185348..8024b51dbf 100644 --- a/cpukit/score/src/thread.c +++ b/cpukit/score/src/thread.c @@ -518,6 +518,7 @@ boolean _Thread_Initialize( the_thread->resource_count = 0; the_thread->real_priority = priority; the_thread->Start.initial_priority = priority; + the_thread->ticks_executed = 0; _Thread_Set_priority( the_thread, priority ); @@ -945,12 +946,27 @@ void _Thread_Tickle_timeslice( void ) executing = _Thread_Executing; + /* + * Increment the number of ticks this thread has been executing + */ + + executing->ticks_executed++; + + /* + * If the thread is not preemptible or is not ready, then + * just return. + */ + if ( !executing->is_preemptible ) return; if ( !_States_Is_ready( executing->current_state ) ) return; + /* + * The cpu budget algorithm determines what happens next. + */ + switch ( executing->budget_algorithm ) { case THREAD_CPU_BUDGET_ALGORITHM_NONE: break; -- cgit v1.2.3