From aa0142b33373c6b953dbe81cd741622964b156ea Mon Sep 17 00:00:00 2001 From: storri Date: Tue, 27 Jan 2004 16:11:11 +0000 Subject: Added DSUI Changes --- Kokyu/DSRT_CV_Dispatcher_Impl_T.cpp | 97 +++++++++++++++++++++++++++---------- Kokyu/DSRT_Dispatcher_Impl_T.h | 4 ++ Kokyu/DSRT_Dispatcher_Impl_T.i | 1 + Kokyu/Dispatch_Deferrer.cpp | 11 +++-- Kokyu/Kokyu.dsui | 27 +++++++++++ Kokyu/Kokyu_dsrt.cpp | 4 ++ Kokyu/Makefile.Kokyu | 2 + Kokyu/kokyu_config.h | 1 + 8 files changed, 119 insertions(+), 28 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 int DSRT_CV_Dispatcher_Impl:: init_i (const DSRT_ConfigInfo&) { + DSUI_EVENT_LOG (DSRT_CV_DISPATCH_FAM, INIT_I, 0, 0, NULL); return 0; } template int DSRT_CV_Dispatcher_Impl:: -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* 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 (id, qos), + DSRT_Dispatch_Item (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 int DSRT_CV_Dispatcher_Impl:: 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 int DSRT_CV_Dispatcher_Impl:: 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 int DSRT_CV_Dispatcher_Impl:: 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 int DSRT_CV_Dispatcher_Impl:: 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 int DSRT_CV_Dispatcher_Impl:: shutdown_i () { + DSUI_EVENT_LOG (DSRT_CV_DISPATCH_FAM, SHUTDOWN, 0, 0, NULL); this->shutdown_flagged_ = 1; return 0; } diff --git a/Kokyu/DSRT_Dispatcher_Impl_T.h b/Kokyu/DSRT_Dispatcher_Impl_T.h index b0cf4391556..98dd1995e49 100644 --- a/Kokyu/DSRT_Dispatcher_Impl_T.h +++ b/Kokyu/DSRT_Dispatcher_Impl_T.h @@ -11,6 +11,10 @@ #include /**/ "ace/pre.h" #include "Kokyu_dsrt.h" +#include "kokyu_config.h" +#include "kokyu_dsui_families.h" +#include + #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ diff --git a/Kokyu/DSRT_Dispatcher_Impl_T.i b/Kokyu/DSRT_Dispatcher_Impl_T.i index 60ecf41a028..769ce79719f 100644 --- a/Kokyu/DSRT_Dispatcher_Impl_T.i +++ b/Kokyu/DSRT_Dispatcher_Impl_T.i @@ -8,6 +8,7 @@ ACE_INLINE int DSRT_Dispatcher_Impl:: init (const DSRT_ConfigInfo& config_info) { + DSUI_EVENT_LOG (DSRT_CV_DISPATCH_FAM, INIT2, 0, 0, NULL); return this->init_i (config_info); } diff --git a/Kokyu/Dispatch_Deferrer.cpp b/Kokyu/Dispatch_Deferrer.cpp index 3c37c39d044..9cc8ccdc706 100644 --- a/Kokyu/Dispatch_Deferrer.cpp +++ b/Kokyu/Dispatch_Deferrer.cpp @@ -8,6 +8,9 @@ #include "Dispatch_Deferrer.i" #endif /* __ACE_INLINE__ */ +#include "kokyu_config.h" +#include "kokyu_dsui_families.h" +#include ACE_RCSID(Kokyu, Dispatch_Deferrer, "$Id$") namespace Kokyu @@ -17,7 +20,7 @@ int Dispatch_Deferrer::init(const Dispatch_Deferrer_Attributes& attr) { //set up reactor for timeouts - this->react_.open(0); + this->react_.open(0); //Don't need any handles, since we're only using it for timeouts this->timers_.open(); @@ -51,13 +54,14 @@ Dispatch_Deferrer::dispatch (Dispatch_Queue_Item *qitem) //@BT INSTRUMENT with event ID: EVENT_DEFERRED_ENQUEUE Measure time //between release and enqueue into dispatch queue because of RG + DSUI_EVENT_LOG(DISP_DEFERRER_FAM, EVENT_DEFERRED_ENQUEUE, timer_id, 0, NULL); //buffer until timer expires return this->rgq_.enqueue_deadline(qitem,&tv); } -int +int Dispatch_Deferrer::handle_timeout (const ACE_Time_Value &, const void *) { @@ -91,10 +95,11 @@ Dispatch_Deferrer::handle_timeout (const ACE_Time_Value &, } //else got timer_id this->react_.cancel_timer(timer_id); - + //@BT INSTRUMENT with event ID: EVENT_DEFERRED_DEQUEUE Measure //time between release and enqueue into dispatch queue because //of RG + DSUI_EVENT_LOG (DISP_DEFERRER_FAM, EVENT_DEFERRED_DEQUEUE, timer_id, 0, NULL); this->task_->enqueue(qitem); diff --git a/Kokyu/Kokyu.dsui b/Kokyu/Kokyu.dsui index 9c164904cef..ab1e86740a1 100644 --- a/Kokyu/Kokyu.dsui +++ b/Kokyu/Kokyu.dsui @@ -1,10 +1,37 @@ +# DSRT Dispatcher Impl (DSRT_Dispatcher_Impl.cpp) +DSTRM_EVENT DSRT_DISPATCH_IMPL 10 INIT2 0 "Initialize Dispatcher object" print_string + +# Dispatcher Task (Dispatcher_Task.cpp) +DSTRM_EVENT DISP_TASK 9 EVENT_DEFERRED 3 "Time event is deferred" print_string +DSTRM_EVENT DISP_TASK 9 EVENT_FINISHED_DISPATCHING 2 "End time of dispatching event" print_string +DSTRM_EVENT DISP_TASK 9 EVENT_START_DISPATCHING 1 "Start time of actually dispatching event" print_string +DSTRM_EVENT DISP_TASK 9 EVENT_DEQUEUED 0 "Time of event duqueue" print_string + +# Dispatch Deferrer (Dispatch_Deferrer.cpp) +DSTRM_EVENT DISP_DEFERRER 8 EVENT_DEFERRED_DEQUEUE 1 "Enqueue event in dispatch queue" print_string +DSTRM_EVENT DISP_DEFERRER 8 EVENT_DEFERRED_ENQUEUE 0 "Buffer event until timer expires" print_string + # DSRT DIRECT Dispatcher (DSRT_DIRECT_Dispatcher_Impl_T.cpp) DSTRM_EVENT DSRT_DIRECT_DISPATCH 7 SCHEDULE_EXIT 1 "Exit Schedule_i" print_string DSTRM_EVENT DSRT_DIRECT_DISPATCH 7 SCHEDULE_ENTER 0 "Enter Schedule_i" print_string # DSRT CV Dispatcher (DSRT_CV_Dispatcher_Impl_T.cpp) +DSTRM_EVENT DSRT_CV_DISPATCH 6 INIT 13 "Enter DSRT_Dispatcher_Impl init" print_string +DSTRM_EVENT DSRT_CV_DISPATCH 6 SHUTDOWN 12 "Enter shutdown_i function" print_string +DSTRM_EVENT DSRT_CV_DISPATCH 6 CANCEL_SCHEDULE_END 11 "Exit cancel_schedule_i function" print_string +DSTRM_EVENT DSRT_CV_DISPATCH 6 CANCEL_SCHEDULE_START 10 "Enter cancel_schedule_i function" print_string +DSTRM_EVENT DSRT_CV_DISPATCH 6 UPDATE_SCHEDULE_END 9 "Exit update_schedule_i function" print_string +DSTRM_EVENT DSRT_CV_DISPATCH 6 UPDATE_SCHEDULE_START 8 "Enter update_schedule_i function" print_string +DSTRM_EVENT DSRT_CV_DISPATCH 6 RELEASE_GUARD_END 7 "Exit release_guard_i function" print_string +DSTRM_EVENT DSRT_CV_DISPATCH 6 RELEASE_GUARD_START 6 "Enter release_guard_i function" print_string +DSTRM_EVENT DSRT_CV_DISPATCH 6 INIT_I 5 "Initialization" print_string +DSTRM_EVENT DSRT_CV_DISPATCH 6 NONRG_EVENT_RELEASED 4 "Event release time on the server side" print_string +DSTRM_EVENT DSRT_CV_DISPATCH 6 RG_DELAYED_EVENT_RELEASED 3 "Event delayed by release guard release time on the server side" print_string +DSTRM_EVENT DSRT_CV_DISPATCH 6 RG_EVENT_RELEASED 2 "Release guard Event release time on the server side" print_string DSTRM_EVENT DSRT_CV_DISPATCH 6 SCHEDULE_EXIT 1 "Exit Schedule_i" print_string DSTRM_EVENT DSRT_CV_DISPATCH 6 SCHEDULE_ENTER 0 "Enter Schedule_i" print_string # DSRT_Dispatcher (Kokyu_dsrt.cpp) +DSTRM_EVENT DSRT_DISPATCH 5 CREATE_DSRT_DISPATCH_SCHED_END 2 "Done creating appropriate Scheduler" print_string +DSTRM_EVENT DSRT_DISPATCH 5 CREATE_DSRT_DISPATCH_SCHED_START 1 "Create appropriate Scheduler" print_string DSTRM_EVENT DSRT_DISPATCH 5 SCHEDULE 0 "Schedule task" print_string diff --git a/Kokyu/Kokyu_dsrt.cpp b/Kokyu/Kokyu_dsrt.cpp index 8bf0ddb2941..ca3d567c81a 100644 --- a/Kokyu/Kokyu_dsrt.cpp +++ b/Kokyu/Kokyu_dsrt.cpp @@ -76,6 +76,7 @@ DSRT_Dispatcher_Factory:: create_DSRT_dispatcher (const DSRT_ConfigInfo& config_info) { ACE_UNUSED_ARG ((config_info)); + DSUI_EVENT_LOG (DSRT_DISPATCH_FAM, CREATE_DSRT_DISPATCH_SCHED_START, 0, 0, NULL); DSRT_Dispatcher_Impl* tmp; DSRT_Dispatcher* disp; @@ -113,6 +114,9 @@ create_DSRT_dispatcher (const DSRT_ConfigInfo& config_info) DSRT_Dispatcher_Auto_Ptr disp_auto_ptr(disp); disp->implementation (tmp); tmp->init (config_info); + + DSUI_EVENT_LOG (DSRT_DISPATCH_FAM, CREATE_DSRT_DISPATCH_SCHED_END, 0, 0, NULL); + return disp_auto_ptr; } diff --git a/Kokyu/Makefile.Kokyu b/Kokyu/Makefile.Kokyu index b2a26f07d68..dc1ea62bc87 100644 --- a/Kokyu/Makefile.Kokyu +++ b/Kokyu/Makefile.Kokyu @@ -34,6 +34,8 @@ include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU include $(ACE_ROOT)/include/makeinclude/rules.lib.GNU include $(ACE_ROOT)/include/makeinclude/rules.local.GNU +CPPFLAGS += -DKOKYU_DSRT_LOGGING + CPPFLAGS += -I.. -I$(DATASTREAM_ROOT)/include LDFLAGS += -L../ace -L$(DATASTREAM_ROOT)/lib diff --git a/Kokyu/kokyu_config.h b/Kokyu/kokyu_config.h index 111ee99ac7c..4eab747376e 100644 --- a/Kokyu/kokyu_config.h +++ b/Kokyu/kokyu_config.h @@ -5,5 +5,6 @@ #define CONFIG_DSTREAM_DSRT_DISPATCH #define CONFIG_DSTREAM_DSRT_CV_DISPATCH #define CONFIG_DSTREAM_DSRT_DIRECT_DISPATCH +#define CONFIG_DSTREAM_DSRT_DISPATCH_IMPL #endif /* KOKYU_CONFIG_H */ -- cgit v1.2.1