summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryamuna <yamuna@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-06-26 23:16:55 +0000
committeryamuna <yamuna@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-06-26 23:16:55 +0000
commit2493fac75426a084057026c89bc993f66092a8bb (patch)
tree3042dda49a3cd2c2270bd1bc1bcbbec2433f9323
parent79026a7ef76b54b1564374034db43f85843f162a (diff)
downloadATCD-2493fac75426a084057026c89bc993f66092a8bb.tar.gz
*** empty log message ***
-rw-r--r--TAO/examples/RTScheduling/MIF_Scheduler/MIF_DT_Creator.cpp41
-rw-r--r--TAO/examples/RTScheduling/MIF_Scheduler/MIF_DT_Creator.h8
-rw-r--r--TAO/examples/RTScheduling/MIF_Scheduler/MIF_Scheduler.cpp377
-rw-r--r--TAO/examples/RTScheduling/MIF_Scheduler/MIF_Scheduler.dsp120
-rw-r--r--TAO/examples/RTScheduling/MIF_Scheduler/MIF_Scheduler.h52
-rw-r--r--TAO/examples/RTScheduling/MIF_Scheduler/MIF_Task.cpp107
-rw-r--r--TAO/examples/RTScheduling/MIF_Scheduler/MIF_Task.h3
-rw-r--r--TAO/examples/RTScheduling/MIF_Scheduler/test.cpp97
-rw-r--r--TAO/examples/RTScheduling/MIF_Scheduler/test.h12
9 files changed, 583 insertions, 234 deletions
diff --git a/TAO/examples/RTScheduling/MIF_Scheduler/MIF_DT_Creator.cpp b/TAO/examples/RTScheduling/MIF_Scheduler/MIF_DT_Creator.cpp
index f8e96827e2c..1685b680018 100644
--- a/TAO/examples/RTScheduling/MIF_Scheduler/MIF_DT_Creator.cpp
+++ b/TAO/examples/RTScheduling/MIF_Scheduler/MIF_DT_Creator.cpp
@@ -9,16 +9,22 @@ MIF_DT_Creator::MIF_DT_Creator (void)
DT_TEST::instance ()->dt_creator (this);
}
-Thread_Task*
+Thread_Task*
MIF_DT_Creator::create_thr_task (int importance,
int start_time,
- int load)
+ int load,
+ int iter,
+ int dist,
+ char *job_name)
{
MIF_Task* task;
- ACE_NEW_RETURN (task,
+ ACE_NEW_RETURN (task,
MIF_Task (importance,
start_time,
load,
+ iter,
+ dist,
+ job_name,
this),
0);
return task;
@@ -34,25 +40,43 @@ void
MIF_DT_Creator::yield (int suspend_time,
Thread_Task*)
{
-
+ //ACE_Time_Value suspend (suspend_time);
ACE_Time_Value now (ACE_OS::gettimeofday ());
- while ((now - *base_time_) < suspend_time || suspend_time == 1)
+ while (((now - *base_time_) < suspend_time) || (suspend_time == 1))
{
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "Before perform Work\n"));
+
+ ACE_Time_Value wait (1);
+ orb_->perform_work (wait);
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "After perform Work\n"));
+
CORBA::Policy_var sched_param;
sched_param = CORBA::Policy::_duplicate (this->sched_param (100));
const char * name = 0;
CORBA::Policy_ptr implicit_sched_param = 0;
current_->update_scheduling_segment (name,
sched_param.in (),
- implicit_sched_param
+ sched_param.in ()
ACE_ENV_ARG_DECL);
ACE_CHECK;
now = ACE_OS::gettimeofday ();
if (suspend_time == 1)
- break;
+ break;
+
}
}
+int
+MIF_DT_Creator::total_load (void)
+{
+ return 1000;
+}
+
ACE_STATIC_SVC_DEFINE(MIF_DT_Creator,
ACE_TEXT ("MIF_DT_Creator"),
ACE_SVC_OBJ_T,
@@ -61,6 +85,3 @@ ACE_STATIC_SVC_DEFINE(MIF_DT_Creator,
0)
ACE_FACTORY_DEFINE (MIF_DT_Creator, MIF_DT_Creator)
-
-
-
diff --git a/TAO/examples/RTScheduling/MIF_Scheduler/MIF_DT_Creator.h b/TAO/examples/RTScheduling/MIF_Scheduler/MIF_DT_Creator.h
index d116046a6a6..23474fefef0 100644
--- a/TAO/examples/RTScheduling/MIF_Scheduler/MIF_DT_Creator.h
+++ b/TAO/examples/RTScheduling/MIF_Scheduler/MIF_DT_Creator.h
@@ -17,10 +17,15 @@ public:
//virtual Task* task (void);
virtual Thread_Task* create_thr_task (int importance,
int start_time,
- int load);
+ int load,
+ int iter,
+ int dist,
+ char *job_name);
virtual void yield (int suspend_time,
Thread_Task* task);
+
+ virtual int total_load (void);
};
@@ -28,3 +33,4 @@ ACE_STATIC_SVC_DECLARE_EXPORT (MIF_DT_Creator, MIF_DT_Creator)
ACE_FACTORY_DECLARE (MIF_DT_Creator, MIF_DT_Creator)
#endif /*MIF_DT_CREATOR_H*/
+
diff --git a/TAO/examples/RTScheduling/MIF_Scheduler/MIF_Scheduler.cpp b/TAO/examples/RTScheduling/MIF_Scheduler/MIF_Scheduler.cpp
index 0f83f14cf33..d42213ce512 100644
--- a/TAO/examples/RTScheduling/MIF_Scheduler/MIF_Scheduler.cpp
+++ b/TAO/examples/RTScheduling/MIF_Scheduler/MIF_Scheduler.cpp
@@ -2,6 +2,8 @@
#include "MIF_Scheduler.h"
#include "ace/Atomic_Op.h"
+#include "tao/RTScheduling/Request_Interceptor.h"
+#include "test.h"
ACE_Atomic_Op<ACE_Thread_Mutex, long> server_guid_counter;
@@ -29,14 +31,14 @@ DT::resume (void)
this->dt_cond_.signal ();
}
-CORBA::Short
+CORBA::Short
Segment_Sched_Param_Policy::importance (void)
ACE_THROW_SPEC ((CORBA::SystemException))
{
return this->importance_;
}
-void
+void
Segment_Sched_Param_Policy::importance (CORBA::Short importance)
ACE_THROW_SPEC ((CORBA::SystemException))
{
@@ -44,17 +46,18 @@ Segment_Sched_Param_Policy::importance (CORBA::Short importance)
}
MIF_Scheduler::MIF_Scheduler (CORBA::ORB_ptr orb)
- : wait_cond_ (lock_)
+ : wait_cond_ (lock_),
+ wait_ (0)
{
CORBA::Object_var object =
- orb->resolve_initial_references ("RTScheduler_Current"
+ orb->resolve_initial_references ("RTScheduler_Current"
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
-
+
this->current_ =
RTScheduling::Current::_narrow (object.in () ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
-
+
// state_lock_ = new ACE_Lock_Adapter <TAO_SYNCH_MUTEX>;
wait_ = 0;
@@ -67,15 +70,30 @@ MIF_Scheduler::~MIF_Scheduler (void)
void
MIF_Scheduler::incr_thr_count (void)
{
+ lock_.acquire ();
wait_++;
+ ACE_DEBUG ((LM_DEBUG,
+ "Incr Thread Count %d\n",
+ wait_));
+ lock_.release ();
}
void
MIF_Scheduler::wait (void)
{
lock_.acquire ();
- while (wait_.value_i () > 0)
+
+ ACE_DEBUG ((LM_DEBUG,
+ "Before Wait %d\n",
+ wait_));
+
+ while (wait_ > 0)
wait_cond_.wait ();
+
+ ACE_DEBUG ((LM_DEBUG,
+ "After Wait %d\n",
+ wait_));
+
lock_.release ();
}
@@ -86,7 +104,7 @@ MIF_Scheduler::resume_main (void)
wait_cond_.signal ();
}
-MIF_Scheduling::SegmentSchedulingParameterPolicy_ptr
+MIF_Scheduling::SegmentSchedulingParameterPolicy_ptr
MIF_Scheduler::create_segment_scheduling_parameter (CORBA::Short importance)
ACE_THROW_SPEC ((CORBA::SystemException))
{
@@ -105,8 +123,8 @@ MIF_Scheduler::create_segment_scheduling_parameter (CORBA::Short importance)
}
-
-void
+
+void
MIF_Scheduler::begin_new_scheduling_segment (const RTScheduling::Current::IdType &/*guid*/,
const char *,
CORBA::Policy_ptr sched_policy,
@@ -120,20 +138,29 @@ MIF_Scheduler::begin_new_scheduling_segment (const RTScheduling::Current::IdType
this->current_->id ()->get_buffer (),
this->current_->id ()->length ());
- if (count != 1)
+
+ MIF_Scheduling::SegmentSchedulingParameterPolicy_var sched_param =
+ MIF_Scheduling::SegmentSchedulingParameterPolicy::_narrow (sched_policy);
+
+ CORBA::Short desired_priority = sched_param->importance ();
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "%t MIF_Scheduler::begin_scheduling_segment - Importance %d\n",
+ desired_priority));
+
+
+ if (desired_priority != 100)
{
//NOT Main Thread
- MIF_Scheduling::SegmentSchedulingParameterPolicy_var sched_param =
- MIF_Scheduling::SegmentSchedulingParameterPolicy::_narrow (sched_policy);
-
- CORBA::Short desired_priority = sched_param->importance ();
DT* new_dt;
ACE_NEW (new_dt,
DT (this->lock_,
count));
-
+
new_dt->msg_priority (desired_priority);
-
+ lock_.acquire ();
+ /*
if (wait_que_.message_count () > 0)
{
DT* main_dt;
@@ -142,21 +169,41 @@ MIF_Scheduler::begin_new_scheduling_segment (const RTScheduling::Current::IdType
main_dt = ACE_dynamic_cast (DT*, msg);
main_dt->resume ();
}
+ */
+ /*
+ if (ready_que_.message_count () > 0)
+ {
+ DT* main_dt;
+ ACE_Message_Block* msg;
+ ready_que_.dequeue_head (msg);
+ main_dt = ACE_dynamic_cast (DT*, msg);
+ if (main_dt->msg_priority () >= new_dt->msg_priority ())
+ {
+ main_dt->resume ();
+ ready_que_.enqueue_prio (new_dt);
+ new_dt->suspend ();
+ }
+ else
+ {
+ ready_que_.enqueue_prio (main_dt);
+ delete new_dt;
+ }
+ }
+ */
ready_que_.enqueue_prio (new_dt);
- lock_.acquire ();
resume_main ();
new_dt->suspend ();
lock_.release ();
}
}
-void
+void
MIF_Scheduler::begin_nested_scheduling_segment (const RTScheduling::Current::IdType &guid,
const char *name,
CORBA::Policy_ptr sched_param,
CORBA::Policy_ptr implicit_sched_param
ACE_ENV_ARG_DECL)
- ACE_THROW_SPEC ((CORBA::SystemException,
+ ACE_THROW_SPEC ((CORBA::SystemException,
RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE))
{
this->begin_new_scheduling_segment (guid,
@@ -167,48 +214,61 @@ MIF_Scheduler::begin_nested_scheduling_segment (const RTScheduling::Current::IdT
ACE_CHECK;
}
-void
+void
MIF_Scheduler::update_scheduling_segment (const RTScheduling::Current::IdType &/*guid*/,
- const char */*name*/,
+ const char* /*name*/,
CORBA::Policy_ptr sched_policy,
CORBA::Policy_ptr /*implicit_sched_param*/
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE))
{
- int count ;
+ int count;
ACE_OS::memcpy (&count,
this->current_->id ()->get_buffer (),
this->current_->id ()->length ());
- MIF_Scheduling::SegmentSchedulingParameterPolicy_var sched_param =
+ MIF_Scheduling::SegmentSchedulingParameterPolicy_var sched_param =
MIF_Scheduling::SegmentSchedulingParameterPolicy::_narrow (sched_policy);
-
+
CORBA::Short desired_priority = sched_param->importance ();
-
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "%t MIF_Scheduler::update_scheduling_segment - Importance %d\n",
+ desired_priority));
+
DT* new_dt;
ACE_NEW (new_dt,
DT (this->lock_,
count));
-
+
new_dt->msg_priority (desired_priority);
- if (count == 1)
+ if (ready_que_.message_count () > 0)
{
- if (ready_que_.message_count () > 0)
+ DT* run_dt;
+ ACE_Message_Block* msg;
+ ready_que_.dequeue_head (msg);
+ run_dt = ACE_dynamic_cast (DT*, msg);
+ //wait_que_.enqueue_prio (new_dt);
+ if ((desired_priority == 100) || run_dt->msg_priority () >= (unsigned int)desired_priority)
{
- DT* run_dt;
- ACE_Message_Block* msg;
- ready_que_.dequeue_head (msg);
- run_dt = ACE_dynamic_cast (DT*, msg);
- wait_que_.enqueue_prio (new_dt);
+ ready_que_.enqueue_prio (new_dt);
lock_.acquire ();
run_dt->resume ();
new_dt->suspend ();
lock_.release ();
}
- else delete new_dt;
+ else
+ {
+ ready_que_.enqueue_prio (run_dt);
+ delete new_dt;
+ }
}
+ else delete new_dt;
+ //}
+ /*
else
{
if (wait_que_.message_count () > 0)
@@ -223,8 +283,11 @@ MIF_Scheduler::update_scheduling_segment (const RTScheduling::Current::IdType &/
new_dt->suspend ();
lock_.release ();
}
- else
+ else
{
+ ACE_DEBUG ((LM_DEBUG,
+ "It reached here\n"));
+
if (ready_que_.message_count() > 0)
{
DT* run_dt;
@@ -239,27 +302,30 @@ MIF_Scheduler::update_scheduling_segment (const RTScheduling::Current::IdType &/
new_dt->suspend ();
lock_.release ();
}
- else
+ else
{
ready_que_.enqueue_prio (run_dt);
}
}
}
}
+ */
}
-
-void
+
+void
MIF_Scheduler::end_scheduling_segment (const RTScheduling::Current::IdType &guid,
const char *
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
+ ACE_DEBUG ((LM_DEBUG,
+ "MIF_Scheduler::end_scheduling_segment\n"));
int count;
ACE_OS::memcpy (&count,
guid.get_buffer (),
guid.length ());
-
- if (wait_que_.message_count () > 0)
+ /*
+ if (wait_que_.message_count () > 0)
{
DT* run_dt;
ACE_Message_Block* msg;
@@ -269,7 +335,8 @@ MIF_Scheduler::end_scheduling_segment (const RTScheduling::Current::IdType &guid
run_dt->resume ();
lock_.release ();
}
- else if (ready_que_.message_count () > 0)
+ */
+ if (ready_que_.message_count () > 0)
{
DT* run_dt;
ACE_Message_Block* msg;
@@ -281,81 +348,210 @@ MIF_Scheduler::end_scheduling_segment (const RTScheduling::Current::IdType &guid
}
}
-void
+void
MIF_Scheduler::end_nested_scheduling_segment (const RTScheduling::Current::IdType &,
const char *,
CORBA::Policy_ptr
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
-
+
}
-
-void
-MIF_Scheduler::send_request (PortableInterceptor::ClientRequestInfo_ptr
+
+void
+MIF_Scheduler::send_request (PortableInterceptor::ClientRequestInfo_ptr request_info
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
PortableInterceptor::ForwardRequest))
{
+ MIF_Scheduling::SegmentSchedulingParameterPolicy_var sched_param_var =
+ MIF_Scheduling::SegmentSchedulingParameterPolicy::_narrow (current_->scheduling_parameter (ACE_ENV_SINGLE_ARG_PARAMETER));
+ ACE_CHECK;
+
+ IOP::ServiceContext* srv_con = new IOP::ServiceContext;
+ srv_con->context_id = Client_Interceptor::SchedulingInfo;
+
+ int guid_length = current_->id (ACE_ENV_ARG_PARAMETER)->length ();
+ ACE_CHECK;
+
+ RTScheduling::Current::IdType* guid = current_->id (ACE_ENV_ARG_PARAMETER);
+
+ CORBA::Octet *seq_buf = CORBA::OctetSeq::allocbuf (sizeof (guid_length));
+ ACE_OS::memcpy (seq_buf,
+ guid->get_buffer (),
+ guid_length);
+
+ int cxt_data_length = sizeof (int) + guid_length;
+ srv_con->context_data.length (cxt_data_length);
+
+ int i = 0;
+ for (;i < guid_length;i++)
+ {
+ srv_con->context_data [i] = seq_buf [i];
+ }
+
+ int importance = sched_param_var->importance ();
+ CORBA::Octet *int_buf = CORBA::OctetSeq::allocbuf (sizeof (int));
+ ACE_OS::memcpy (int_buf,
+ &importance,
+ sizeof (int));
+
+ int j = 0;
+ for (;i < cxt_data_length;i++)
+ {
+ srv_con->context_data [i] = int_buf [j++];
+ }
+
+ request_info->add_request_service_context (*srv_con,
+ 0
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
}
-void
-MIF_Scheduler::receive_request (PortableInterceptor::ServerRequestInfo_ptr,
+void
+MIF_Scheduler::receive_request (PortableInterceptor::ServerRequestInfo_ptr request_info,
RTScheduling::Current::IdType_out guid_out,
- CORBA::String_out /*name*/,
- CORBA::Policy_out /*sched_param*/,
+ CORBA::String_out,
+ CORBA::Policy_out sched_param_out,
CORBA::Policy_out /*implicit_sched_param*/
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
PortableInterceptor::ForwardRequest))
{
- //***************************************
+ ACE_DEBUG ((LM_DEBUG,
+ "MIF_Scheduler::receive_request\n"));
+
+ IOP::ServiceContext* serv_cxt =
+ request_info->get_request_service_context (Server_Interceptor::SchedulingInfo);
+
RTScheduling::Current::IdType* guid;
ACE_NEW (guid,
RTScheduling::Current::IdType);
-
-
- // Generate GUID.
+
guid->length (sizeof(long));
-
- long temp = ++server_guid_counter;
ACE_OS::memcpy (guid->get_buffer (),
- &temp,
- sizeof(long));
-
- int id;
- ACE_OS::memcpy (&id,
+ serv_cxt->context_data.get_buffer (),
+ sizeof (long));
+
+ int gu_id;
+ ACE_OS::memcpy (&gu_id,
guid->get_buffer (),
guid->length ());
-
- // ACE_DEBUG ((LM_DEBUG,
-// "The Guid is %d %d\n",
-// id,
-// server_guid_counter.value_i ()));
+
+ CORBA::Octet *int_buf = CORBA::OctetSeq::allocbuf (sizeof (long));
+ int i = sizeof (long);
+ for (unsigned int j = 0;j < sizeof (int);j++)
+ {
+ int_buf [j] = serv_cxt->context_data [i++];
+ }
+
+ int importance;
+ ACE_OS::memcpy (&importance,
+ int_buf,
+ sizeof (int));
guid_out.ptr () = guid;
- //***************************************
-
-
+ sched_param_out.ptr () = DT_TEST::instance ()->scheduler ()->create_segment_scheduling_parameter (importance);
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "%t The Guid is %d Importance is %d\n",
+ gu_id,
+ importance));
+
+ DT* new_dt;
+ ACE_NEW (new_dt,
+ DT (this->lock_,
+ gu_id));
+
+ new_dt->msg_priority (importance);
+
+ lock_.acquire ();
+ if (wait_que_.message_count () > 0)
+ {
+ DT* main_dt;
+ ACE_Message_Block* msg;
+ wait_que_.dequeue_head (msg);
+ main_dt = ACE_dynamic_cast (DT*, msg);
+ main_dt->resume ();
+ }
+ ready_que_.enqueue_prio (new_dt);
+ //resume_main ();
+ new_dt->suspend ();
+ lock_.release ();
+
}
-void
+void
MIF_Scheduler::send_reply (PortableInterceptor::ServerRequestInfo_ptr
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
+ /*
+ RTScheduling::Current::IdType* guid = current_->id (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ int count;
+ ACE_OS::memcpy (&count,
+ guid->get_buffer (),
+ guid->length ());
+ */
+
+ if (wait_que_.message_count () > 0)
+ {
+ DT* run_dt;
+ ACE_Message_Block* msg;
+ wait_que_.dequeue_head (msg);
+ run_dt = ACE_dynamic_cast (DT*, msg);
+ lock_.acquire ();
+ run_dt->resume ();
+ lock_.release ();
+ }
+ /*
+ else if (ready_que_.message_count () > 0)
+ {
+ DT* run_dt;
+ ACE_Message_Block* msg;
+ ready_que_.dequeue_head (msg);
+ run_dt = ACE_dynamic_cast (DT*, msg);
+ lock_.acquire ();
+ run_dt->resume ();
+ lock_.release ();
+ }
+ */
}
-void
+void
MIF_Scheduler::send_exception (PortableInterceptor::ServerRequestInfo_ptr
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
PortableInterceptor::ForwardRequest))
{
+ if (wait_que_.message_count () > 0)
+ {
+ DT* run_dt;
+ ACE_Message_Block* msg;
+ wait_que_.dequeue_head (msg);
+ run_dt = ACE_dynamic_cast (DT*, msg);
+ lock_.acquire ();
+ run_dt->resume ();
+ lock_.release ();
+ }
+ else if (ready_que_.message_count () > 0)
+ {
+ DT* run_dt;
+ ACE_Message_Block* msg;
+ ready_que_.dequeue_head (msg);
+ run_dt = ACE_dynamic_cast (DT*, msg);
+ lock_.acquire ();
+ run_dt->resume ();
+ lock_.release ();
+ }
+
}
-void
+void
MIF_Scheduler::send_other (PortableInterceptor::ServerRequestInfo_ptr
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
@@ -363,14 +559,15 @@ MIF_Scheduler::send_other (PortableInterceptor::ServerRequestInfo_ptr
{
}
-void
+void
MIF_Scheduler::receive_reply (PortableInterceptor::ClientRequestInfo_ptr
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
+
}
-
-void
+
+void
MIF_Scheduler::receive_exception (PortableInterceptor::ClientRequestInfo_ptr
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
@@ -378,50 +575,50 @@ MIF_Scheduler::receive_exception (PortableInterceptor::ClientRequestInfo_ptr
{
}
-void
+void
MIF_Scheduler::receive_other (PortableInterceptor::ClientRequestInfo_ptr
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
PortableInterceptor::ForwardRequest))
{
}
-
-void
+
+void
MIF_Scheduler::cancel (const RTScheduling::Current::IdType &
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
}
-CORBA::PolicyList*
+CORBA::PolicyList*
MIF_Scheduler::scheduling_policies (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
return 0;
}
-
-void
+
+void
MIF_Scheduler::scheduling_policies (const CORBA::PolicyList &
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
}
-
-CORBA::PolicyList*
+
+CORBA::PolicyList*
MIF_Scheduler::poa_policies (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
return 0;
}
-
-char *
+
+char *
MIF_Scheduler::scheduling_discipline_name (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
return 0;
}
-
-RTScheduling::ResourceManager_ptr
+
+RTScheduling::ResourceManager_ptr
MIF_Scheduler::create_resource_manager (const char *,
CORBA::Policy_ptr
ACE_ENV_ARG_DECL)
@@ -429,8 +626,8 @@ MIF_Scheduler::create_resource_manager (const char *,
{
return 0;
}
-
-void
+
+void
MIF_Scheduler::set_scheduling_parameter (PortableServer::Servant &,
const char *,
CORBA::Policy_ptr
diff --git a/TAO/examples/RTScheduling/MIF_Scheduler/MIF_Scheduler.dsp b/TAO/examples/RTScheduling/MIF_Scheduler/MIF_Scheduler.dsp
index e054f014985..2721ac41000 100644
--- a/TAO/examples/RTScheduling/MIF_Scheduler/MIF_Scheduler.dsp
+++ b/TAO/examples/RTScheduling/MIF_Scheduler/MIF_Scheduler.dsp
@@ -65,7 +65,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /Gm /GX /Zi /Od /I "../../../../" /I "../../../" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "MIF_DT_CREATOR_BUILD_DLL" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /Gm /GX /Zi /Od /I "../../../../" /I "../../../" /I "../../../tao/RTScheduling" /I "../../../tao/RTCORBA" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "MIF_DT_CREATOR_BUILD_DLL" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
@@ -73,7 +73,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib aced.lib taod.lib TAO_RTCORBAd.lib TAO_PortableServerd.lib TAO_RTSchedulerd.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"$(ACE_ROOT)\ace" /libpath:"../../../tao" /libpath:"../../../tao/RTCORBA" /libpath:"../../../tao/PortableServer" /libpath:"../../../tao/RTScheduling"
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib aced.lib taod.lib TAO_RTCORBAd.lib TAO_PortableServerd.lib TAO_RTSchedulerd.lib TAO_CosNamingd.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"$(ACE_ROOT)\ace" /libpath:"../../../tao" /libpath:"../../../tao/RTCORBA" /libpath:"../../../tao/PortableServer" /libpath:"../../../tao/RTScheduling" /libpath:"../../../orbsvcs/orbsvcs/"
!ENDIF
@@ -83,13 +83,25 @@ LINK32=link.exe
# Name "MIF_Scheduler - Win32 Debug"
# Begin Group "Source Files"
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat"
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\DT_Creator.cpp
# End Source File
# Begin Source File
+SOURCE=..\Job_i.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\JobC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\JobS.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\MIF_DT_Creator.cpp
# End Source File
# Begin Source File
@@ -98,7 +110,7 @@ SOURCE=.\MIF_Scheduler.cpp
# End Source File
# Begin Source File
-SOURCE=.\MIF_SchedulingC.cpp
+SOURCE=..\MIF_SchedulingC.cpp
# End Source File
# Begin Source File
@@ -106,6 +118,22 @@ SOURCE=.\MIF_Task.cpp
# End Source File
# Begin Source File
+SOURCE=..\POA_Holder.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\Synch_i.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\SynchC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\SynchS.cpp
+# End Source File
+# Begin Source File
+
SOURCE=..\Task_Stats.cpp
# End Source File
# Begin Source File
@@ -126,15 +154,31 @@ SOURCE=..\DT_Creator.h
# End Source File
# Begin Source File
+SOURCE=..\Job_i.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\JobC.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\JobS.h
+# End Source File
+# Begin Source File
+
SOURCE=.\MIF_DT_Creator.h
# End Source File
# Begin Source File
+SOURCE=.\mif_dt_creator_export.h
+# End Source File
+# Begin Source File
+
SOURCE=.\MIF_Scheduler.h
# End Source File
# Begin Source File
-SOURCE=.\MIF_SchedulingC.h
+SOURCE=..\MIF_SchedulingC.h
# End Source File
# Begin Source File
@@ -142,6 +186,22 @@ SOURCE=.\MIF_Task.h
# End Source File
# Begin Source File
+SOURCE=..\POA_Holder.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\Synch_i.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\SynchC.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\SynchS.h
+# End Source File
+# Begin Source File
+
SOURCE=..\Task.h
# End Source File
# Begin Source File
@@ -165,55 +225,5 @@ SOURCE=..\Thread_Task.h
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
-# Begin Group "IDL Files"
-
-# PROP Default_Filter "idl;pidl"
-# Begin Source File
-
-SOURCE=.\MIF_Scheduling.pidl
-
-!IF "$(CFG)" == "MIF_Scheduler - Win32 Release"
-
-!ELSEIF "$(CFG)" == "MIF_Scheduler - Win32 Debug"
-
-# Begin Custom Build
-InputPath=.\MIF_Scheduling.pidl
-InputName=MIF_Scheduling
-
-BuildCmds= \
- ..\..\..\..\bin\tao_idl -Sc -Ge 1 $(InputName).pidl
-
-"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputName)S_T.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputName)S_T.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputName)S_T.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# End Group
# End Target
# End Project
diff --git a/TAO/examples/RTScheduling/MIF_Scheduler/MIF_Scheduler.h b/TAO/examples/RTScheduling/MIF_Scheduler/MIF_Scheduler.h
index 33038fec7fc..16332c64c33 100644
--- a/TAO/examples/RTScheduling/MIF_Scheduler/MIF_Scheduler.h
+++ b/TAO/examples/RTScheduling/MIF_Scheduler/MIF_Scheduler.h
@@ -4,7 +4,7 @@
#define MIF_SCHEDULER_H
#include "tao/RTScheduling/RTSchedulerC.h"
-#include "MIF_SchedulingC.h"
+#include "../MIF_SchedulingC.h"
#include "ace/Message_Queue.h"
#include "ace/Atomic_Op.h"
@@ -31,10 +31,10 @@ public MIF_Scheduling::SegmentSchedulingParameterPolicy,
public:
virtual CORBA::Short importance (void)
ACE_THROW_SPEC ((CORBA::SystemException));
-
+
virtual void importance (CORBA::Short importance)
ACE_THROW_SPEC ((CORBA::SystemException));
-
+
private:
CORBA::Short importance_;
};
@@ -46,13 +46,13 @@ public MIF_Scheduling::MIF_Scheduler,
public TAO_Local_RefCounted_Object
{
public:
-
+
MIF_Scheduler (CORBA::ORB_ptr orb);
~MIF_Scheduler (void);
-
- virtual MIF_Scheduling::SegmentSchedulingParameterPolicy_ptr
+
+ virtual MIF_Scheduling::SegmentSchedulingParameterPolicy_ptr
create_segment_scheduling_parameter (CORBA::Short segment_priority)
ACE_THROW_SPEC ((CORBA::SystemException));
@@ -69,15 +69,15 @@ public TAO_Local_RefCounted_Object
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((CORBA::SystemException,
RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE));
-
+
virtual void begin_nested_scheduling_segment (const RTScheduling::Current::IdType & guid,
const char * name,
CORBA::Policy_ptr sched_param,
CORBA::Policy_ptr implicit_sched_param
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
- ACE_THROW_SPEC ((CORBA::SystemException,
+ ACE_THROW_SPEC ((CORBA::SystemException,
RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE));
-
+
virtual void update_scheduling_segment (const RTScheduling::Current::IdType & guid,
const char * name,
CORBA::Policy_ptr sched_param,
@@ -85,12 +85,12 @@ public TAO_Local_RefCounted_Object
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((CORBA::SystemException,
RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE));
-
+
virtual void end_scheduling_segment (const RTScheduling::Current::IdType & guid,
const char * name
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((CORBA::SystemException));
-
+
virtual void end_nested_scheduling_segment (const RTScheduling::Current::IdType & guid,
const char * name,
CORBA::Policy_ptr outer_sched_param
@@ -110,7 +110,7 @@ public TAO_Local_RefCounted_Object
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((CORBA::SystemException,
PortableInterceptor::ForwardRequest));
-
+
virtual void send_reply (PortableInterceptor::ServerRequestInfo_ptr ri
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((CORBA::SystemException));
@@ -119,48 +119,48 @@ public TAO_Local_RefCounted_Object
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((CORBA::SystemException,
PortableInterceptor::ForwardRequest));
-
+
virtual void send_other (PortableInterceptor::ServerRequestInfo_ptr ri
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((CORBA::SystemException,
PortableInterceptor::ForwardRequest));
-
+
virtual void receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((CORBA::SystemException));
-
+
virtual void receive_exception (PortableInterceptor::ClientRequestInfo_ptr ri
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((CORBA::SystemException,
PortableInterceptor::ForwardRequest));
-
+
virtual void receive_other (PortableInterceptor::ClientRequestInfo_ptr ri
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((CORBA::SystemException,
PortableInterceptor::ForwardRequest));
-
+
virtual void cancel (const RTScheduling::Current::IdType & guid
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((CORBA::SystemException));
virtual CORBA::PolicyList * scheduling_policies (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((CORBA::SystemException));
-
+
virtual void scheduling_policies (const CORBA::PolicyList & scheduling_policies
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((CORBA::SystemException));
-
+
virtual CORBA::PolicyList * poa_policies (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((CORBA::SystemException));
-
+
virtual char * scheduling_discipline_name (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((CORBA::SystemException));
-
+
virtual RTScheduling::ResourceManager_ptr create_resource_manager (const char * name,
CORBA::Policy_ptr scheduling_parameter
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((CORBA::SystemException));
-
+
virtual void set_scheduling_parameter (PortableServer::Servant & resource,
const char * name,
CORBA::Policy_ptr scheduling_parameter
@@ -169,15 +169,13 @@ public TAO_Local_RefCounted_Object
private:
RTScheduling::Current_var current_;
- ACE_Thread_Mutex lock_;
+ ACE_Thread_Mutex lock_;
ACE_Thread_Mutex wait_lock_;
ACE_Condition_Thread_Mutex wait_cond_;
DT_Message_Queue ready_que_;
DT_Message_Queue wait_que_;
- ACE_Atomic_Op<ACE_Thread_Mutex, int> wait_;
+ // ACE_Atomic_Op<ACE_Thread_Mutex, long> wait_;
+ int wait_;
};
#endif //MIF_SCHEDULER_H
-
-
-
diff --git a/TAO/examples/RTScheduling/MIF_Scheduler/MIF_Task.cpp b/TAO/examples/RTScheduling/MIF_Scheduler/MIF_Task.cpp
index c064d79b335..c3d4c7ab49d 100644
--- a/TAO/examples/RTScheduling/MIF_Scheduler/MIF_Task.cpp
+++ b/TAO/examples/RTScheduling/MIF_Scheduler/MIF_Task.cpp
@@ -2,16 +2,26 @@
#include "MIF_Task.h"
#include "test.h"
-
MIF_Task::MIF_Task (int importance,
- int start_time,
- int load,
- DT_Creator *dt_creator)
+ int start_time,
+ int load,
+ int iter,
+ int dist,
+ char *job_name,
+ DT_Creator *dt_creator)
{
this->load_ = load;
+ this->iter_ = iter;
this->start_time_ = start_time;
this->importance_ = importance;
this->dt_creator_ = dt_creator;
+ this->dist_ = dist;
+ this->job_name_ = CORBA::string_dup (job_name);
+
+ // create the stat object.
+ ACE_NEW (task_stats_, Task_Stats);
+ task_stats_->init (iter_);
+
}
void
@@ -26,7 +36,7 @@ MIF_Task::post_activate (void)
DT_TEST::instance ()->scheduler ()->wait ();
}
-int
+int
MIF_Task::perform_task (void)
{
char msg [BUFSIZ];
@@ -34,31 +44,96 @@ MIF_Task::perform_task (void)
dt_creator_->log_msg (msg);
ACE_Time_Value run_time;
-
+
+
static CORBA::ULong prime_number = 9619;
-
- for (int i = 0; i < this->load_; i++)
+ CORBA::Policy_var sched_param;
+ sched_param = CORBA::Policy::_duplicate (dt_creator_->sched_param (this->importance_));
+ const char * name = 0;
+ CORBA::Policy_ptr implicit_sched_param = 0;
+
+ for (int i = 0; i < this->iter_; i++)
{
- for (int j = 0; j < 500; j++)
+ ACE_Time_Value run_time = ACE_OS::gettimeofday () - *base_time_;
+ TASK_STATS::instance ()->sample (ACE_UINT64 (run_time.sec ()),
+ count_);
+
+ ACE_Time_Value count_down_time (1);
+ ACE_Countdown_Time count_down (&count_down_time);
+
+ while (count_down_time > ACE_Time_Value::zero)
{
ACE::is_prime (prime_number,
2,
prime_number / 2);
+
+ count_down.update ();
}
+
+ current_->update_scheduling_segment (name,
+ sched_param.in (),
+ sched_param.in ()
+ ACE_ENV_ARG_DECL);
+ ACE_CHECK;
+ }
- run_time = ACE_OS::gettimeofday () - *base_time_;
+ if (this->dist_)
+ {
+ this->job_->work (this->load_,
+ this->importance_);
+ }
+ // else
+ // {
+
+ for (int j = 0; j < this->iter_; j++)
+ {
+ ACE_Time_Value run_time = ACE_OS::gettimeofday () - *base_time_;
TASK_STATS::instance ()->sample (ACE_UINT64 (run_time.sec ()),
count_);
- CORBA::Policy_var sched_param;
- sched_param = CORBA::Policy::_duplicate (dt_creator_->sched_param (this->importance_));
- const char * name = 0;
- CORBA::Policy_ptr implicit_sched_param = 0;
+
+ ACE_Time_Value count_down_time (1);
+ ACE_Countdown_Time count_down (&count_down_time);
+
+ while (count_down_time > ACE_Time_Value::zero)
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "Waiting on count down\n"));
+
+
+ ACE::is_prime (prime_number,
+ 2,
+ prime_number / 2);
+ count_down.update ();
+ }
+
current_->update_scheduling_segment (name,
sched_param.in (),
- implicit_sched_param
+ sched_param.in ()
ACE_ENV_ARG_DECL);
ACE_CHECK;
+
}
+
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "Thread %d\n",
+ this->count_));
+
+ /*
+ run_time = ACE_OS::gettimeofday () - *base_time_;
+ TASK_STATS::instance ()->sample (ACE_UINT64 (run_time.sec ()),
+ count_);
+ */
+
+ // task_stats_->sample (ACE_UINT64 (run_time.sec ()),
+ // count_);
+
+
+
+ if (dist_)
+ job_->shutdown ();
+
return 0;
}
-
diff --git a/TAO/examples/RTScheduling/MIF_Scheduler/MIF_Task.h b/TAO/examples/RTScheduling/MIF_Scheduler/MIF_Task.h
index 5a7c2a0cc33..2b2324626d6 100644
--- a/TAO/examples/RTScheduling/MIF_Scheduler/MIF_Task.h
+++ b/TAO/examples/RTScheduling/MIF_Scheduler/MIF_Task.h
@@ -10,6 +10,9 @@ class MIF_Task : public Thread_Task
MIF_Task (int importance,
int start_time,
int load,
+ int iter,
+ int dist,
+ char *job_name,
DT_Creator *dt_creator);
virtual int perform_task (void);
diff --git a/TAO/examples/RTScheduling/MIF_Scheduler/test.cpp b/TAO/examples/RTScheduling/MIF_Scheduler/test.cpp
index 26c295cdf2d..6ed202eb1d5 100644
--- a/TAO/examples/RTScheduling/MIF_Scheduler/test.cpp
+++ b/TAO/examples/RTScheduling/MIF_Scheduler/test.cpp
@@ -7,11 +7,11 @@
//#include "MIF_DT_Creator.h"
#include "../Thread_Task.h"
#include "../Task_Stats.h"
-
+#include "../Synch_i.h"
DT_Test::DT_Test (void)
{
-}
+}
int
DT_Test::init (int argc, char *argv []
@@ -22,49 +22,77 @@ DT_Test::init (int argc, char *argv []
""
ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
-
+
+ dt_creator_->orb (orb_.in ());
+
CORBA::Object_ptr manager_obj = orb_->resolve_initial_references ("RTSchedulerManager"
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (-1);
-
+
TAO_RTScheduler_Manager_var manager = TAO_RTScheduler_Manager::_narrow (manager_obj
ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
-
-
+
+
ACE_NEW_RETURN (scheduler_,
MIF_Scheduler (orb_.in ()), -1);
-
+
manager->rtscheduler (scheduler_);
-
+
CORBA::Object_var object =
- orb_->resolve_initial_references ("RTScheduler_Current"
+ orb_->resolve_initial_references ("RTScheduler_Current"
ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
-
+
current_ =
RTScheduling::Current::_narrow (object.in () ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
-
+
return 0;
}
void
-DT_Test::run (int argc, char* argv []
+DT_Test::run (int argc, char* argv []
ACE_ENV_ARG_DECL)
{
init (argc,argv
ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
- //TASK_STATS::instance ()->init (this->dt_creator_->dt_count () * 100);
-
- this->activate_task ();
+ TASK_STATS::instance ()->init (this->dt_creator_->total_load ());
+ if (this->dt_creator_->resolve_naming_service (ACE_ENV_SINGLE_ARG_PARAMETER) == -1)
+ return;
+ ACE_CHECK;
+
+ this->dt_creator_->activate_root_poa (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ this->dt_creator_->activate_poa_list (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ this->dt_creator_->activate_job_list (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ this->dt_creator_->activate_schedule (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ DT_Creator* dt_creator = this->dt_creator_;
+ dt_creator->register_synch_obj (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ ACE_DEBUG ((LM_DEBUG,
+ "Registered Synch Object\n"));
- orb_->run (ACE_ENV_SINGLE_ARG_PARAMETER);
+ // this->activate_task ();
+ dt_creator_->create_distributable_threads (current_.in ()
+ ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
- orb_->destroy ();
+ //orb_->run (ACE_ENV_SINGLE_ARG_PARAMETER);
+ //ACE_CHECK;
+ // shutdown the ORB
+ //orb_->shutdown (0);
+
+
+ //orb_->destroy ();
ACE_Thread_Manager::instance ()->wait ();
}
@@ -77,23 +105,22 @@ DT_Test::dt_creator (MIF_DT_Creator* dt_creator)
}
-MIF_Scheduler*
+MIF_Scheduler*
DT_Test::scheduler (void)
{
return this->scheduler_;
}
-
+/*
int
DT_Test::activate_task (void)
{
-
-
- long flags;
+
+long flags;
flags = THR_NEW_LWP | THR_JOINABLE;
- flags |=
+ flags |=
orb_->orb_core ()->orb_params ()->scope_policy () |
orb_->orb_core ()->orb_params ()->sched_policy ();
-
+
if (this->activate (flags,
1) == -1)
{
@@ -110,8 +137,7 @@ DT_Test::svc (void)
{
ACE_TRY_NEW_ENV
{
- dt_creator_->create_distributable_threads (orb_.in (),
- current_.in ()
+ dt_creator_->create_distributable_threads (current_.in ()
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
@@ -122,10 +148,17 @@ DT_Test::svc (void)
"Caught exception:");
return -1;
}
- ACE_ENDTRY;
+ ACE_ENDTRY;
return 0;
}
+*/
+
+RTScheduling::Current_ptr
+DT_Test::current (void)
+{
+ return this->current_.in ();
+}
int
main (int argc, char* argv [])
@@ -133,11 +166,13 @@ main (int argc, char* argv [])
ACE_TRY_NEW_ENV
{
ACE_Service_Config::static_svcs ()->insert (&ace_svc_desc_MIF_DT_Creator);
-
+
+ ACE_DEBUG ((LM_DEBUG,
+ "%t\n"));
DT_TEST::instance ()->run (argc, argv
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
-
+
}
ACE_CATCHANY
{
@@ -145,8 +180,8 @@ main (int argc, char* argv [])
"Caught exception:");
return 1;
}
- ACE_ENDTRY;
-
+ ACE_ENDTRY;
+
return 0;
}
diff --git a/TAO/examples/RTScheduling/MIF_Scheduler/test.h b/TAO/examples/RTScheduling/MIF_Scheduler/test.h
index ac360f4b008..50385d5bd4a 100644
--- a/TAO/examples/RTScheduling/MIF_Scheduler/test.h
+++ b/TAO/examples/RTScheduling/MIF_Scheduler/test.h
@@ -13,7 +13,7 @@
class Task_Stats;
-class DT_Test :public ACE_Task <ACE_SYNCH>
+class DT_Test //:public ACE_Task <ACE_SYNCH>
{
public:
@@ -30,9 +30,13 @@ class DT_Test :public ACE_Task <ACE_SYNCH>
MIF_Scheduler* scheduler (void);
int activate_task (void);
- protected:
- /// task svc
- virtual int svc (void);
+
+ RTScheduling::Current_ptr current (void);
+
+/* protected: */
+/* /// task svc */
+/* virtual int svc (void); */
+
private:
/// = Policies