diff options
Diffstat (limited to 'Kokyu/DSRT_CV_Dispatcher_Impl_T.cpp')
-rw-r--r-- | Kokyu/DSRT_CV_Dispatcher_Impl_T.cpp | 97 |
1 files changed, 72 insertions, 25 deletions
diff --git a/Kokyu/DSRT_CV_Dispatcher_Impl_T.cpp b/Kokyu/DSRT_CV_Dispatcher_Impl_T.cpp index ff0430f9f29..9b59274d25b 100644 --- a/Kokyu/DSRT_CV_Dispatcher_Impl_T.cpp +++ b/Kokyu/DSRT_CV_Dispatcher_Impl_T.cpp @@ -56,19 +56,25 @@ template <class DSRT_Scheduler_Traits> int DSRT_CV_Dispatcher_Impl<DSRT_Scheduler_Traits>:: init_i (const DSRT_ConfigInfo&) { + DSUI_EVENT_LOG (DSRT_CV_DISPATCH_FAM, INIT_I, 0, 0, NULL); return 0; } template <class DSRT_Scheduler_Traits> int DSRT_CV_Dispatcher_Impl<DSRT_Scheduler_Traits>:: -schedule_i (Guid_t id, const DSRT_QoSDescriptor& qos) +schedule_i (Guid_t guid, const DSRT_QoSDescriptor& qos) { #ifdef KOKYU_DSRT_LOGGING ACE_DEBUG ((LM_DEBUG, "(%t|%T):schedule_i enter\n")); #endif - DSUI_EVENT_LOG (DSRT_CV_DISPATCH_FAM, SCHEDULE_ENTER, 0,0,NULL); + int int_guid; + ACE_OS::memcpy (&int_guid, + guid.get_buffer (), + guid.length ()); + + DSUI_EVENT_LOG (DSRT_CV_DISPATCH_FAM, SCHEDULE_ENTER, int_guid, 0, NULL); DSRT_Dispatch_Item<DSRT_Scheduler_Traits>* item; ACE_hthread_t thr_handle; ACE_Thread::self (thr_handle); @@ -83,7 +89,7 @@ schedule_i (Guid_t id, const DSRT_QoSDescriptor& qos) } ACE_NEW_RETURN (item, - DSRT_Dispatch_Item<DSRT_Scheduler_Traits> (id, qos), + DSRT_Dispatch_Item<DSRT_Scheduler_Traits> (guid, qos), -1); item->thread_handle (thr_handle); @@ -108,25 +114,25 @@ schedule_i (Guid_t id, const DSRT_QoSDescriptor& qos) ACE_hthread_t most_eligible_thr_handle = item_var->thread_handle (); #ifdef KOKYU_DSRT_LOGGING - ACE_DEBUG ((LM_DEBUG, - "(%t|%T):curr thr handle = %d\n", - thr_handle)); - ACE_DEBUG ((LM_DEBUG, - "(%t|%T):curr scheduled thr handle = %d\n", - this->curr_scheduled_thr_handle_)); - ACE_DEBUG ((LM_DEBUG, + ACE_DEBUG ((LM_DEBUG, + "(%t|%T):curr thr handle = %d\n", + thr_handle)); + ACE_DEBUG ((LM_DEBUG, + "(%t|%T):curr scheduled thr handle = %d\n", + this->curr_scheduled_thr_handle_)); + ACE_DEBUG ((LM_DEBUG, "(%t|%T):most eligible thr handle = %d \n", - most_eligible_thr_handle)); + most_eligible_thr_handle)); #endif if (this->curr_scheduled_thr_handle_ == thr_handle && most_eligible_thr_handle != thr_handle) { #ifdef KOKYU_DSRT_LOGGING - ACE_DEBUG ((LM_DEBUG, + ACE_DEBUG ((LM_DEBUG, "(%t|%T):curr sched thr handle = thr_handle & " "most eligible thr handle != curr thr handle. " - "about to do a broadcast on CV to wake up most eligible\n")); + "about to do a broadcast on CV to wake up most eligible\n")); #endif this->curr_scheduled_thr_handle_ = most_eligible_thr_handle; //wake up the most eligible thread @@ -137,20 +143,20 @@ schedule_i (Guid_t id, const DSRT_QoSDescriptor& qos) //if the current thread is most eligible, but some thread is //scheduled currently, then wait. while (most_eligible_thr_handle != thr_handle || - (most_eligible_thr_handle == thr_handle && + (most_eligible_thr_handle == thr_handle && this->curr_scheduled_thr_handle_ != thr_handle && this->curr_scheduled_thr_handle_ != 0)) { ACE_Time_Value tv (60,0); tv += ACE_OS::gettimeofday (); - //wait a maximum of 1 min. This is an escape latch against lockups. + //wait a maximum of 1 min. This is an escape latch against lockups. #ifdef KOKYU_DSRT_LOGGING - ACE_DEBUG ((LM_DEBUG, + ACE_DEBUG ((LM_DEBUG, "(%t|%T): About to block on cv\n")); #endif - if (this->run_cond_.wait (&tv) == -1) + if (this->run_cond_.wait (&tv) == -1) { - ACE_ERROR ((LM_ERROR, + ACE_ERROR ((LM_ERROR, "(%t|%T): run_cond.wait timed out -- Possible Lockup\n")); } this->ready_queue_.most_eligible (item_var); @@ -160,7 +166,7 @@ schedule_i (Guid_t id, const DSRT_QoSDescriptor& qos) this->curr_scheduled_thr_handle_ = most_eligible_thr_handle; #ifdef KOKYU_DSRT_LOGGING - ACE_DEBUG ((LM_DEBUG, + ACE_DEBUG ((LM_DEBUG, "(%t|%T): %d is currently running\n", thr_handle)); #endif @@ -178,7 +184,7 @@ schedule_i (Guid_t id, const DSRT_QoSDescriptor& qos) ACE_DEBUG ((LM_DEBUG, "(%t|%T):schedule_i exit\n")); #endif - DSUI_EVENT_LOG (DSRT_CV_DISPATCH_FAM, SCHEDULE_EXIT, 0,0,NULL); + DSUI_EVENT_LOG (DSRT_CV_DISPATCH_FAM, SCHEDULE_EXIT, int_guid, 0, NULL); return 0; } @@ -186,6 +192,12 @@ template <class DSRT_Scheduler_Traits> int DSRT_CV_Dispatcher_Impl<DSRT_Scheduler_Traits>:: release_guard_i (Guid_t guid, const DSRT_QoSDescriptor& qos) { + int int_guid; + ACE_OS::memcpy (&int_guid, + guid.get_buffer (), + guid.length ()); + + DSUI_EVENT_LOG (DSRT_CV_DISPATCH_FAM, RELEASE_GUARD_START, int_guid, 0, NULL); #ifdef KOKYU_DSRT_LOGGING ACE_DEBUG((LM_DEBUG,"(%t|%T):release guard enter and current task id is %d and period is %d.\n",qos.task_id_,qos.period_)); #endif @@ -212,6 +224,10 @@ release_guard_i (Guid_t guid, const DSRT_QoSDescriptor& qos) "(%t|%T): Over the proper release time\n")); #endif this->release_map_.rebind(qos.task_id_, cur_time); +/*DTTIME: + Release time on the server side. please record the guid in your DSUI_EVENT_LOG +*/ + DSUI_EVENT_LOG (DSRT_CV_DISPATCH_FAM, RG_EVENT_RELEASED, int_guid, 0, NULL); this->schedule_i (guid, qos); } else @@ -238,6 +254,11 @@ release_guard_i (Guid_t guid, const DSRT_QoSDescriptor& qos) #endif this->release_map_.rebind(qos.task_id_, cur_time); +/*DTTIME: + Release time on the server side. please record the guid in your DSUI_EVENT_LOG +*/ + DSUI_EVENT_LOG (DSRT_CV_DISPATCH_FAM, RG_DELAYED_EVENT_RELEASED, int_guid, 0, NULL); + this->schedule_i (guid, qos); } } @@ -250,9 +271,15 @@ release_guard_i (Guid_t guid, const DSRT_QoSDescriptor& qos) #endif this->release_map_.bind(qos.task_id_, cur_time); +/*DTTIME: + Release time on the server side. please record the guid in your DSUI_EVENT_LOG +*/ + DSUI_EVENT_LOG (DSRT_CV_DISPATCH_FAM, NONRG_EVENT_RELEASED, int_guid, 0, NULL); + this->schedule_i (guid, qos); } + DSUI_EVENT_LOG (DSRT_CV_DISPATCH_FAM, RELEASE_GUARD_END, int_guid, 0, NULL); return 0; } @@ -260,6 +287,12 @@ template <class DSRT_Scheduler_Traits> int DSRT_CV_Dispatcher_Impl<DSRT_Scheduler_Traits>:: update_schedule_i (Guid_t guid, const DSRT_QoSDescriptor& qos) { + int int_guid; + ACE_OS::memcpy (&int_guid, + guid.get_buffer (), + guid.length ()); + + DSUI_EVENT_LOG (DSRT_CV_DISPATCH_FAM, UPDATE_SCHEDULE_START, int_guid, 0, NULL); return this->schedule_i (guid, qos); } @@ -267,6 +300,12 @@ template <class DSRT_Scheduler_Traits> int DSRT_CV_Dispatcher_Impl<DSRT_Scheduler_Traits>:: update_schedule_i (Guid_t guid, Block_Flag_t flag) { + int int_guid; + ACE_OS::memcpy (&int_guid, + guid.get_buffer (), + guid.length ()); + + DSUI_EVENT_LOG (DSRT_CV_DISPATCH_FAM, UPDATE_SCHEDULE_START, int_guid, 0, NULL); ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, guard, this->synch_lock_, -1); #ifdef KOKYU_DSRT_LOGGING @@ -283,8 +322,8 @@ update_schedule_i (Guid_t guid, Block_Flag_t flag) if (found == 0) ACE_DEBUG ((LM_DEBUG, "(%t|%T): %d found in ready queue\n", thr_handle)); else - ACE_DEBUG ((LM_DEBUG, "(%t|%T): %d not found in ready queue\n", - thr_handle)); + ACE_DEBUG ((LM_DEBUG, "(%t|%T): %d not found in ready queue\n", + thr_handle)); #endif if (found == 0 && flag == BLOCK) @@ -295,8 +334,8 @@ update_schedule_i (Guid_t guid, Block_Flag_t flag) ACE_DEBUG ((LM_DEBUG, "(%t|%T): update schedule: %d found\n", thr_handle)); #endif - if (ACE_OS::thr_setprio (thr_handle, - this->blocked_prio_, + if (ACE_OS::thr_setprio (thr_handle, + this->blocked_prio_, this->sched_policy_) == -1) { ACE_ERROR ((LM_ERROR, @@ -316,7 +355,7 @@ update_schedule_i (Guid_t guid, Block_Flag_t flag) #ifdef KOKYU_DSRT_LOGGING ACE_DEBUG ((LM_DEBUG, "(%t): update schedule for block done\n")); #endif - + DSUI_EVENT_LOG (DSRT_CV_DISPATCH_FAM, UPDATE_SCHEDULE_END, int_guid, 0, NULL); return -1; } @@ -324,6 +363,12 @@ template <class DSRT_Scheduler_Traits> int DSRT_CV_Dispatcher_Impl<DSRT_Scheduler_Traits>:: cancel_schedule_i (Guid_t guid) { + int int_guid; + ACE_OS::memcpy (&int_guid, + guid.get_buffer (), + guid.length ()); + + DSUI_EVENT_LOG (DSRT_CV_DISPATCH_FAM, CANCEL_SCHEDULE_START, int_guid, 0, NULL); ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, guard, this->synch_lock_, -1); ACE_hthread_t thr_handle; @@ -348,6 +393,7 @@ cancel_schedule_i (Guid_t guid) ACE_GUARD_RETURN (cond_lock_t, mon, this->run_cond_lock_, 0); this->run_cond_.broadcast (); + DSUI_EVENT_LOG (DSRT_CV_DISPATCH_FAM, CANCEL_SCHEDULE_END, int_guid, 0, NULL); return 0; } @@ -355,6 +401,7 @@ template <class DSRT_Scheduler_Traits> int DSRT_CV_Dispatcher_Impl<DSRT_Scheduler_Traits>:: shutdown_i () { + DSUI_EVENT_LOG (DSRT_CV_DISPATCH_FAM, SHUTDOWN, 0, 0, NULL); this->shutdown_flagged_ = 1; return 0; } |