diff options
author | venkita <venkita@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-10-08 13:26:32 +0000 |
---|---|---|
committer | venkita <venkita@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-10-08 13:26:32 +0000 |
commit | 3c2a1435b56558dd6f08a1f270c4025e3c8dd94f (patch) | |
tree | 9dc62ed5fb622b591878fba89c643f2fab042e65 | |
parent | 658adf5b37cb1f00c6da902d01b253c6f24ef9c4 (diff) | |
download | ATCD-3c2a1435b56558dd6f08a1f270c4025e3c8dd94f.tar.gz |
ChangeLogTag:
79 files changed, 13810 insertions, 0 deletions
diff --git a/TAO/examples/Kokyu_dsrt_schedulers/FP_Scheduler.cpp b/TAO/examples/Kokyu_dsrt_schedulers/FP_Scheduler.cpp new file mode 100644 index 00000000000..c19f714ca15 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/FP_Scheduler.cpp @@ -0,0 +1,718 @@ +//$Id$ + +#include "FP_Scheduler.h" +#include "Kokyu_qosC.h" +#include "utils.h" +#include "tao/RTScheduling/Request_Interceptor.h" + +FP_Scheduling::SegmentSchedulingParameter +FP_Segment_Sched_Param_Policy::value ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + return value_; +} + +void +FP_Segment_Sched_Param_Policy::value ( + const FP_Scheduling::SegmentSchedulingParameter & value + ACE_ENV_ARG_DECL_NOT_USED + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + this->value_ = value; +} + +Fixed_Priority_Scheduler::Fixed_Priority_Scheduler (CORBA::ORB_ptr orb, + Kokyu::DSRT_Dispatcher_Impl_t disp_impl_type, + int ace_sched_policy, + int ace_sched_scope) + : orb_ (orb), + disp_impl_type_ (disp_impl_type), + ace_sched_policy_ (ace_sched_policy), + ace_sched_scope_ (ace_sched_scope) +{ + ACE_DECLARE_NEW_ENV; + + Kokyu::DSRT_ConfigInfo config; + + config.impl_type_ = this->disp_impl_type_; + config.sched_policy_ = ace_sched_policy_; + config.sched_scope_ = ace_sched_scope_; + + Kokyu::DSRT_Dispatcher_Factory<FP_Scheduler_Traits>::DSRT_Dispatcher_Auto_Ptr + tmp( Kokyu::DSRT_Dispatcher_Factory<FP_Scheduler_Traits>:: + create_DSRT_dispatcher (config) ); + kokyu_dispatcher_ = tmp; + + CORBA::Object_var object = + orb->resolve_initial_references ("RTScheduler_Current" + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + this->current_ = + RTScheduling::Current::_narrow (object.in () ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + IOP::CodecFactory_var codec_factory; + CORBA::Object_var obj = orb->resolve_initial_references ("CodecFactory"); + + if (CORBA::is_nil(obj.in ())) + { + ACE_ERROR ((LM_ERROR, "Nil Codec factory\n")); + } + else + { + codec_factory = IOP::CodecFactory::_narrow (obj.in ()); + } + + IOP::Encoding encoding; + encoding.format = IOP::ENCODING_CDR_ENCAPS; + encoding.major_version = 1; + encoding.minor_version = 2; + + codec_ = codec_factory->create_codec (encoding); +} + +Fixed_Priority_Scheduler::~Fixed_Priority_Scheduler (void) +{ + // delete kokyu_dispatcher_; +} + +void +Fixed_Priority_Scheduler::shutdown (void) +{ + kokyu_dispatcher_->shutdown (); + ACE_DEBUG ((LM_DEBUG, "kokyu DSRT dispatcher shutdown\n")); +} + +FP_Scheduling::SegmentSchedulingParameterPolicy_ptr +Fixed_Priority_Scheduler::create_segment_scheduling_parameter ( + const FP_Scheduling::SegmentSchedulingParameter & value + ACE_ENV_ARG_DECL + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + FP_Scheduling::SegmentSchedulingParameterPolicy_ptr + segment_sched_param_policy; + ACE_NEW_THROW_EX (segment_sched_param_policy, + FP_Segment_Sched_Param_Policy, + CORBA::NO_MEMORY ( + CORBA::SystemException::_tao_minor_code ( + TAO_DEFAULT_MINOR_CODE, + ENOMEM), + CORBA::COMPLETED_NO)); + + segment_sched_param_policy->value (value); + + return segment_sched_param_policy; +} + + +void +Fixed_Priority_Scheduler::begin_new_scheduling_segment (const RTScheduling::Current::IdType& guid, + const char *, + CORBA::Policy_ptr sched_policy, + CORBA::Policy_ptr + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE)) +{ +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, + "(%t|%T):FP_Scheduler::begin_new_scheduling_segment enter\n")); +#endif + +#ifdef KOKYU_DSRT_LOGGING + int int_guid; + ACE_OS::memcpy (&int_guid, + guid.get_buffer (), + guid.length ()); + ACE_DEBUG ((LM_DEBUG, "(%t|%T): guid is %d\n", int_guid)); +#endif + + FP_Scheduler_Traits::QoSDescriptor_t qos; + FP_Scheduling::SegmentSchedulingParameterPolicy_var sched_param_policy = + FP_Scheduling::SegmentSchedulingParameterPolicy::_narrow (sched_policy); + + FP_Scheduling::SegmentSchedulingParameter sched_param = sched_param_policy->value (); + RTCORBA::Priority desired_priority = sched_param.base_priority; + qos.priority_ = desired_priority; + kokyu_dispatcher_->schedule (guid, qos); + +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, + "(%t|%T):FP_Scheduler::begin_new_scheduling_segment exit\n")); +#endif +} + +void +Fixed_Priority_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, + RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE)) +{ + this->begin_new_scheduling_segment (guid, + name, + sched_param, + implicit_sched_param + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +} + +void +Fixed_Priority_Scheduler::update_scheduling_segment (const RTScheduling::Current::IdType &guid, + const char* name, + CORBA::Policy_ptr sched_policy, + CORBA::Policy_ptr implicit_sched_param + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE)) +{ + ACE_UNUSED_ARG ((name)); + ACE_UNUSED_ARG ((implicit_sched_param)); + +#ifdef KOKYU_DSRT_LOGGING + int int_guid ; + ACE_OS::memcpy (&int_guid, + guid.get_buffer (), + guid.length ()); + ACE_DEBUG ((LM_DEBUG, "(%t|%T): update_sched_seg::guid is %d\n", int_guid)); +#endif + + FP_Scheduling::SegmentSchedulingParameterPolicy_var sched_param_policy = + FP_Scheduling::SegmentSchedulingParameterPolicy::_narrow (sched_policy); + + FP_Scheduling::SegmentSchedulingParameter sched_param = + sched_param_policy->value (); + + RTCORBA::Priority desired_priority = sched_param.base_priority; + + FP_Scheduler_Traits::QoSDescriptor_t qos; + qos.priority_ = desired_priority; + + kokyu_dispatcher_->update_schedule (guid, qos); +} + +void +Fixed_Priority_Scheduler::end_scheduling_segment (const RTScheduling::Current::IdType &guid, + const char * + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ +#ifdef KOKYU_DSRT_LOGGING + int int_guid; + ACE_OS::memcpy (&int_guid, + guid.get_buffer (), + guid.length ()); + ACE_DEBUG ((LM_DEBUG, "(%t|%T) call to end_sched_segment for guid %d\n", int_guid)); +#endif + + kokyu_dispatcher_->cancel_schedule (guid); +} + +void +Fixed_Priority_Scheduler::end_nested_scheduling_segment (const RTScheduling::Current::IdType &, + const char *, + CORBA::Policy_ptr + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + +} + + +void +Fixed_Priority_Scheduler::send_request (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + Kokyu::Svc_Ctxt_DSRT_QoS sc_qos; + + CORBA::String_var operation = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, + "(%t|%T): send_request " + "from \"%s\"\n", + operation.in ())); +#endif + // Make the context to send the context to the target + IOP::ServiceContext sc; + sc.context_id = Client_Interceptor::SchedulingInfo; + + CORBA::Policy_ptr sched_policy = + this->current_->scheduling_parameter(ACE_ENV_SINGLE_ARG_PARAMETER); + /* + int guid; + ACE_OS::memcpy (&guid, + this->current_->id ()->get_buffer (), + this->current_->id ()->length ()); + */ + RTCORBA::Priority desired_priority; + if (CORBA::is_nil (sched_policy)) + { + desired_priority = 0; + } + else + { + FP_Scheduling::SegmentSchedulingParameterPolicy_var sched_param_policy = + FP_Scheduling::SegmentSchedulingParameterPolicy::_narrow (sched_policy); + + FP_Scheduling::SegmentSchedulingParameter sched_param = + sched_param_policy->value (); + + desired_priority = sched_param.base_priority; + +#ifdef KOKYU_DSRT_LOGGING + int int_guid; + ACE_OS::memcpy (&int_guid, + this->current_->id ()->get_buffer (), + this->current_->id ()->length ()); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%t): send_request desired_priority from current = %d, guid = %d\n"), + desired_priority, int_guid)); +#endif + + //Fill the guid in the SC Qos struct + sc_qos.guid.length (this->current_->id ()->length ()); + guid_copy (sc_qos.guid, *(this->current_->id ())); + sc_qos.desired_priority = desired_priority; + CORBA::Any sc_qos_as_any; + sc_qos_as_any <<= sc_qos; + + sc.context_data = + ACE_reinterpret_cast(IOP::ServiceContext:: + _tao_seq_Octet_context_data &, + *codec_->encode (sc_qos_as_any)); + +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%t|%T): send_request : about to add sched SC\n"))); +#endif + + // Add this context to the service context list. + ri->add_request_service_context (sc, 0 ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + + +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, + ACE_LIB_TEXT ("(%t|%T): send_request : ") + ACE_LIB_TEXT ("about to call scheduler to inform block\n") + )); +#endif + + kokyu_dispatcher_->update_schedule (*(this->current_->id ()), + Kokyu::BLOCK); + +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, + ACE_LIB_TEXT ("(%t|%T): send_request interceptor done\n"))); +#endif +} + +void +Fixed_Priority_Scheduler::receive_request (PortableInterceptor::ServerRequestInfo_ptr ri, + RTScheduling::Current::IdType_out guid_out, + CORBA::String_out /*name*/, + CORBA::Policy_out sched_param_out, + CORBA::Policy_out /*implicit_sched_param_out*/ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + Kokyu::Svc_Ctxt_DSRT_QoS* sc_qos_ptr; + +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, "(%t|%T):entered FP_Scheduler::receive_request\n")); +#endif + + RTScheduling::Current::IdType guid; + + CORBA::String_var operation = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, + "(%t|%T): receive_request from " + "\"%s\"\n", + operation.in ())); +#endif + + // Ignore the "_is_a" operation since it may have been invoked + // locally on the server side as a side effect of another call, + // meaning that the client hasn't added the service context yet. + if (ACE_OS_String::strcmp ("_is_a", operation.in ()) == 0) + return; + + IOP::ServiceContext_var sc = + ri->get_request_service_context (Server_Interceptor::SchedulingInfo + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + RTCORBA::Priority desired_priority; + + if (sc.ptr () == 0) + { + desired_priority = 0; + } + else + { + CORBA::OctetSeq oc_seq = CORBA::OctetSeq (sc->context_data.length (), + sc->context_data.length (), + sc->context_data.get_buffer (), + 0); + CORBA::Any sc_qos_as_any; + sc_qos_as_any = *codec_->decode (oc_seq); + //Don't store in a _var, since >>= returns a pointer to an + //internal buffer and we are not supposed to free it. + sc_qos_as_any >>= sc_qos_ptr; + + desired_priority = sc_qos_ptr->desired_priority; + guid.length (sc_qos_ptr->guid.length ()); + guid_copy (guid, sc_qos_ptr->guid); + + ACE_NEW (guid_out.ptr (), + RTScheduling::Current::IdType); + guid_out.ptr ()->length (guid.length ()); + *(guid_out.ptr ()) = guid; + +#ifdef KOKYU_DSRT_LOGGING + int int_guid; + ACE_OS::memcpy (&int_guid, + guid.get_buffer (), + guid.length ()); + ACE_DEBUG ((LM_DEBUG, + "(%t|%T): Desired_Priority = %d, guid = %d in recvd service context\n", + desired_priority, + int_guid)); +#endif + + FP_Scheduling::SegmentSchedulingParameter sched_param; + sched_param.base_priority = desired_priority; + sched_param_out = this->create_segment_scheduling_parameter (sched_param); + } + + FP_Scheduler_Traits::QoSDescriptor_t qos; + qos.priority_ = desired_priority; + this->kokyu_dispatcher_->schedule (guid, qos); + +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, "(%t|%T): receive_request interceptor done\n")); +#endif + +} + +void +Fixed_Priority_Scheduler::send_poll (PortableInterceptor::ClientRequestInfo_ptr + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ +} + +void +Fixed_Priority_Scheduler::send_reply (PortableInterceptor::ServerRequestInfo_ptr ri + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + RTCORBA::Priority desired_priority = 0; + Kokyu::Svc_Ctxt_DSRT_QoS sc_qos; + + CORBA::String_var operation = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, + "(%t|%T): send_reply from \"%s\"\n", + ri->operation ())); +#endif + + // Make the context to send the context to the target + IOP::ServiceContext sc; + sc.context_id = Server_Interceptor::SchedulingInfo; + + ACE_DEBUG ((LM_DEBUG, "in send_reply: before accessing current_->sched_param\n")); + CORBA::Policy_ptr sched_policy = + this->current_->scheduling_parameter(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (sched_policy)) + { + ACE_DEBUG ((LM_DEBUG, "sched_policy nil. desired_priority not set in sched params\n")); + desired_priority = 0; + } + else + { + ACE_DEBUG ((LM_DEBUG, "sched_policy not nil. desired_priority set in sched params\n")); + + FP_Scheduling::SegmentSchedulingParameterPolicy_var sched_param_policy = + FP_Scheduling::SegmentSchedulingParameterPolicy::_narrow (sched_policy); + + FP_Scheduling::SegmentSchedulingParameter sched_param = + sched_param_policy->value (); + + desired_priority = sched_param.base_priority; + + //Fill the guid in the SC Qos struct + sc_qos.guid.length (this->current_->id ()->length ()); + guid_copy (sc_qos.guid, *(this->current_->id ())); + sc_qos.desired_priority = desired_priority; + CORBA::Any sc_qos_as_any; + sc_qos_as_any <<= sc_qos; + + sc.context_data = ACE_reinterpret_cast( + IOP::ServiceContext:: + _tao_seq_Octet_context_data &, + *codec_->encode (sc_qos_as_any)); + + // Add this context to the service context list. + ri->add_reply_service_context (sc, 1 ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, "(%t|%T):reply sc added\n")); +#endif + } + + kokyu_dispatcher_->update_schedule (*(this->current_->id ()), + Kokyu::BLOCK); + +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, "(%t|%T): send_reply interceptor done\n")); +#endif +} + +void +Fixed_Priority_Scheduler::send_exception (PortableInterceptor::ServerRequestInfo_ptr ri + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + send_reply (ri ACE_ENV_ARG_PARAMETER); +} + +void +Fixed_Priority_Scheduler::send_other (PortableInterceptor::ServerRequestInfo_ptr ri + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + send_reply (ri ACE_ENV_ARG_PARAMETER); +} + +void +Fixed_Priority_Scheduler::receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + RTScheduling::Current::IdType guid; + RTCORBA::Priority desired_priority=0; + + CORBA::String_var operation = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + CORBA::Object_var target = ri->target (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + ACE_CString opname = operation.in (); +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, + "(%t|%T):receive_reply from " + "\"%s\"\n", + opname.c_str ())); +#endif + + // Check that the reply service context was received as + // expected. + IOP::ServiceContext_var sc = + ri->get_reply_service_context (Client_Interceptor::SchedulingInfo + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (sc.ptr () == 0) + { + desired_priority = 0; + } + else + { + CORBA::OctetSeq oc_seq = CORBA::OctetSeq (sc->context_data.length (), + sc->context_data.length (), + sc->context_data.get_buffer (), + 0); + + //Don't store in a _var, since >>= returns a pointer to an internal buffer + //and we are not supposed to free it. + Kokyu::Svc_Ctxt_DSRT_QoS* sc_qos_ptr; + CORBA::Any sc_qos_as_any; + sc_qos_as_any = *codec_->decode (oc_seq); + sc_qos_as_any >>= sc_qos_ptr; + + desired_priority = sc_qos_ptr->desired_priority; + guid.length (sc_qos_ptr->guid.length ()); + guid_copy (guid, sc_qos_ptr->guid); + +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, + "(%t): Desired_Priority = %d in recvd service context\n", + desired_priority)); +#endif + } + + FP_Scheduler_Traits::QoSDescriptor_t qos; + qos.priority_ = desired_priority; + this->kokyu_dispatcher_->schedule (guid, qos); +} + +void +Fixed_Priority_Scheduler::receive_exception (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + receive_reply (ri ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +} + +void +Fixed_Priority_Scheduler::receive_other (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + receive_reply (ri ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +} + +void +Fixed_Priority_Scheduler::cancel (const RTScheduling::Current::IdType & + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_THROW (CORBA::NO_IMPLEMENT ()); +} + +CORBA::PolicyList* +Fixed_Priority_Scheduler::scheduling_policies (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +void +Fixed_Priority_Scheduler::scheduling_policies (const CORBA::PolicyList & + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_THROW (CORBA::NO_IMPLEMENT ()); +} + +CORBA::PolicyList* +Fixed_Priority_Scheduler::poa_policies (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +char * +Fixed_Priority_Scheduler::scheduling_discipline_name (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +RTScheduling::ResourceManager_ptr +Fixed_Priority_Scheduler::create_resource_manager (const char *, + CORBA::Policy_ptr + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +void +Fixed_Priority_Scheduler::set_scheduling_parameter (PortableServer::Servant &, + const char *, + CORBA::Policy_ptr + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_THROW (CORBA::NO_IMPLEMENT ()); +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) +template class Kokyu::DSRT_Dispatcher_Factory<FP_Scheduler_Traits>; +template class Kokyu::DSRT_Dispatcher<FP_Scheduler_Traits>; +template class Kokyu::DSRT_Dispatcher_Impl<FP_Scheduler_Traits>; +template class Kokyu::DSRT_Direct_Dispatcher_Impl<FP_Scheduler_Traits>; +template class Kokyu::DSRT_CV_Dispatcher_Impl<FP_Scheduler_Traits>; +template class Kokyu::DSRT_Dispatch_Item_var<FP_Scheduler_Traits>; +template class Kokyu::Comparator_Adapter_Generator<FP_Scheduler_Traits>; +template class Kokyu::Sched_Ready_Queue<FP_Scheduler_Traits, Kokyu::Comparator_Adapter_Generator<FP_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex>; + +template class ACE_Hash_Map_Manager_Ex<FP_Scheduler_Traits::Guid_t, ACE_RB_Tree_Node<Kokyu::DSRT_Dispatch_Item_var<FP_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<FP_Scheduler_Traits> > *, Kokyu::Sched_Ready_Queue<FP_Scheduler_Traits, Kokyu::Comparator_Adapter_Generator<FP_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex>::Guid_Hash, ACE_Equal_To<FP_Scheduler_Traits::Guid_t>, ACE_Null_Mutex>; + +template class ACE_RB_Tree<Kokyu::DSRT_Dispatch_Item_var<FP_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<FP_Scheduler_Traits>, Kokyu::Comparator_Adapter_Generator<FP_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex>; + +template class ACE_RB_Tree_Iterator<Kokyu::DSRT_Dispatch_Item_var<FP_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<FP_Scheduler_Traits>, Kokyu::Comparator_Adapter_Generator<FP_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex>; + +template class ACE_Hash_Map_Entry<FP_Scheduler_Traits::Guid_t, ACE_RB_Tree_Node<Kokyu::DSRT_Dispatch_Item_var<FP_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<FP_Scheduler_Traits> > *>; + +template class ACE_RB_Tree_Node<Kokyu::DSRT_Dispatch_Item_var<FP_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<FP_Scheduler_Traits> >; + +template class Kokyu::Fixed_Priority_Comparator<FP_Scheduler_Traits::QoSDescriptor_t>; + +template class ACE_Hash_Map_Iterator_Base_Ex<FP_Scheduler_Traits::Guid_t, ACE_RB_Tree_Node<Kokyu::DSRT_Dispatch_Item_var<FP_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<FP_Scheduler_Traits> > *, Kokyu::Sched_Ready_Queue<FP_Scheduler_Traits, Kokyu::Comparator_Adapter_Generator<FP_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex>::Guid_Hash, ACE_Equal_To<FP_Scheduler_Traits::Guid_t>, ACE_Null_Mutex>; + +template class ACE_RB_Tree_Reverse_Iterator<Kokyu::DSRT_Dispatch_Item_var<FP_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<FP_Scheduler_Traits>, Kokyu::Comparator_Adapter_Generator<FP_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex>; + +template class ACE_RB_Tree_Iterator_Base<Kokyu::DSRT_Dispatch_Item_var<FP_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<FP_Scheduler_Traits>, Kokyu::Comparator_Adapter_Generator<FP_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex>; + +#elif defined(ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate Kokyu::DSRT_Dispatcher_Factory<FP_Scheduler_Traits> +#pragma instantiate Kokyu::DSRT_Dispatcher<FP_Scheduler_Traits> +#pragma instantiate Kokyu::DSRT_Dispatcher_Impl<FP_Scheduler_Traits> +#pragma instantiate Kokyu::DSRT_Direct_Dispatcher_Impl<FP_Scheduler_Traits> +#pragma instantiate Kokyu::DSRT_CV_Dispatcher_Impl<FP_Scheduler_Traits> +#pragma instantiate Kokyu::DSRT_Dispatch_Item_var<FP_Scheduler_Traits> +#pragma instantiate Kokyu::Comparator_Adapter_Generator<FP_Scheduler_Traits> + +#pragma instantiate Kokyu::Sched_Ready_Queue<FP_Scheduler_Traits, Kokyu::Comparator_Adapter_Generator<FP_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex> + +#pragma instantiate ACE_Hash_Map_Manager_Ex<FP_Scheduler_Traits::Guid_t, ACE_RB_Tree_Node<Kokyu::DSRT_Dispatch_Item_var<FP_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<FP_Scheduler_Traits> > *, Kokyu::Sched_Ready_Queue<FP_Scheduler_Traits, Kokyu::Comparator_Adapter_Generator<FP_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex>::Guid_Hash, ACE_Equal_To<FP_Scheduler_Traits::Guid_t>, ACE_Null_Mutex> + +#pragma instantiate ACE_RB_Tree<Kokyu::DSRT_Dispatch_Item_var<FP_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<FP_Scheduler_Traits>, Kokyu::Comparator_Adapter_Generator<FP_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex> + +#pragma instantiate ACE_RB_Tree_Iterator<Kokyu::DSRT_Dispatch_Item_var<FP_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<FP_Scheduler_Traits>, Kokyu::Comparator_Adapter_Generator<FP_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex> + +ACE_Hash_Map_Entry<FP_Scheduler_Traits::Guid_t, ACE_RB_Tree_Node<Koky\ +u::DSRT_Dispatch_Item_var<FP_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<\ +FP_Scheduler_Traits> > + +#pragma instantiate ACE_Hash_Map_Entry<FP_Scheduler_Traits::Guid_t, ACE_RB_Tree_Node<Kokyu::DSRT_Dispatch_Item_var<FP_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<FP_Scheduler_Traits> > *> + +#pragma instantiate ACE_RB_Tree_Node<Kokyu::DSRT_Dispatch_Item_var<FP_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<FP_Scheduler_Traits> > + +#pragma instantiate Kokyu::Fixed_Priority_Comparator<FP_Scheduler_Traits::QoSDescriptor_t> + +#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<FP_Scheduler_Traits::Guid_t, ACE_RB_Tree_Node<Kokyu::DSRT_Dispatch_Item_var<FP_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<FP_Scheduler_Traits> > *, Kokyu::Sched_Ready_Queue<FP_Scheduler_Traits, Kokyu::Comparator_Adapter_Generator<FP_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex>::Guid_Hash, ACE_Equal_To<FP_Scheduler_Traits::Guid_t>, ACE_Null_Mutex> + +#pragma instantiate ACE_RB_Tree_Reverse_Iterator<Kokyu::DSRT_Dispatch_Item_var<FP_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<FP_Scheduler_Traits>, Kokyu::Comparator_Adapter_Generator<FP_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex> + +#pragma instantiate ACE_RB_Tree_Iterator_Base<Kokyu::DSRT_Dispatch_Item_var<FP_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<FP_Scheduler_Traits>, Kokyu::Comparator_Adapter_Generator<FP_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex> + +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/examples/Kokyu_dsrt_schedulers/FP_Scheduler.h b/TAO/examples/Kokyu_dsrt_schedulers/FP_Scheduler.h new file mode 100644 index 00000000000..a83e7d797cf --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/FP_Scheduler.h @@ -0,0 +1,207 @@ +//$Id$ + +#ifndef FIXED_PRIORITY_SCHEDULER_H +#define FIXED_PRIORITY_SCHEDULER_H + +#include "tao/RTScheduling/RTScheduler.h" +#include "FP_SchedulingC.h" +#include "Kokyu_dsrt.h" +#include "Kokyu_dsrt_schedulers_export.h" + +struct FP_Scheduler_Traits +{ + typedef RTScheduling::Current::IdType Guid_t; + + struct _QoSDescriptor_t + { + typedef long Priority_t; + Priority_t priority_; + }; + + typedef _QoSDescriptor_t QoSDescriptor_t; + + typedef Kokyu::Fixed_Priority_Comparator<QoSDescriptor_t> QoSComparator_t; + + class _Guid_Hash + { + public: + u_long operator () (const Guid_t& id) + { + return ACE::hash_pjw ((const char *) id.get_buffer (), + id.length ()); + } + }; + + typedef _Guid_Hash Guid_Hash; +}; + +class Kokyu_DSRT_Schedulers_Export FP_Segment_Sched_Param_Policy: +public FP_Scheduling::SegmentSchedulingParameterPolicy, + public TAO_Local_RefCounted_Object +{ + public: + FP_Scheduling::SegmentSchedulingParameter value ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + void value ( + const FP_Scheduling::SegmentSchedulingParameter & value + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + private: + FP_Scheduling::SegmentSchedulingParameter value_; +}; + +class Kokyu_DSRT_Schedulers_Export Fixed_Priority_Scheduler: +public FP_Scheduling::FP_Scheduler, +public TAO_Local_RefCounted_Object +{ + public: + + Fixed_Priority_Scheduler (CORBA::ORB_ptr orb, + Kokyu::DSRT_Dispatcher_Impl_t, + int ace_sched_policy, + int ace_sched_scope); + + ~Fixed_Priority_Scheduler (void); + + void shutdown (void); + + virtual FP_Scheduling::SegmentSchedulingParameterPolicy_ptr + create_segment_scheduling_parameter ( + const FP_Scheduling::SegmentSchedulingParameter & value + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual void begin_new_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, + 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, + RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE)); + + virtual void update_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, + 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 + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void send_request (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)); + + virtual void receive_request (PortableInterceptor::ServerRequestInfo_ptr ri, + RTScheduling::Current::IdType_out guid, + CORBA::String_out name, + CORBA::Policy_out sched_param, + CORBA::Policy_out implicit_sched_param + 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)); + + virtual void send_poll (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)); + + virtual void send_exception (PortableInterceptor::ServerRequestInfo_ptr ri + 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 + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + private: + CORBA::ORB_var orb_; + IOP::Codec_var codec_; + RTScheduling::Current_var current_; + Kokyu::DSRT_Dispatcher_Factory<FP_Scheduler_Traits>::DSRT_Dispatcher_Auto_Ptr + kokyu_dispatcher_; + Kokyu::DSRT_Dispatcher_Impl_t disp_impl_type_; + int ace_sched_policy_; + int ace_sched_scope_; +}; + +#endif //FIXED_PRIORITY_SCHEDULER_H diff --git a/TAO/examples/Kokyu_dsrt_schedulers/FP_Scheduling.pidl b/TAO/examples/Kokyu_dsrt_schedulers/FP_Scheduling.pidl new file mode 100644 index 00000000000..846d863e892 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/FP_Scheduling.pidl @@ -0,0 +1,61 @@ +//$Id$ + +/** + * @file FP_Scheduling.pidl + * + * $Id$ + * + * @brief Pre-compiled IDL source to help with the service context + * propagation of dynamic scheduling parameters using Kokyu + * + * This file was used to generate the code in FP_SchedulingC.{h,i,cpp}. + * The steps to regenerate the code are as follows: + * + * 1. Run the tao_idl compiler on the pidl file. The command used for + * this is: + * + * tao_idl -I $TAO_ROOT -Ge 1 + * -Wb,export_macro=Kokyu_DSRT_Schedulers_Export + * -Wb,export_include=Kokyu_dsrt_schedulers_export.h + * + * + * 2. Then apply the patches in FP_SchedulingC.h.diff to the generated code. + * The patch will replace the inclusion of RTCORBAC.h and RTSchedulerC.h + * with RTCORBA.h and RTScheduler.h respectively. + * + * Apply patches using the following command: + * + * patch < FP_SchedulingC.h.diff + * + * Note: The diff was generated in the following way: + * + * Run the idl compiler as in step 1. + * cp FP_SchedulingC.h FP_SchedulingC.h.orig + * Modify FP_SchedulingC.h with changes described in step 2. + * diff -wBbu FP_SchedulingC.h.orig FP_SchedulingC.h > FP_SchedulingC.h.diff + * + */ + +#include <tao/RTScheduling/RTScheduler.pidl> +#include <tao/RTCORBA/RTCORBA.pidl> + +module FP_Scheduling +{ + struct SegmentSchedulingParameter + { + RTCORBA::Priority base_priority; + }; + + local interface SegmentSchedulingParameterPolicy + : CORBA::Policy + { + attribute SegmentSchedulingParameter value; + }; + + local interface FP_Scheduler : RTScheduling::Scheduler + { + SegmentSchedulingParameterPolicy + create_segment_scheduling_parameter + (in SegmentSchedulingParameter value); + }; +}; diff --git a/TAO/examples/Kokyu_dsrt_schedulers/FP_SchedulingC.cpp b/TAO/examples/Kokyu_dsrt_schedulers/FP_SchedulingC.cpp new file mode 100644 index 00000000000..ca92f2655df --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/FP_SchedulingC.cpp @@ -0,0 +1,812 @@ +// -*- C++ -*- +// +// $Id$ + +// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** +// TAO and the TAO IDL Compiler have been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// and +// Distributed Object Computing Laboratory +// University of California at Irvine +// Irvine, CA +// USA +// http://doc.ece.uci.edu/ +// and +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +// TAO_IDL - Generated from +// be/be_codegen.cpp:351 + + +#include "FP_SchedulingC.h" +#include "tao/Stub.h" +#include "tao/ORB_Core.h" +#include "tao/Invocation.h" +#include "tao/PortableInterceptor.h" + +#if TAO_HAS_INTERCEPTORS == 1 +#include "tao/RequestInfo_Util.h" +#include "tao/ClientRequestInfo_i.h" +#include "tao/ClientInterceptorAdapter.h" +#endif /* TAO_HAS_INTERCEPTORS == 1 */ + + +#if defined (__BORLANDC__) +#pragma option -w-rvl -w-rch -w-ccc -w-aus -w-sig +#endif /* __BORLANDC__ */ + +#if !defined (__ACE_INLINE__) +#include "FP_SchedulingC.i" +#endif /* !defined INLINE */ + +// TAO_IDL - Generated from +// be/be_visitor_typecode/typecode_defn.cpp:284 + +static const CORBA::Long _oc_FP_Scheduling_SegmentSchedulingParameter[] = +{ + TAO_ENCAP_BYTE_ORDER, // byte order + 49, + ACE_NTOHL (0x49444c3a), + ACE_NTOHL (0x46505f53), + ACE_NTOHL (0x63686564), + ACE_NTOHL (0x756c696e), + ACE_NTOHL (0x672f5365), + ACE_NTOHL (0x676d656e), + ACE_NTOHL (0x74536368), + ACE_NTOHL (0x6564756c), + ACE_NTOHL (0x696e6750), + ACE_NTOHL (0x6172616d), + ACE_NTOHL (0x65746572), + ACE_NTOHL (0x3a312e30), + ACE_NTOHL (0x0), // repository ID = IDL:FP_Scheduling/SegmentSchedulingParameter:1.0 + 27, + ACE_NTOHL (0x5365676d), + ACE_NTOHL (0x656e7453), + ACE_NTOHL (0x63686564), + ACE_NTOHL (0x756c696e), + ACE_NTOHL (0x67506172), + ACE_NTOHL (0x616d6574), + ACE_NTOHL (0x65720000), // name = SegmentSchedulingParameter + 1, // member count + 14, + ACE_NTOHL (0x62617365), + ACE_NTOHL (0x5f707269), + ACE_NTOHL (0x6f726974), + ACE_NTOHL (0x79000000), // name = base_priority + CORBA::tk_alias, // typecode kind for typedefs + 64, // encapsulation length + TAO_ENCAP_BYTE_ORDER, // byte order + 33, + ACE_NTOHL (0x49444c3a), + ACE_NTOHL (0x6f6d672e), + ACE_NTOHL (0x6f72672f), + ACE_NTOHL (0x5254434f), + ACE_NTOHL (0x5242412f), + ACE_NTOHL (0x5072696f), + ACE_NTOHL (0x72697479), + ACE_NTOHL (0x3a312e30), + ACE_NTOHL (0x0), // repository ID = IDL:omg.org/RTCORBA/Priority:1.0 + 9, + ACE_NTOHL (0x5072696f), + ACE_NTOHL (0x72697479), + ACE_NTOHL (0x0), // name = Priority + CORBA::tk_short, + + +}; + +static CORBA::TypeCode _tc_TAO_tc_FP_Scheduling_SegmentSchedulingParameter ( + CORBA::tk_struct, + sizeof (_oc_FP_Scheduling_SegmentSchedulingParameter), + (char *) &_oc_FP_Scheduling_SegmentSchedulingParameter, + 0, + sizeof (FP_Scheduling::SegmentSchedulingParameter) + ); + +TAO_NAMESPACE_TYPE (CORBA::TypeCode_ptr) +TAO_NAMESPACE_BEGIN (FP_Scheduling) +TAO_NAMESPACE_DEFINE ( + ::CORBA::TypeCode_ptr, + _tc_SegmentSchedulingParameter, + &_tc_TAO_tc_FP_Scheduling_SegmentSchedulingParameter + ) +TAO_NAMESPACE_END + +// TAO_IDL - Generated from +// be/be_visitor_structure/structure_cs.cpp:66 + +void FP_Scheduling::SegmentSchedulingParameter::_tao_any_destructor (void *_tao_void_pointer) +{ + SegmentSchedulingParameter *tmp = ACE_static_cast (SegmentSchedulingParameter*, _tao_void_pointer); + delete tmp; +} + +// TAO_IDL - Generated from +// be/be_type.cpp:297 + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +template class + TAO_Fixed_Var_T< + FP_Scheduling::SegmentSchedulingParameter + >; + +template class TAO_Var_Base_T< + FP_Scheduling::SegmentSchedulingParameter + >; + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +# pragma instantiate \ + TAO_Fixed_Var_T< \ + FP_Scheduling::SegmentSchedulingParameter \ + > + +#pragma instantiate TAO_Var_Base_T< + FP_Scheduling::SegmentSchedulingParameter + > + +#endif /* !ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + +// TAO_IDL - Generated from +// be/be_visitor_interface/interface_cs.cpp:63 + +int FP_Scheduling::SegmentSchedulingParameterPolicy::_tao_class_id = 0; + +FP_Scheduling::SegmentSchedulingParameterPolicy_ptr +FP_Scheduling::tao_SegmentSchedulingParameterPolicy_life::tao_duplicate ( + SegmentSchedulingParameterPolicy_ptr p + ) +{ + return SegmentSchedulingParameterPolicy::_duplicate (p); +} + +void +FP_Scheduling::tao_SegmentSchedulingParameterPolicy_life::tao_release ( + SegmentSchedulingParameterPolicy_ptr p + ) +{ + CORBA::release (p); +} + +FP_Scheduling::SegmentSchedulingParameterPolicy_ptr +FP_Scheduling::tao_SegmentSchedulingParameterPolicy_life::tao_nil ( + void + ) +{ + return SegmentSchedulingParameterPolicy::_nil (); +} + +CORBA::Boolean +FP_Scheduling::tao_SegmentSchedulingParameterPolicy_life::tao_marshal ( + SegmentSchedulingParameterPolicy_ptr p, + TAO_OutputCDR &cdr + ) +{ + return p->marshal (cdr); +} + +FP_Scheduling::SegmentSchedulingParameterPolicy_ptr +FP_Scheduling::tao_SegmentSchedulingParameterPolicy_cast::tao_narrow ( + CORBA::Object *p + ACE_ENV_ARG_DECL + ) +{ + return SegmentSchedulingParameterPolicy::_narrow (p ACE_ENV_ARG_PARAMETER); +} + +CORBA::Object * +FP_Scheduling::tao_SegmentSchedulingParameterPolicy_cast::tao_upcast ( + void *src + ) +{ + SegmentSchedulingParameterPolicy **tmp = + ACE_static_cast (SegmentSchedulingParameterPolicy **, src); + return *tmp; +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + template class + TAO_Objref_Var_T< + FP_Scheduling::SegmentSchedulingParameterPolicy, + FP_Scheduling::tao_SegmentSchedulingParameterPolicy_life + >; + template class + TAO_Objref_Out_T< + FP_Scheduling::SegmentSchedulingParameterPolicy, + FP_Scheduling::tao_SegmentSchedulingParameterPolicy_life + >; +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +# pragma instantiate \ + TAO_Objref_Var_T< \ + FP_Scheduling::SegmentSchedulingParameterPolicy, \ + FP_Scheduling::tao_SegmentSchedulingParameterPolicy_life \ + > +# pragma instantiate \ + TAO_Objref_Out_T< \ + FP_Scheduling::SegmentSchedulingParameterPolicy, \ + FP_Scheduling::tao_SegmentSchedulingParameterPolicy_life \ + > +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + +// TAO_IDL - Generated from +// be/be_visitor_interface/interface_cs.cpp:245 + +FP_Scheduling::SegmentSchedulingParameterPolicy::SegmentSchedulingParameterPolicy (void) +{} + +FP_Scheduling::SegmentSchedulingParameterPolicy::~SegmentSchedulingParameterPolicy (void) +{} + +void +FP_Scheduling::SegmentSchedulingParameterPolicy::_tao_any_destructor (void *_tao_void_pointer) +{ + SegmentSchedulingParameterPolicy *tmp = ACE_static_cast (SegmentSchedulingParameterPolicy *, _tao_void_pointer); + CORBA::release (tmp); +} + +FP_Scheduling::SegmentSchedulingParameterPolicy_ptr +FP_Scheduling::SegmentSchedulingParameterPolicy::_narrow ( + CORBA::Object_ptr obj + ACE_ENV_ARG_DECL + ) +{ + return SegmentSchedulingParameterPolicy::_unchecked_narrow (obj ACE_ENV_ARG_PARAMETER); +} + +FP_Scheduling::SegmentSchedulingParameterPolicy_ptr +FP_Scheduling::SegmentSchedulingParameterPolicy::_unchecked_narrow ( + CORBA::Object_ptr obj + ACE_ENV_ARG_DECL_NOT_USED + ) +{ + if (CORBA::is_nil (obj)) + { + return SegmentSchedulingParameterPolicy::_nil (); + } + + return + ACE_reinterpret_cast ( + SegmentSchedulingParameterPolicy_ptr, + obj->_tao_QueryInterface ( + ACE_reinterpret_cast ( + ptrdiff_t, + &SegmentSchedulingParameterPolicy::_tao_class_id + ) + ) + ); +} + +FP_Scheduling::SegmentSchedulingParameterPolicy_ptr +FP_Scheduling::SegmentSchedulingParameterPolicy::_duplicate (SegmentSchedulingParameterPolicy_ptr obj) +{ + if (! CORBA::is_nil (obj)) + { + obj->_add_ref (); + } + + return obj; +} + +void *FP_Scheduling::SegmentSchedulingParameterPolicy::_tao_QueryInterface (ptrdiff_t type) +{ + void *retv = 0; + + if (type == ACE_reinterpret_cast ( + ptrdiff_t, + &::CORBA::Policy::_tao_class_id) + ) + { + retv = + ACE_reinterpret_cast ( + void *, + ACE_static_cast ( + CORBA::Policy_ptr, + this + ) + ); + } + else if (type == ACE_reinterpret_cast ( + ptrdiff_t, + &ACE_NESTED_CLASS (::FP_Scheduling, SegmentSchedulingParameterPolicy)::_tao_class_id) + ) + { + retv = ACE_reinterpret_cast (void*, this); + } + else if (type == ACE_reinterpret_cast ( + ptrdiff_t, + &CORBA::Object::_tao_class_id) + ) + { + retv = + ACE_reinterpret_cast ( + void *, + ACE_static_cast (CORBA::Object_ptr, this) + ); + } + + if (retv != 0) + { + this->_add_ref (); + } + + return retv; +} + +const char* FP_Scheduling::SegmentSchedulingParameterPolicy::_interface_repository_id (void) const +{ + return "IDL:FP_Scheduling/SegmentSchedulingParameterPolicy:1.0"; +} + +CORBA::Boolean +FP_Scheduling::SegmentSchedulingParameterPolicy::marshal (TAO_OutputCDR &) +{ + return 0; +} + +// TAO_IDL - Generated from +// be/be_visitor_typecode/typecode_defn.cpp:284 + +static const CORBA::Long _oc_FP_Scheduling_SegmentSchedulingParameterPolicy[] = +{ + TAO_ENCAP_BYTE_ORDER, // byte order + 55, + ACE_NTOHL (0x49444c3a), + ACE_NTOHL (0x46505f53), + ACE_NTOHL (0x63686564), + ACE_NTOHL (0x756c696e), + ACE_NTOHL (0x672f5365), + ACE_NTOHL (0x676d656e), + ACE_NTOHL (0x74536368), + ACE_NTOHL (0x6564756c), + ACE_NTOHL (0x696e6750), + ACE_NTOHL (0x6172616d), + ACE_NTOHL (0x65746572), + ACE_NTOHL (0x506f6c69), + ACE_NTOHL (0x63793a31), + ACE_NTOHL (0x2e300000), // repository ID = IDL:FP_Scheduling/SegmentSchedulingParameterPolicy:1.0 + 33, + ACE_NTOHL (0x5365676d), + ACE_NTOHL (0x656e7453), + ACE_NTOHL (0x63686564), + ACE_NTOHL (0x756c696e), + ACE_NTOHL (0x67506172), + ACE_NTOHL (0x616d6574), + ACE_NTOHL (0x6572506f), + ACE_NTOHL (0x6c696379), + ACE_NTOHL (0x0), // name = SegmentSchedulingParameterPolicy + }; + +static CORBA::TypeCode _tc_TAO_tc_FP_Scheduling_SegmentSchedulingParameterPolicy ( + CORBA::tk_objref, + sizeof (_oc_FP_Scheduling_SegmentSchedulingParameterPolicy), + (char *) &_oc_FP_Scheduling_SegmentSchedulingParameterPolicy, + 0, + sizeof (FP_Scheduling::SegmentSchedulingParameterPolicy) + ); + +TAO_NAMESPACE_TYPE (CORBA::TypeCode_ptr) +TAO_NAMESPACE_BEGIN (FP_Scheduling) +TAO_NAMESPACE_DEFINE ( + ::CORBA::TypeCode_ptr, + _tc_SegmentSchedulingParameterPolicy, + &_tc_TAO_tc_FP_Scheduling_SegmentSchedulingParameterPolicy + ) +TAO_NAMESPACE_END + +// TAO_IDL - Generated from +// be/be_visitor_interface/interface_cs.cpp:63 + +int FP_Scheduling::FP_Scheduler::_tao_class_id = 0; + +FP_Scheduling::FP_Scheduler_ptr +FP_Scheduling::tao_FP_Scheduler_life::tao_duplicate ( + FP_Scheduler_ptr p + ) +{ + return FP_Scheduler::_duplicate (p); +} + +void +FP_Scheduling::tao_FP_Scheduler_life::tao_release ( + FP_Scheduler_ptr p + ) +{ + CORBA::release (p); +} + +FP_Scheduling::FP_Scheduler_ptr +FP_Scheduling::tao_FP_Scheduler_life::tao_nil ( + void + ) +{ + return FP_Scheduler::_nil (); +} + +CORBA::Boolean +FP_Scheduling::tao_FP_Scheduler_life::tao_marshal ( + FP_Scheduler_ptr p, + TAO_OutputCDR &cdr + ) +{ + return p->marshal (cdr); +} + +FP_Scheduling::FP_Scheduler_ptr +FP_Scheduling::tao_FP_Scheduler_cast::tao_narrow ( + CORBA::Object *p + ACE_ENV_ARG_DECL + ) +{ + return FP_Scheduler::_narrow (p ACE_ENV_ARG_PARAMETER); +} + +CORBA::Object * +FP_Scheduling::tao_FP_Scheduler_cast::tao_upcast ( + void *src + ) +{ + FP_Scheduler **tmp = + ACE_static_cast (FP_Scheduler **, src); + return *tmp; +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + template class + TAO_Objref_Var_T< + FP_Scheduling::FP_Scheduler, + FP_Scheduling::tao_FP_Scheduler_life + >; + template class + TAO_Objref_Out_T< + FP_Scheduling::FP_Scheduler, + FP_Scheduling::tao_FP_Scheduler_life + >; +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +# pragma instantiate \ + TAO_Objref_Var_T< \ + FP_Scheduling::FP_Scheduler, \ + FP_Scheduling::tao_FP_Scheduler_life \ + > +# pragma instantiate \ + TAO_Objref_Out_T< \ + FP_Scheduling::FP_Scheduler, \ + FP_Scheduling::tao_FP_Scheduler_life \ + > +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + +// TAO_IDL - Generated from +// be/be_visitor_interface/interface_cs.cpp:245 + +FP_Scheduling::FP_Scheduler::FP_Scheduler (void) +{} + +FP_Scheduling::FP_Scheduler::~FP_Scheduler (void) +{} + +void +FP_Scheduling::FP_Scheduler::_tao_any_destructor (void *_tao_void_pointer) +{ + FP_Scheduler *tmp = ACE_static_cast (FP_Scheduler *, _tao_void_pointer); + CORBA::release (tmp); +} + +FP_Scheduling::FP_Scheduler_ptr +FP_Scheduling::FP_Scheduler::_narrow ( + CORBA::Object_ptr obj + ACE_ENV_ARG_DECL + ) +{ + return FP_Scheduler::_unchecked_narrow (obj ACE_ENV_ARG_PARAMETER); +} + +FP_Scheduling::FP_Scheduler_ptr +FP_Scheduling::FP_Scheduler::_unchecked_narrow ( + CORBA::Object_ptr obj + ACE_ENV_ARG_DECL_NOT_USED + ) +{ + if (CORBA::is_nil (obj)) + { + return FP_Scheduler::_nil (); + } + + return + ACE_reinterpret_cast ( + FP_Scheduler_ptr, + obj->_tao_QueryInterface ( + ACE_reinterpret_cast ( + ptrdiff_t, + &FP_Scheduler::_tao_class_id + ) + ) + ); +} + +FP_Scheduling::FP_Scheduler_ptr +FP_Scheduling::FP_Scheduler::_duplicate (FP_Scheduler_ptr obj) +{ + if (! CORBA::is_nil (obj)) + { + obj->_add_ref (); + } + + return obj; +} + +void *FP_Scheduling::FP_Scheduler::_tao_QueryInterface (ptrdiff_t type) +{ + void *retv = 0; + + if (type == ACE_reinterpret_cast ( + ptrdiff_t, + &::RTScheduling::Scheduler::_tao_class_id) + ) + { + retv = + ACE_reinterpret_cast ( + void *, + ACE_static_cast ( + RTScheduling::Scheduler_ptr, + this + ) + ); + } + else if (type == ACE_reinterpret_cast ( + ptrdiff_t, + &ACE_NESTED_CLASS (::FP_Scheduling, FP_Scheduler)::_tao_class_id) + ) + { + retv = ACE_reinterpret_cast (void*, this); + } + else if (type == ACE_reinterpret_cast ( + ptrdiff_t, + &CORBA::Object::_tao_class_id) + ) + { + retv = + ACE_reinterpret_cast ( + void *, + ACE_static_cast (CORBA::Object_ptr, this) + ); + } + + if (retv != 0) + { + this->_add_ref (); + } + + return retv; +} + +const char* FP_Scheduling::FP_Scheduler::_interface_repository_id (void) const +{ + return "IDL:FP_Scheduling/FP_Scheduler:1.0"; +} + +CORBA::Boolean +FP_Scheduling::FP_Scheduler::marshal (TAO_OutputCDR &) +{ + return 0; +} + +// TAO_IDL - Generated from +// be/be_visitor_typecode/typecode_defn.cpp:284 + +static const CORBA::Long _oc_FP_Scheduling_FP_Scheduler[] = +{ + TAO_ENCAP_BYTE_ORDER, // byte order + 35, + ACE_NTOHL (0x49444c3a), + ACE_NTOHL (0x46505f53), + ACE_NTOHL (0x63686564), + ACE_NTOHL (0x756c696e), + ACE_NTOHL (0x672f4650), + ACE_NTOHL (0x5f536368), + ACE_NTOHL (0x6564756c), + ACE_NTOHL (0x65723a31), + ACE_NTOHL (0x2e300000), // repository ID = IDL:FP_Scheduling/FP_Scheduler:1.0 + 13, + ACE_NTOHL (0x46505f53), + ACE_NTOHL (0x63686564), + ACE_NTOHL (0x756c6572), + ACE_NTOHL (0x0), // name = FP_Scheduler + }; + +static CORBA::TypeCode _tc_TAO_tc_FP_Scheduling_FP_Scheduler ( + CORBA::tk_objref, + sizeof (_oc_FP_Scheduling_FP_Scheduler), + (char *) &_oc_FP_Scheduling_FP_Scheduler, + 0, + sizeof (FP_Scheduling::FP_Scheduler) + ); + +TAO_NAMESPACE_TYPE (CORBA::TypeCode_ptr) +TAO_NAMESPACE_BEGIN (FP_Scheduling) +TAO_NAMESPACE_DEFINE ( + ::CORBA::TypeCode_ptr, + _tc_FP_Scheduler, + &_tc_TAO_tc_FP_Scheduling_FP_Scheduler + ) +TAO_NAMESPACE_END + +// TAO_IDL - Generated from +// be/be_visitor_structure/any_op_cs.cpp:54 + +// Copying insertion. +void operator<<= ( + CORBA::Any &_tao_any, + const FP_Scheduling::SegmentSchedulingParameter &_tao_elem + ) +{ + TAO::Any_Dual_Impl_T<FP_Scheduling::SegmentSchedulingParameter>::insert_copy ( + _tao_any, + FP_Scheduling::SegmentSchedulingParameter::_tao_any_destructor, + FP_Scheduling::_tc_SegmentSchedulingParameter, + _tao_elem + ); +} + +// Non-copying insertion. +void operator<<= ( + CORBA::Any &_tao_any, + FP_Scheduling::SegmentSchedulingParameter *_tao_elem + ) +{ + TAO::Any_Dual_Impl_T<FP_Scheduling::SegmentSchedulingParameter>::insert ( + _tao_any, + FP_Scheduling::SegmentSchedulingParameter::_tao_any_destructor, + FP_Scheduling::_tc_SegmentSchedulingParameter, + _tao_elem + ); +} + +// Extraction to non-const pointer (deprecated). +CORBA::Boolean operator>>= ( + const CORBA::Any &_tao_any, + FP_Scheduling::SegmentSchedulingParameter *&_tao_elem + ) +{ + return _tao_any >>= ACE_const_cast ( + const FP_Scheduling::SegmentSchedulingParameter *&, + _tao_elem + ); +} + +// Extraction to const pointer. +CORBA::Boolean operator>>= ( + const CORBA::Any &_tao_any, + const FP_Scheduling::SegmentSchedulingParameter *&_tao_elem + ) +{ + return + TAO::Any_Dual_Impl_T<FP_Scheduling::SegmentSchedulingParameter>::extract ( + _tao_any, + FP_Scheduling::SegmentSchedulingParameter::_tao_any_destructor, + FP_Scheduling::_tc_SegmentSchedulingParameter, + _tao_elem + ); +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) || \ + defined (ACE_HAS_GNU_REPO) + template class TAO::Any_Dual_Impl_T<FP_Scheduling::SegmentSchedulingParameter>; +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +# pragma instantiate TAO::Any_Dual_Impl_T<FP_Scheduling::SegmentSchedulingParameter> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + +// TAO_IDL - Generated from +// be/be_visitor_interface/any_op_cs.cpp:50 + +// Copying insertion. +void +operator<<= ( + CORBA::Any &_tao_any, + FP_Scheduling::SegmentSchedulingParameterPolicy_ptr _tao_elem + ) +{ + FP_Scheduling::SegmentSchedulingParameterPolicy_ptr _tao_objptr = + FP_Scheduling::SegmentSchedulingParameterPolicy::_duplicate (_tao_elem); + _tao_any <<= &_tao_objptr; +} + +// Non-copying insertion. +void +operator<<= ( + CORBA::Any &_tao_any, + FP_Scheduling::SegmentSchedulingParameterPolicy_ptr *_tao_elem + ) +{ + TAO::Any_Impl_T<FP_Scheduling::SegmentSchedulingParameterPolicy>::insert ( + _tao_any, + FP_Scheduling::SegmentSchedulingParameterPolicy::_tao_any_destructor, + FP_Scheduling::_tc_SegmentSchedulingParameterPolicy, + *_tao_elem + ); +} + +CORBA::Boolean +operator>>= ( + const CORBA::Any &_tao_any, + FP_Scheduling::SegmentSchedulingParameterPolicy_ptr &_tao_elem + ) +{ + return + TAO::Any_Impl_T<FP_Scheduling::SegmentSchedulingParameterPolicy>::extract ( + _tao_any, + FP_Scheduling::SegmentSchedulingParameterPolicy::_tao_any_destructor, + FP_Scheduling::_tc_SegmentSchedulingParameterPolicy, + _tao_elem + ); +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) || \ + defined (ACE_HAS_GNU_REPO) + template class TAO::Any_Impl_T<FP_Scheduling::SegmentSchedulingParameterPolicy>; +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +# pragma instantiate TAO::Any_Impl_T<FP_Scheduling::SegmentSchedulingParameterPolicy> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + +// TAO_IDL - Generated from +// be/be_visitor_interface/any_op_cs.cpp:50 + +// Copying insertion. +void +operator<<= ( + CORBA::Any &_tao_any, + FP_Scheduling::FP_Scheduler_ptr _tao_elem + ) +{ + FP_Scheduling::FP_Scheduler_ptr _tao_objptr = + FP_Scheduling::FP_Scheduler::_duplicate (_tao_elem); + _tao_any <<= &_tao_objptr; +} + +// Non-copying insertion. +void +operator<<= ( + CORBA::Any &_tao_any, + FP_Scheduling::FP_Scheduler_ptr *_tao_elem + ) +{ + TAO::Any_Impl_T<FP_Scheduling::FP_Scheduler>::insert ( + _tao_any, + FP_Scheduling::FP_Scheduler::_tao_any_destructor, + FP_Scheduling::_tc_FP_Scheduler, + *_tao_elem + ); +} + +CORBA::Boolean +operator>>= ( + const CORBA::Any &_tao_any, + FP_Scheduling::FP_Scheduler_ptr &_tao_elem + ) +{ + return + TAO::Any_Impl_T<FP_Scheduling::FP_Scheduler>::extract ( + _tao_any, + FP_Scheduling::FP_Scheduler::_tao_any_destructor, + FP_Scheduling::_tc_FP_Scheduler, + _tao_elem + ); +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) || \ + defined (ACE_HAS_GNU_REPO) + template class TAO::Any_Impl_T<FP_Scheduling::FP_Scheduler>; +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +# pragma instantiate TAO::Any_Impl_T<FP_Scheduling::FP_Scheduler> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + diff --git a/TAO/examples/Kokyu_dsrt_schedulers/FP_SchedulingC.h b/TAO/examples/Kokyu_dsrt_schedulers/FP_SchedulingC.h new file mode 100644 index 00000000000..5a2e935c722 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/FP_SchedulingC.h @@ -0,0 +1,407 @@ +// -*- C++ -*- +// +// $Id$ + +// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** +// TAO and the TAO IDL Compiler have been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// and +// Distributed Object Computing Laboratory +// University of California at Irvine +// Irvine, CA +// USA +// http://doc.ece.uci.edu/ +// and +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +// TAO_IDL - Generated from +// be/be_codegen.cpp:151 + +#ifndef _TAO_IDL_FP_SCHEDULINGC_H_ +#define _TAO_IDL_FP_SCHEDULINGC_H_ + + +#include "tao/corba.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + + +#include "Kokyu_dsrt_schedulers_export.h" + +#include "tao/RTScheduling/RTScheduler.h" +#include "tao/RTCORBA/RTCORBA.h" + +#if defined (TAO_EXPORT_MACRO) +#undef TAO_EXPORT_MACRO +#endif +#define TAO_EXPORT_MACRO Kokyu_DSRT_Schedulers_Export + +#if defined (TAO_EXPORT_NESTED_CLASSES) +# if defined (TAO_EXPORT_NESTED_MACRO) +# undef TAO_EXPORT_NESTED_MACRO +# endif /* defined (TAO_EXPORT_NESTED_MACRO) */ +# define TAO_EXPORT_NESTED_MACRO Kokyu_DSRT_Schedulers_Export +#endif /* TAO_EXPORT_NESTED_CLASSES */ + +#if defined(_MSC_VER) +#if (_MSC_VER >= 1200) +#pragma warning(push) +#endif /* _MSC_VER >= 1200 */ +#pragma warning(disable:4250) +#endif /* _MSC_VER */ + +#if defined (__BORLANDC__) +#pragma option push -w-rvl -w-rch -w-ccc -w-inl +#endif /* __BORLANDC__ */ + +// TAO_IDL - Generated from +// be/be_visitor_module/module_ch.cpp:48 + +TAO_NAMESPACE FP_Scheduling +{ + + // TAO_IDL - Generated from + // be/be_type.cpp:254 + + struct SegmentSchedulingParameter; + + typedef + TAO_Fixed_Var_T< + SegmentSchedulingParameter + > + SegmentSchedulingParameter_var; + + typedef + SegmentSchedulingParameter & + SegmentSchedulingParameter_out; + + // TAO_IDL - Generated from + // be/be_visitor_structure/structure_ch.cpp:52 + + struct Kokyu_DSRT_Schedulers_Export SegmentSchedulingParameter + { + typedef SegmentSchedulingParameter_var _var_type; + + static void _tao_any_destructor (void *); + RTCORBA::Priority base_priority; + }; + + // TAO_IDL - Generated from + // be/be_visitor_typecode/typecode_decl.cpp:44 + + TAO_NAMESPACE_STORAGE_CLASS ::CORBA::TypeCode_ptr _tc_SegmentSchedulingParameter; + + // TAO_IDL - Generated from + // be/be_interface.cpp:584 + +#if !defined (_FP_SCHEDULING_SEGMENTSCHEDULINGPARAMETERPOLICY__ODDS_N_ENDS_CH_) +#define _FP_SCHEDULING_SEGMENTSCHEDULINGPARAMETERPOLICY__ODDS_N_ENDS_CH_ + + class SegmentSchedulingParameterPolicy; + typedef SegmentSchedulingParameterPolicy *SegmentSchedulingParameterPolicy_ptr; + struct tao_SegmentSchedulingParameterPolicy_life; + + typedef + TAO_Objref_Var_T< + SegmentSchedulingParameterPolicy, + tao_SegmentSchedulingParameterPolicy_life + > + SegmentSchedulingParameterPolicy_var; + + typedef + TAO_Objref_Out_T< + SegmentSchedulingParameterPolicy, + tao_SegmentSchedulingParameterPolicy_life + > + SegmentSchedulingParameterPolicy_out; + + struct Kokyu_DSRT_Schedulers_Export tao_SegmentSchedulingParameterPolicy_life + { + static SegmentSchedulingParameterPolicy_ptr tao_duplicate (SegmentSchedulingParameterPolicy_ptr); + static void tao_release (SegmentSchedulingParameterPolicy_ptr); + static SegmentSchedulingParameterPolicy_ptr tao_nil (void); + static CORBA::Boolean tao_marshal ( + SegmentSchedulingParameterPolicy_ptr, + TAO_OutputCDR & + ); + }; + + struct Kokyu_DSRT_Schedulers_Export tao_SegmentSchedulingParameterPolicy_cast + { + static SegmentSchedulingParameterPolicy_ptr tao_narrow ( + CORBA::Object_ptr + ACE_ENV_ARG_DECL + ); + static CORBA::Object_ptr tao_upcast (void *); + }; + +#endif /* end #if !defined */ + + // TAO_IDL - Generated from + // be/be_visitor_interface/interface_ch.cpp:53 + +#if !defined (_FP_SCHEDULING_SEGMENTSCHEDULINGPARAMETERPOLICY_CH_) +#define _FP_SCHEDULING_SEGMENTSCHEDULINGPARAMETERPOLICY_CH_ + + class Kokyu_DSRT_Schedulers_Export SegmentSchedulingParameterPolicy + : public virtual CORBA::Policy + { + public: + typedef SegmentSchedulingParameterPolicy_ptr _ptr_type; + typedef SegmentSchedulingParameterPolicy_var _var_type; + static int _tao_class_id; + + // The static operations. + static SegmentSchedulingParameterPolicy_ptr _duplicate (SegmentSchedulingParameterPolicy_ptr obj); + + static SegmentSchedulingParameterPolicy_ptr _narrow ( + CORBA::Object_ptr obj + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ); + + static SegmentSchedulingParameterPolicy_ptr _unchecked_narrow ( + CORBA::Object_ptr obj + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ); + + static SegmentSchedulingParameterPolicy_ptr _nil (void) + { + return (SegmentSchedulingParameterPolicy_ptr)0; + } + + static void _tao_any_destructor (void *); + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual ::FP_Scheduling::SegmentSchedulingParameter value ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual void value ( + const FP_Scheduling::SegmentSchedulingParameter & value + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_interface/interface_ch.cpp:210 + + virtual void *_tao_QueryInterface (ptrdiff_t type); + + virtual const char* _interface_repository_id (void) const; + virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr); + + protected: + SegmentSchedulingParameterPolicy (void); + virtual ~SegmentSchedulingParameterPolicy (void); + + private: + SegmentSchedulingParameterPolicy (const SegmentSchedulingParameterPolicy &); + void operator= (const SegmentSchedulingParameterPolicy &); + }; + +#endif /* end #if !defined */ + + // TAO_IDL - Generated from + // be/be_visitor_typecode/typecode_decl.cpp:44 + + TAO_NAMESPACE_STORAGE_CLASS ::CORBA::TypeCode_ptr _tc_SegmentSchedulingParameterPolicy; + + // TAO_IDL - Generated from + // be/be_interface.cpp:584 + +#if !defined (_FP_SCHEDULING_FP_SCHEDULER__ODDS_N_ENDS_CH_) +#define _FP_SCHEDULING_FP_SCHEDULER__ODDS_N_ENDS_CH_ + + class FP_Scheduler; + typedef FP_Scheduler *FP_Scheduler_ptr; + struct tao_FP_Scheduler_life; + + typedef + TAO_Objref_Var_T< + FP_Scheduler, + tao_FP_Scheduler_life + > + FP_Scheduler_var; + + typedef + TAO_Objref_Out_T< + FP_Scheduler, + tao_FP_Scheduler_life + > + FP_Scheduler_out; + + struct Kokyu_DSRT_Schedulers_Export tao_FP_Scheduler_life + { + static FP_Scheduler_ptr tao_duplicate (FP_Scheduler_ptr); + static void tao_release (FP_Scheduler_ptr); + static FP_Scheduler_ptr tao_nil (void); + static CORBA::Boolean tao_marshal ( + FP_Scheduler_ptr, + TAO_OutputCDR & + ); + }; + + struct Kokyu_DSRT_Schedulers_Export tao_FP_Scheduler_cast + { + static FP_Scheduler_ptr tao_narrow ( + CORBA::Object_ptr + ACE_ENV_ARG_DECL + ); + static CORBA::Object_ptr tao_upcast (void *); + }; + +#endif /* end #if !defined */ + + // TAO_IDL - Generated from + // be/be_visitor_interface/interface_ch.cpp:53 + +#if !defined (_FP_SCHEDULING_FP_SCHEDULER_CH_) +#define _FP_SCHEDULING_FP_SCHEDULER_CH_ + + class Kokyu_DSRT_Schedulers_Export FP_Scheduler + : public virtual RTScheduling::Scheduler + { + public: + typedef FP_Scheduler_ptr _ptr_type; + typedef FP_Scheduler_var _var_type; + static int _tao_class_id; + + // The static operations. + static FP_Scheduler_ptr _duplicate (FP_Scheduler_ptr obj); + + static FP_Scheduler_ptr _narrow ( + CORBA::Object_ptr obj + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ); + + static FP_Scheduler_ptr _unchecked_narrow ( + CORBA::Object_ptr obj + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ); + + static FP_Scheduler_ptr _nil (void) + { + return (FP_Scheduler_ptr)0; + } + + static void _tao_any_destructor (void *); + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual ::FP_Scheduling::SegmentSchedulingParameterPolicy_ptr create_segment_scheduling_parameter ( + const FP_Scheduling::SegmentSchedulingParameter & value + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_interface/interface_ch.cpp:210 + + virtual void *_tao_QueryInterface (ptrdiff_t type); + + virtual const char* _interface_repository_id (void) const; + virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr); + + protected: + FP_Scheduler (void); + virtual ~FP_Scheduler (void); + + private: + FP_Scheduler (const FP_Scheduler &); + void operator= (const FP_Scheduler &); + }; + +#endif /* end #if !defined */ + + // TAO_IDL - Generated from + // be/be_visitor_typecode/typecode_decl.cpp:44 + + TAO_NAMESPACE_STORAGE_CLASS ::CORBA::TypeCode_ptr _tc_FP_Scheduler; + +// TAO_IDL - Generated from +// be/be_visitor_module/module_ch.cpp:67 + +} +TAO_NAMESPACE_CLOSE // module FP_Scheduling + +// TAO_IDL - Generated from +// be/be_visitor_structure/any_op_ch.cpp:52 + +Kokyu_DSRT_Schedulers_Export void operator<<= (CORBA::Any &, const FP_Scheduling::SegmentSchedulingParameter &); // copying version +Kokyu_DSRT_Schedulers_Export void operator<<= (CORBA::Any &, FP_Scheduling::SegmentSchedulingParameter*); // noncopying version +Kokyu_DSRT_Schedulers_Export CORBA::Boolean operator>>= (const CORBA::Any &, FP_Scheduling::SegmentSchedulingParameter *&); // deprecated +Kokyu_DSRT_Schedulers_Export CORBA::Boolean operator>>= (const CORBA::Any &, const FP_Scheduling::SegmentSchedulingParameter *&); + +// TAO_IDL - Generated from +// be/be_visitor_interface/any_op_ch.cpp:52 + +Kokyu_DSRT_Schedulers_Export void operator<<= (CORBA::Any &, FP_Scheduling::SegmentSchedulingParameterPolicy_ptr); // copying +Kokyu_DSRT_Schedulers_Export void operator<<= (CORBA::Any &, FP_Scheduling::SegmentSchedulingParameterPolicy_ptr *); // non-copying +Kokyu_DSRT_Schedulers_Export CORBA::Boolean operator>>= (const CORBA::Any &, FP_Scheduling::SegmentSchedulingParameterPolicy_ptr &); + +// TAO_IDL - Generated from +// be/be_visitor_interface/any_op_ch.cpp:52 + +Kokyu_DSRT_Schedulers_Export void operator<<= (CORBA::Any &, FP_Scheduling::FP_Scheduler_ptr); // copying +Kokyu_DSRT_Schedulers_Export void operator<<= (CORBA::Any &, FP_Scheduling::FP_Scheduler_ptr *); // non-copying +Kokyu_DSRT_Schedulers_Export CORBA::Boolean operator>>= (const CORBA::Any &, FP_Scheduling::FP_Scheduler_ptr &); + +// TAO_IDL - Generated from +// be/be_visitor_root/cdr_op.cpp:48 + +#ifndef __ACE_INLINE__ + +// TAO_IDL - Generated from +// be/be_visitor_structure/cdr_op_ch.cpp:53 + +Kokyu_DSRT_Schedulers_Export CORBA::Boolean operator<< (TAO_OutputCDR &, const FP_Scheduling::SegmentSchedulingParameter &); +Kokyu_DSRT_Schedulers_Export CORBA::Boolean operator>> (TAO_InputCDR &, FP_Scheduling::SegmentSchedulingParameter &); + +// TAO_IDL - Generated from +// be/be_visitor_root/cdr_op.cpp:64 + +#endif /* __ACE_INLINE__ */ + +// TAO_IDL - Generated from +// be/be_codegen.cpp:1060 + +#if defined (__ACE_INLINE__) +#include "FP_SchedulingC.i" +#endif /* defined INLINE */ + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +#pragma warning(pop) +#endif /* _MSC_VER */ + +#if defined (__BORLANDC__) +#pragma option pop +#endif /* __BORLANDC__ */ + +#endif /* ifndef */ + diff --git a/TAO/examples/Kokyu_dsrt_schedulers/FP_SchedulingC.h.diff b/TAO/examples/Kokyu_dsrt_schedulers/FP_SchedulingC.h.diff new file mode 100644 index 00000000000..953dc628d52 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/FP_SchedulingC.h.diff @@ -0,0 +1,13 @@ +--- FP_SchedulingC.h.orig Mon Sep 1 11:06:33 2003 ++++ FP_SchedulingC.h Mon Sep 1 11:06:58 2003 +@@ -41,8 +41,8 @@ + + #include "Kokyu_dsrt_schedulers_export.h" + +-#include "tao/RTScheduling/RTSchedulerC.h" +-#include "tao/RTCORBA/RTCORBAC.h" ++#include "tao/RTScheduling/RTScheduler.h" ++#include "tao/RTCORBA/RTCORBA.h" + + #if defined (TAO_EXPORT_MACRO) + #undef TAO_EXPORT_MACRO diff --git a/TAO/examples/Kokyu_dsrt_schedulers/FP_SchedulingC.i b/TAO/examples/Kokyu_dsrt_schedulers/FP_SchedulingC.i new file mode 100644 index 00000000000..9ca1ba7b10f --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/FP_SchedulingC.i @@ -0,0 +1,121 @@ +// -*- C++ -*- +// +// $Id$ + +// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** +// TAO and the TAO IDL Compiler have been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// and +// Distributed Object Computing Laboratory +// University of California at Irvine +// Irvine, CA +// USA +// http://doc.ece.uci.edu/ +// and +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + + +// TAO_IDL - Generated from +// be/be_visitor_interface/interface_ci.cpp:63 + +#if !defined (_FP_SCHEDULING_SEGMENTSCHEDULINGPARAMETERPOLICY___CI_) +#define _FP_SCHEDULING_SEGMENTSCHEDULINGPARAMETERPOLICY___CI_ + +template<> +ACE_INLINE +CORBA::Boolean +TAO::Any_Impl_T<FP_Scheduling::SegmentSchedulingParameterPolicy>::to_object ( + CORBA::Object_ptr &_tao_elem + ) const +{ + _tao_elem = CORBA::Object::_duplicate (this->value_); + return 1; +} + +template<> +ACE_INLINE +CORBA::Boolean +TAO::Any_Impl_T<FP_Scheduling::SegmentSchedulingParameterPolicy>::marshal_value (TAO_OutputCDR &) +{ + return 0; +} + +template<> +ACE_INLINE +CORBA::Boolean +TAO::Any_Impl_T<FP_Scheduling::SegmentSchedulingParameterPolicy>::demarshal_value (TAO_InputCDR &) +{ + return 0; +} + +#endif /* end #if !defined */ + +// TAO_IDL - Generated from +// be/be_visitor_interface/interface_ci.cpp:63 + +#if !defined (_FP_SCHEDULING_FP_SCHEDULER___CI_) +#define _FP_SCHEDULING_FP_SCHEDULER___CI_ + +template<> +ACE_INLINE +CORBA::Boolean +TAO::Any_Impl_T<FP_Scheduling::FP_Scheduler>::to_object ( + CORBA::Object_ptr &_tao_elem + ) const +{ + _tao_elem = CORBA::Object::_duplicate (this->value_); + return 1; +} + +template<> +ACE_INLINE +CORBA::Boolean +TAO::Any_Impl_T<FP_Scheduling::FP_Scheduler>::marshal_value (TAO_OutputCDR &) +{ + return 0; +} + +template<> +ACE_INLINE +CORBA::Boolean +TAO::Any_Impl_T<FP_Scheduling::FP_Scheduler>::demarshal_value (TAO_InputCDR &) +{ + return 0; +} + +#endif /* end #if !defined */ + +// TAO_IDL - Generated from +// be/be_visitor_structure/cdr_op_ci.cpp:70 + +ACE_INLINE +CORBA::Boolean operator<< ( + TAO_OutputCDR &strm, + const FP_Scheduling::SegmentSchedulingParameter &_tao_aggregate + ) +{ + return + (strm << _tao_aggregate.base_priority); +} + +ACE_INLINE +CORBA::Boolean operator>> ( + TAO_InputCDR &strm, + FP_Scheduling::SegmentSchedulingParameter &_tao_aggregate + ) +{ + return + (strm >> _tao_aggregate.base_priority); +} + diff --git a/TAO/examples/Kokyu_dsrt_schedulers/Kokyu_DSRT_Schedulers.dsp b/TAO/examples/Kokyu_dsrt_schedulers/Kokyu_DSRT_Schedulers.dsp new file mode 100644 index 00000000000..970eb5b299d --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/Kokyu_DSRT_Schedulers.dsp @@ -0,0 +1,183 @@ +# Microsoft Developer Studio Project File - Name="Kokyu_DSRT_Schedulers" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=Kokyu_DSRT_Schedulers - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE run the tool that generated this project file and specify the
+!MESSAGE nmake output type. You can then use the following command:
+!MESSAGE
+!MESSAGE NMAKE /f "Kokyu_DSRT_Schedulers.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "Kokyu_DSRT_Schedulers.mak" CFG="Kokyu_DSRT_Schedulers - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "Kokyu_DSRT_Schedulers - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "Kokyu_DSRT_Schedulers - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "Kokyu_DSRT_Schedulers - Win32 Release"
+
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "."
+# PROP Intermediate_Dir "Release\Kokyu_DSRT_Schedulers"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD CPP /nologo /O2 /W3 /GX /MD /Zi /GR /I "..\.." /I "..\..\.." /I "..\..\tao\RTScheduling" /I "..\..\tao\RTCORBA" /I "..\..\..\Kokyu" /D NDEBUG /D WIN32 /D _WINDOWS /D KOKYU_DSRT_SCHEDULERS_BUILD_DLL /FD /c
+# SUBTRACT CPP /YX
+# ADD RSC /l 0x409 /d NDEBUG /i "..\.." /i "..\..\.." /i "..\..\tao\RTScheduling" /i "..\..\tao\RTCORBA" /i "..\..\..\Kokyu"
+BSC32=bscmake.exe
+# ADD BSC32 /nologo /o".\Kokyu_DSRT_Schedulers.bsc"
+LINK32=link.exe
+# ADD LINK32 advapi32.lib user32.lib /INCREMENTAL:NO TAO_RTScheduler.lib Kokyu.lib TAO_RTCORBA.lib ACE.lib TAO.lib /libpath:"..\..\examples\Kokyu_dsrt_schedulers" /libpath:"..\..\tao" /libpath:"..\..\..\ace" /libpath:"..\..\tao\RTCORBA" /libpath:"..\..\tao\RTScheduling" /libpath:"..\..\..\Kokyu" /nologo /version:1.0 /subsystem:windows /pdb:".\Kokyu_DSRT_Schedulers.pdb" /dll /machine:I386 /out:".\Kokyu_DSRT_Schedulers.dll"
+
+!ELSEIF "$(CFG)" == "Kokyu_DSRT_Schedulers - Win32 Debug"
+
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "."
+# PROP Intermediate_Dir "Debug\Kokyu_DSRT_Schedulers"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD CPP /nologo /Ob0 /W3 /Gm /GX /Zi /MDd /GR /Gy /I "..\.." /I "..\..\.." /I "..\..\tao\RTScheduling" /I "..\..\tao\RTCORBA" /I "..\..\..\Kokyu" /D _DEBUG /D WIN32 /D _WINDOWS /D KOKYU_DSRT_SCHEDULERS_BUILD_DLL /FD /c
+# SUBTRACT CPP /Fr /YX
+# ADD RSC /l 0x409 /d _DEBUG /i "..\.." /i "..\..\.." /i "..\..\tao\RTScheduling" /i "..\..\tao\RTCORBA" /i "..\..\..\Kokyu"
+BSC32=bscmake.exe
+# ADD BSC32 /nologo /o".\Kokyu_DSRT_Schedulers.bsc"
+LINK32=link.exe
+# ADD LINK32 advapi32.lib user32.lib /INCREMENTAL:NO TAO_RTSchedulerd.lib Kokyud.lib TAO_RTCORBAd.lib ACEd.lib TAOd.lib /libpath:"..\..\examples\Kokyu_dsrt_schedulers" /libpath:"..\..\tao" /libpath:"..\..\..\ace" /libpath:"..\..\tao\RTCORBA" /libpath:"..\..\tao\RTScheduling" /libpath:"..\..\..\Kokyu" /nologo /version:1.0 /subsystem:windows /pdb:".\Kokyu_DSRT_Schedulersd.pdb" /dll /debug /machine:I386 /out:".\Kokyu_DSRT_Schedulersd.dll"
+
+!ENDIF
+
+# Begin Target
+
+# Name "Kokyu_DSRT_Schedulers - Win32 Release"
+# Name "Kokyu_DSRT_Schedulers - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;cxx;c"
+# Begin Source File
+
+SOURCE=".\FP_Scheduler.cpp"
+# End Source File
+# Begin Source File
+
+SOURCE=".\FP_SchedulingC.cpp"
+# End Source File
+# Begin Source File
+
+SOURCE=".\Kokyu_qosC.cpp"
+# End Source File
+# Begin Source File
+
+SOURCE=".\MIF_Scheduler.cpp"
+# End Source File
+# Begin Source File
+
+SOURCE=".\MIF_SchedulingC.cpp"
+# End Source File
+# Begin Source File
+
+SOURCE=".\MUF_Scheduler.cpp"
+# End Source File
+# Begin Source File
+
+SOURCE=".\MUF_SchedulingC.cpp"
+# End Source File
+# Begin Source File
+
+SOURCE=".\Task_Stats.cpp"
+# End Source File
+# Begin Source File
+
+SOURCE=".\utils.cpp"
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hh"
+# Begin Source File
+
+SOURCE=".\FP_Scheduler.h"
+# End Source File
+# Begin Source File
+
+SOURCE=".\FP_SchedulingC.h"
+# End Source File
+# Begin Source File
+
+SOURCE=".\Kokyu_qosC.h"
+# End Source File
+# Begin Source File
+
+SOURCE=".\MIF_Scheduler.h"
+# End Source File
+# Begin Source File
+
+SOURCE=".\MIF_SchedulingC.h"
+# End Source File
+# Begin Source File
+
+SOURCE=".\MUF_Scheduler.h"
+# End Source File
+# Begin Source File
+
+SOURCE=".\MUF_SchedulingC.h"
+# End Source File
+# Begin Source File
+
+SOURCE=".\Task_Stats.h"
+# End Source File
+# Begin Source File
+
+SOURCE=".\utils.h"
+# End Source File
+# End Group
+# Begin Group "Inline Files"
+
+# PROP Default_Filter "i;inl"
+# Begin Source File
+
+SOURCE=".\FP_SchedulingC.i"
+# End Source File
+# Begin Source File
+
+SOURCE=".\Kokyu_qosC.i"
+# End Source File
+# Begin Source File
+
+SOURCE=".\MIF_SchedulingC.i"
+# End Source File
+# Begin Source File
+
+SOURCE=".\MUF_SchedulingC.i"
+# End Source File
+# Begin Source File
+
+SOURCE=".\Task_Stats.inl"
+# End Source File
+# End Group
+# Begin Group "Documentation"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=".\README"
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/examples/Kokyu_dsrt_schedulers/Kokyu_DSRT_Schedulers.dsw b/TAO/examples/Kokyu_dsrt_schedulers/Kokyu_DSRT_Schedulers.dsw new file mode 100644 index 00000000000..666562f90d7 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/Kokyu_DSRT_Schedulers.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "Kokyu_DSRT_Schedulers"=Kokyu_DSRT_Schedulers.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/TAO/examples/Kokyu_dsrt_schedulers/Kokyu_DSRT_Schedulers.mpc b/TAO/examples/Kokyu_dsrt_schedulers/Kokyu_DSRT_Schedulers.mpc new file mode 100644 index 00000000000..4a4f0551be9 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/Kokyu_DSRT_Schedulers.mpc @@ -0,0 +1,30 @@ +project(Kokyu_DSRT_Schedulers){ + + sharedname = Kokyu_DSRT_Schedulers + dynamicflags = KOKYU_DSRT_SCHEDULERS_BUILD_DLL + includes += $(TAO_ROOT) \ + $(ACE_ROOT) \ + $(TAO_ROOT)/tao/RTScheduling \ + $(TAO_ROOT)/tao/RTCORBA \ + $(ACE_ROOT)/Kokyu + + libs += TAO_RTScheduler Kokyu TAO_RTCORBA ACE TAO + libpaths += $(TAO_ROOT)/examples/Kokyu_dsrt_schedulers \ + $(TAO_ROOT)/tao \ + $(ACE_ROOT)/ace \ + $(TAO_ROOT)/tao/RTCORBA \ + $(TAO_ROOT)/tao/RTScheduling \ + $(ACE_ROOT)/Kokyu + + Source_Files { + FP_Scheduler.cpp + MUF_Scheduler.cpp + MIF_Scheduler.cpp + Task_Stats.cpp + utils.cpp + Kokyu_qosC.cpp + FP_SchedulingC.cpp + MUF_SchedulingC.cpp + MIF_SchedulingC.cpp + } +} diff --git a/TAO/examples/Kokyu_dsrt_schedulers/Kokyu_dsrt_schedulers_export.h b/TAO/examples/Kokyu_dsrt_schedulers/Kokyu_dsrt_schedulers_export.h new file mode 100644 index 00000000000..4d9236a75f2 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/Kokyu_dsrt_schedulers_export.h @@ -0,0 +1,54 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl -s Kokyu_DSRT_Schedulers +// ------------------------------ +#ifndef KOKYU_DSRT_SCHEDULERS_EXPORT_H +#define KOKYU_DSRT_SCHEDULERS_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (KOKYU_DSRT_SCHEDULERS_HAS_DLL) +# define KOKYU_DSRT_SCHEDULERS_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && KOKYU_DSRT_SCHEDULERS_HAS_DLL */ + +#if !defined (KOKYU_DSRT_SCHEDULERS_HAS_DLL) +# define KOKYU_DSRT_SCHEDULERS_HAS_DLL 1 +#endif /* ! KOKYU_DSRT_SCHEDULERS_HAS_DLL */ + +#if defined (KOKYU_DSRT_SCHEDULERS_HAS_DLL) && (KOKYU_DSRT_SCHEDULERS_HAS_DLL == 1) +# if defined (KOKYU_DSRT_SCHEDULERS_BUILD_DLL) +# define Kokyu_DSRT_Schedulers_Export ACE_Proper_Export_Flag +# define KOKYU_DSRT_SCHEDULERS_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define KOKYU_DSRT_SCHEDULERS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* KOKYU_DSRT_SCHEDULERS_BUILD_DLL */ +# define Kokyu_DSRT_Schedulers_Export ACE_Proper_Import_Flag +# define KOKYU_DSRT_SCHEDULERS_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define KOKYU_DSRT_SCHEDULERS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* KOKYU_DSRT_SCHEDULERS_BUILD_DLL */ +#else /* KOKYU_DSRT_SCHEDULERS_HAS_DLL == 1 */ +# define Kokyu_DSRT_Schedulers_Export +# define KOKYU_DSRT_SCHEDULERS_SINGLETON_DECLARATION(T) +# define KOKYU_DSRT_SCHEDULERS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* KOKYU_DSRT_SCHEDULERS_HAS_DLL == 1 */ + +// Set KOKYU_DSRT_SCHEDULERS_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (KOKYU_DSRT_SCHEDULERS_NTRACE) +# if (ACE_NTRACE == 1) +# define KOKYU_DSRT_SCHEDULERS_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define KOKYU_DSRT_SCHEDULERS_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !KOKYU_DSRT_SCHEDULERS_NTRACE */ + +#if (KOKYU_DSRT_SCHEDULERS_NTRACE == 1) +# define KOKYU_DSRT_SCHEDULERS_TRACE(X) +#else /* (KOKYU_DSRT_SCHEDULERS_NTRACE == 1) */ +# define KOKYU_DSRT_SCHEDULERS_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (KOKYU_DSRT_SCHEDULERS_NTRACE == 1) */ + +#endif /* KOKYU_DSRT_SCHEDULERS_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/examples/Kokyu_dsrt_schedulers/Kokyu_qos.pidl b/TAO/examples/Kokyu_dsrt_schedulers/Kokyu_qos.pidl new file mode 100644 index 00000000000..69997034657 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/Kokyu_qos.pidl @@ -0,0 +1,58 @@ + +/** + * @file Kokyu_qos.pidl + * + * $Id$ + * + * @brief Pre-compiled IDL source to help with the service context + * propagation of dynamic scheduling parameters using Kokyu + * + * This file was used to generate the code in Kokyu_qosC.{h,i,cpp}. + * The steps to regenerate the code are as follows: + * + * 1. Run the tao_idl compiler on the pidl file. The command used for + * this is: + * + * tao_idl -I $TAO_ROOT -Ge 1 Kokyu_qos.pidl + * + * 2. Then apply the patches in Kokyu_qosC.h.diff to the generated code. + * The patch will replace the inclusion of RTCORBAC.h and RTSchedulerC.h + * with RTCORBA.h and RTScheduler.h respectively. + * + * Apply patches using the following command: + * + * patch < Kokyu_qosC.h.diff + * + * Note: The diff was generated in the following way: + * + * Run the idl compiler as in step 1. + * cp Kokyu_qosC.h Kokyu_qosC.h.orig + * Modify Kokyu_qosC.h with changes described in step 2. + * diff -wBbu Kokyu_qosC.h.orig Kokyu_qosC.h > Kokyu_qosC.h.diff + * + */ + +#ifndef _KOKYU_DSRT_QOS_PIDL_ +#define _KOKYU_DSRT_QOS_PIDL_ + +#include <TimeBase.pidl> +#include <tao/RTCORBA/RTCORBA.pidl> + +#pragma prefix "omg.org" + +module Kokyu +{ + typedef sequence<octet> GuidType; + + struct Svc_Ctxt_DSRT_QoS + { + GuidType guid; + long importance; + long criticality; + RTCORBA::Priority desired_priority; + TimeBase::TimeT deadline; + TimeBase::TimeT estimated_initial_execution_time; + }; +}; + +#endif /* KOKYU_DSRT_QOS_PIDL */ diff --git a/TAO/examples/Kokyu_dsrt_schedulers/Kokyu_qosC.cpp b/TAO/examples/Kokyu_dsrt_schedulers/Kokyu_qosC.cpp new file mode 100644 index 00000000000..8f97bcf7345 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/Kokyu_qosC.cpp @@ -0,0 +1,627 @@ +// -*- C++ -*- +// +// $Id$ + +// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** +// TAO and the TAO IDL Compiler have been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// and +// Distributed Object Computing Laboratory +// University of California at Irvine +// Irvine, CA +// USA +// http://doc.ece.uci.edu/ +// and +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +// TAO_IDL - Generated from +// be/be_codegen.cpp:351 + + +#include "Kokyu_qosC.h" +#include "tao/Stub.h" +#include "tao/ORB_Core.h" +#include "tao/Invocation.h" +#include "tao/PortableInterceptor.h" + +#if TAO_HAS_INTERCEPTORS == 1 +#include "tao/RequestInfo_Util.h" +#include "tao/ClientRequestInfo_i.h" +#include "tao/ClientInterceptorAdapter.h" +#endif /* TAO_HAS_INTERCEPTORS == 1 */ + + +#if defined (__BORLANDC__) +#pragma option -w-rvl -w-rch -w-ccc -w-aus -w-sig +#endif /* __BORLANDC__ */ + +#if !defined (__ACE_INLINE__) +#include "Kokyu_qosC.i" +#endif /* !defined INLINE */ + +// TAO_IDL - Generated from +// be/be_visitor_sequence/sequence_cs.cpp:72 + +#if !defined (_KOKYU_GUIDTYPE_CS_) +#define _KOKYU_GUIDTYPE_CS_ + +Kokyu::GuidType::GuidType (void) +{} + +Kokyu::GuidType::GuidType ( + CORBA::ULong max + ) + : TAO_Unbounded_Sequence< + CORBA::Octet + > + (max) +{} + +Kokyu::GuidType::GuidType ( + CORBA::ULong max, + CORBA::ULong length, + CORBA::Octet * buffer, + CORBA::Boolean release + ) + : TAO_Unbounded_Sequence< + CORBA::Octet + > + (max, length, buffer, release) +{} + +Kokyu::GuidType::GuidType ( + const GuidType &seq + ) + : TAO_Unbounded_Sequence< + CORBA::Octet + > + (seq) +{} + +Kokyu::GuidType::~GuidType (void) +{} + +void Kokyu::GuidType::_tao_any_destructor ( + void * _tao_void_pointer + ) +{ + GuidType * tmp = + ACE_static_cast ( + GuidType *, + _tao_void_pointer + ); + delete tmp; +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +template class + TAO_FixedSeq_Var_T< + Kokyu::GuidType, + CORBA::Octet + >; + +template class + TAO_Seq_Var_Base_T< + Kokyu::GuidType, + CORBA::Octet + >; + +template class + TAO_Seq_Out_T< + Kokyu::GuidType, + Kokyu::GuidType_var, + CORBA::Octet + >; + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +# pragma instantiate \ + TAO_FixedSeq_Var_T< \ + GuidType, \ + CORBA::Octet \ + > + +# pragma instantiate \ + TAO_Seq_Var_Base_T< \ + GuidType, \ + CORBA::Octet \ + > + +# pragma instantiate \ + TAO_Seq_Out_T< \ + GuidType, \ + GuidType_var, \ + CORBA::Octet \ + > + +#endif /* !ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + +#endif /* end #if !defined */ + +// TAO_IDL - Generated from +// be/be_visitor_typecode/typecode_defn.cpp:284 + +static const CORBA::Long _oc_Kokyu_GuidType[] = +{ + TAO_ENCAP_BYTE_ORDER, // byte order + 31, + ACE_NTOHL (0x49444c3a), + ACE_NTOHL (0x6f6d672e), + ACE_NTOHL (0x6f72672f), + ACE_NTOHL (0x4b6f6b79), + ACE_NTOHL (0x752f4775), + ACE_NTOHL (0x69645479), + ACE_NTOHL (0x70653a31), + ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/Kokyu/GuidType:1.0 + 9, + ACE_NTOHL (0x47756964), + ACE_NTOHL (0x54797065), + ACE_NTOHL (0x0), // name = GuidType + CORBA::tk_sequence, // typecode kind + 12, // encapsulation length + TAO_ENCAP_BYTE_ORDER, // byte order + CORBA::tk_octet, + + 0U, + +}; + +static CORBA::TypeCode _tc_TAO_tc_Kokyu_GuidType ( + CORBA::tk_alias, + sizeof (_oc_Kokyu_GuidType), + (char *) &_oc_Kokyu_GuidType, + 0, + sizeof (Kokyu::GuidType) + ); + +TAO_NAMESPACE_TYPE (CORBA::TypeCode_ptr) +TAO_NAMESPACE_BEGIN (Kokyu) +TAO_NAMESPACE_DEFINE ( + ::CORBA::TypeCode_ptr, + _tc_GuidType, + &_tc_TAO_tc_Kokyu_GuidType + ) +TAO_NAMESPACE_END + +// TAO_IDL - Generated from +// be/be_visitor_typecode/typecode_defn.cpp:284 + +static const CORBA::Long _oc_Kokyu_Svc_Ctxt_DSRT_QoS[] = +{ + TAO_ENCAP_BYTE_ORDER, // byte order + 40, + ACE_NTOHL (0x49444c3a), + ACE_NTOHL (0x6f6d672e), + ACE_NTOHL (0x6f72672f), + ACE_NTOHL (0x4b6f6b79), + ACE_NTOHL (0x752f5376), + ACE_NTOHL (0x635f4374), + ACE_NTOHL (0x78745f44), + ACE_NTOHL (0x5352545f), + ACE_NTOHL (0x516f533a), + ACE_NTOHL (0x312e3000), // repository ID = IDL:omg.org/Kokyu/Svc_Ctxt_DSRT_QoS:1.0 + 18, + ACE_NTOHL (0x5376635f), + ACE_NTOHL (0x43747874), + ACE_NTOHL (0x5f445352), + ACE_NTOHL (0x545f516f), + ACE_NTOHL (0x53000000), // name = Svc_Ctxt_DSRT_QoS + 6, // member count + 5, + ACE_NTOHL (0x67756964), + ACE_NTOHL (0x0), // name = guid + CORBA::tk_alias, // typecode kind for typedefs + 76, // encapsulation length + TAO_ENCAP_BYTE_ORDER, // byte order + 31, + ACE_NTOHL (0x49444c3a), + ACE_NTOHL (0x6f6d672e), + ACE_NTOHL (0x6f72672f), + ACE_NTOHL (0x4b6f6b79), + ACE_NTOHL (0x752f4775), + ACE_NTOHL (0x69645479), + ACE_NTOHL (0x70653a31), + ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/Kokyu/GuidType:1.0 + 9, + ACE_NTOHL (0x47756964), + ACE_NTOHL (0x54797065), + ACE_NTOHL (0x0), // name = GuidType + CORBA::tk_sequence, // typecode kind + 12, // encapsulation length + TAO_ENCAP_BYTE_ORDER, // byte order + CORBA::tk_octet, + + 0U, + + + 11, + ACE_NTOHL (0x696d706f), + ACE_NTOHL (0x7274616e), + ACE_NTOHL (0x63650000), // name = importance + CORBA::tk_long, + + 12, + ACE_NTOHL (0x63726974), + ACE_NTOHL (0x6963616c), + ACE_NTOHL (0x69747900), // name = criticality + CORBA::tk_long, + + 17, + ACE_NTOHL (0x64657369), + ACE_NTOHL (0x7265645f), + ACE_NTOHL (0x7072696f), + ACE_NTOHL (0x72697479), + ACE_NTOHL (0x0), // name = desired_priority + CORBA::tk_alias, // typecode kind for typedefs + 64, // encapsulation length + TAO_ENCAP_BYTE_ORDER, // byte order + 33, + ACE_NTOHL (0x49444c3a), + ACE_NTOHL (0x6f6d672e), + ACE_NTOHL (0x6f72672f), + ACE_NTOHL (0x5254434f), + ACE_NTOHL (0x5242412f), + ACE_NTOHL (0x5072696f), + ACE_NTOHL (0x72697479), + ACE_NTOHL (0x3a312e30), + ACE_NTOHL (0x0), // repository ID = IDL:omg.org/RTCORBA/Priority:1.0 + 9, + ACE_NTOHL (0x5072696f), + ACE_NTOHL (0x72697479), + ACE_NTOHL (0x0), // name = Priority + CORBA::tk_short, + + + 9, + ACE_NTOHL (0x64656164), + ACE_NTOHL (0x6c696e65), + ACE_NTOHL (0x0), // name = deadline + CORBA::tk_alias, // typecode kind for typedefs + 56, // encapsulation length + TAO_ENCAP_BYTE_ORDER, // byte order + 31, + ACE_NTOHL (0x49444c3a), + ACE_NTOHL (0x6f6d672e), + ACE_NTOHL (0x6f72672f), + ACE_NTOHL (0x54696d65), + ACE_NTOHL (0x42617365), + ACE_NTOHL (0x2f54696d), + ACE_NTOHL (0x65543a31), + ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/TimeBase/TimeT:1.0 + 6, + ACE_NTOHL (0x54696d65), + ACE_NTOHL (0x54000000), // name = TimeT + CORBA::tk_ulonglong, + + + 33, + ACE_NTOHL (0x65737469), + ACE_NTOHL (0x6d617465), + ACE_NTOHL (0x645f696e), + ACE_NTOHL (0x69746961), + ACE_NTOHL (0x6c5f6578), + ACE_NTOHL (0x65637574), + ACE_NTOHL (0x696f6e5f), + ACE_NTOHL (0x74696d65), + ACE_NTOHL (0x0), // name = estimated_initial_execution_time + CORBA::tk_alias, // typecode kind for typedefs + 56, // encapsulation length + TAO_ENCAP_BYTE_ORDER, // byte order + 31, + ACE_NTOHL (0x49444c3a), + ACE_NTOHL (0x6f6d672e), + ACE_NTOHL (0x6f72672f), + ACE_NTOHL (0x54696d65), + ACE_NTOHL (0x42617365), + ACE_NTOHL (0x2f54696d), + ACE_NTOHL (0x65543a31), + ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/TimeBase/TimeT:1.0 + 6, + ACE_NTOHL (0x54696d65), + ACE_NTOHL (0x54000000), // name = TimeT + CORBA::tk_ulonglong, + + +}; + +static CORBA::TypeCode _tc_TAO_tc_Kokyu_Svc_Ctxt_DSRT_QoS ( + CORBA::tk_struct, + sizeof (_oc_Kokyu_Svc_Ctxt_DSRT_QoS), + (char *) &_oc_Kokyu_Svc_Ctxt_DSRT_QoS, + 0, + sizeof (Kokyu::Svc_Ctxt_DSRT_QoS) + ); + +TAO_NAMESPACE_TYPE (CORBA::TypeCode_ptr) +TAO_NAMESPACE_BEGIN (Kokyu) +TAO_NAMESPACE_DEFINE ( + ::CORBA::TypeCode_ptr, + _tc_Svc_Ctxt_DSRT_QoS, + &_tc_TAO_tc_Kokyu_Svc_Ctxt_DSRT_QoS + ) +TAO_NAMESPACE_END + +// TAO_IDL - Generated from +// be/be_visitor_structure/structure_cs.cpp:66 + +void Kokyu::Svc_Ctxt_DSRT_QoS::_tao_any_destructor (void *_tao_void_pointer) +{ + Svc_Ctxt_DSRT_QoS *tmp = ACE_static_cast (Svc_Ctxt_DSRT_QoS*, _tao_void_pointer); + delete tmp; +} + +// TAO_IDL - Generated from +// be/be_type.cpp:297 + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +template class + TAO_Var_Var_T< + Kokyu::Svc_Ctxt_DSRT_QoS + >; + +template class TAO_Var_Base_T< + Kokyu::Svc_Ctxt_DSRT_QoS + >; + +template class + TAO_Out_T< + Kokyu::Svc_Ctxt_DSRT_QoS, + Kokyu::Svc_Ctxt_DSRT_QoS_var + >; + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +# pragma instantiate \ + TAO_Var_Var_T< \ + Kokyu::Svc_Ctxt_DSRT_QoS \ + > + +#pragma instantiate TAO_Var_Base_T< + Kokyu::Svc_Ctxt_DSRT_QoS + > + +# pragma instantiate \ + TAO_Out_T< \ + Kokyu::Svc_Ctxt_DSRT_QoS, \ + Kokyu::Svc_Ctxt_DSRT_QoS_var \ + > + +#endif /* !ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + +// TAO_IDL - Generated from +// be/be_visitor_sequence/any_op_cs.cpp:54 + +// Copying insertion. +void operator<<= ( + CORBA::Any &_tao_any, + const Kokyu::GuidType &_tao_elem + ) +{ + TAO::Any_Dual_Impl_T<Kokyu::GuidType>::insert_copy ( + _tao_any, + Kokyu::GuidType::_tao_any_destructor, + Kokyu::_tc_GuidType, + _tao_elem + ); +} + +// Non-copying insertion. +void operator<<= ( + CORBA::Any &_tao_any, + Kokyu::GuidType *_tao_elem + ) +{ + TAO::Any_Dual_Impl_T<Kokyu::GuidType>::insert ( + _tao_any, + Kokyu::GuidType::_tao_any_destructor, + Kokyu::_tc_GuidType, + _tao_elem + ); +} + +// Extraction to non-const pointer (deprecated). +CORBA::Boolean operator>>= ( + const CORBA::Any &_tao_any, + Kokyu::GuidType *&_tao_elem + ) +{ + return _tao_any >>= ACE_const_cast ( + const Kokyu::GuidType *&, + _tao_elem + ); +} + +// Extraction to const pointer. +CORBA::Boolean operator>>= ( + const CORBA::Any &_tao_any, + const Kokyu::GuidType *&_tao_elem + ) +{ + return + TAO::Any_Dual_Impl_T<Kokyu::GuidType>::extract ( + _tao_any, + Kokyu::GuidType::_tao_any_destructor, + Kokyu::_tc_GuidType, + _tao_elem + ); +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) || \ + defined (ACE_HAS_GNU_REPO) + template class TAO::Any_Dual_Impl_T<Kokyu::GuidType>; +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +# pragma instantiate TAO::Any_Dual_Impl_T<Kokyu::GuidType> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + +// TAO_IDL - Generated from +// be/be_visitor_structure/any_op_cs.cpp:54 + +// Copying insertion. +void operator<<= ( + CORBA::Any &_tao_any, + const Kokyu::Svc_Ctxt_DSRT_QoS &_tao_elem + ) +{ + TAO::Any_Dual_Impl_T<Kokyu::Svc_Ctxt_DSRT_QoS>::insert_copy ( + _tao_any, + Kokyu::Svc_Ctxt_DSRT_QoS::_tao_any_destructor, + Kokyu::_tc_Svc_Ctxt_DSRT_QoS, + _tao_elem + ); +} + +// Non-copying insertion. +void operator<<= ( + CORBA::Any &_tao_any, + Kokyu::Svc_Ctxt_DSRT_QoS *_tao_elem + ) +{ + TAO::Any_Dual_Impl_T<Kokyu::Svc_Ctxt_DSRT_QoS>::insert ( + _tao_any, + Kokyu::Svc_Ctxt_DSRT_QoS::_tao_any_destructor, + Kokyu::_tc_Svc_Ctxt_DSRT_QoS, + _tao_elem + ); +} + +// Extraction to non-const pointer (deprecated). +CORBA::Boolean operator>>= ( + const CORBA::Any &_tao_any, + Kokyu::Svc_Ctxt_DSRT_QoS *&_tao_elem + ) +{ + return _tao_any >>= ACE_const_cast ( + const Kokyu::Svc_Ctxt_DSRT_QoS *&, + _tao_elem + ); +} + +// Extraction to const pointer. +CORBA::Boolean operator>>= ( + const CORBA::Any &_tao_any, + const Kokyu::Svc_Ctxt_DSRT_QoS *&_tao_elem + ) +{ + return + TAO::Any_Dual_Impl_T<Kokyu::Svc_Ctxt_DSRT_QoS>::extract ( + _tao_any, + Kokyu::Svc_Ctxt_DSRT_QoS::_tao_any_destructor, + Kokyu::_tc_Svc_Ctxt_DSRT_QoS, + _tao_elem + ); +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) || \ + defined (ACE_HAS_GNU_REPO) + template class TAO::Any_Dual_Impl_T<Kokyu::Svc_Ctxt_DSRT_QoS>; +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +# pragma instantiate TAO::Any_Dual_Impl_T<Kokyu::Svc_Ctxt_DSRT_QoS> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + +// TAO_IDL - Generated from +// be/be_visitor_sequence/cdr_op_cs.cpp:105 + +#if !defined _TAO_CDR_OP_Kokyu_GuidType_CPP_ +#define _TAO_CDR_OP_Kokyu_GuidType_CPP_ + +CORBA::Boolean operator<< ( + TAO_OutputCDR &strm, + const Kokyu::GuidType &_tao_sequence + ) +{ + CORBA::ULong _tao_seq_len = _tao_sequence.length (); + + if (strm << _tao_seq_len) + { + // Encode all elements. + +#if (TAO_NO_COPY_OCTET_SEQUENCES == 1) + { + TAO_Unbounded_Sequence<CORBA::Octet> *oseq = + ACE_static_cast (TAO_Unbounded_Sequence<CORBA::Octet>*, (Kokyu::GuidType *)&_tao_sequence); + if (oseq->mb ()) + return strm.write_octet_array_mb (oseq->mb ()); + else + return strm.write_octet_array (_tao_sequence.get_buffer (), _tao_sequence.length ()); + } + +#else /* TAO_NO_COPY_OCTET_SEQUENCES == 0 */ + return strm.write_octet_array (_tao_sequence.get_buffer (), _tao_sequence.length ()); + +#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 0 */ + } + + return 0; +} + +CORBA::Boolean operator>> ( + TAO_InputCDR &strm, + Kokyu::GuidType &_tao_sequence + ) +{ + CORBA::ULong _tao_seq_len; + + if (strm >> _tao_seq_len) + { + // Add a check to the length of the sequence + // to make sure it does not exceed the length + // of the stream. (See bug 58.) + if (_tao_seq_len > strm.length ()) + { + return 0; + } + + // Set the length of the sequence. + _tao_sequence.length (_tao_seq_len); + + // If length is 0 we return true. + if (0 >= _tao_seq_len) + { + return 1; + } + + // Retrieve all the elements. + +#if (TAO_NO_COPY_OCTET_SEQUENCES == 1) + if (ACE_BIT_DISABLED (strm.start ()->flags (), + ACE_Message_Block::DONT_DELETE)) + { + TAO_ORB_Core* orb_core = strm.orb_core (); + if (orb_core != 0 && + strm.orb_core ()->resource_factory ()-> + input_cdr_allocator_type_locked () == 1) + { + TAO_Unbounded_Sequence<CORBA::Octet> *oseq = + ACE_static_cast(TAO_Unbounded_Sequence<CORBA::Octet>*, &_tao_sequence); + oseq->replace (_tao_seq_len, strm.start ()); + oseq->mb ()->wr_ptr (oseq->mb()->rd_ptr () + _tao_seq_len); + strm.skip_bytes (_tao_seq_len); + return 1; + } + } + return strm.read_octet_array (_tao_sequence.get_buffer (), _tao_seq_len); +#else /* TAO_NO_COPY_OCTET_SEQUENCES == 0 */ + return strm.read_octet_array (_tao_sequence.get_buffer (), _tao_sequence.length ()); + +#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 0 */ + + } + + return 0; +} + +#endif /* _TAO_CDR_OP_Kokyu_GuidType_CPP_ */ + diff --git a/TAO/examples/Kokyu_dsrt_schedulers/Kokyu_qosC.h b/TAO/examples/Kokyu_dsrt_schedulers/Kokyu_qosC.h new file mode 100644 index 00000000000..1c19e24e4f7 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/Kokyu_qosC.h @@ -0,0 +1,244 @@ +// -*- C++ -*- +// +// $Id$ + +// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** +// TAO and the TAO IDL Compiler have been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// and +// Distributed Object Computing Laboratory +// University of California at Irvine +// Irvine, CA +// USA +// http://doc.ece.uci.edu/ +// and +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +// TAO_IDL - Generated from +// be/be_codegen.cpp:151 + +#ifndef _TAO_IDL_KOKYU_QOSC_H_ +#define _TAO_IDL_KOKYU_QOSC_H_ + + +#include "tao/corba.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + + +#include "tao/RTCORBA/RTCORBA.h" + +#if defined (TAO_EXPORT_MACRO) +#undef TAO_EXPORT_MACRO +#endif +#define TAO_EXPORT_MACRO + +#if defined (TAO_EXPORT_NESTED_CLASSES) +# if defined (TAO_EXPORT_NESTED_MACRO) +# undef TAO_EXPORT_NESTED_MACRO +# endif /* defined (TAO_EXPORT_NESTED_MACRO) */ +# define TAO_EXPORT_NESTED_MACRO +#endif /* TAO_EXPORT_NESTED_CLASSES */ + +#if defined(_MSC_VER) +#if (_MSC_VER >= 1200) +#pragma warning(push) +#endif /* _MSC_VER >= 1200 */ +#pragma warning(disable:4250) +#endif /* _MSC_VER */ + +#if defined (__BORLANDC__) +#pragma option push -w-rvl -w-rch -w-ccc -w-inl +#endif /* __BORLANDC__ */ + +// TAO_IDL - Generated from +// be/be_visitor_module/module_ch.cpp:48 + +TAO_NAMESPACE Kokyu +{ + + // TAO_IDL - Generated from + // be/be_visitor_sequence/sequence_ch.cpp:100 + +#if !defined (_KOKYU_GUIDTYPE_CH_) +#define _KOKYU_GUIDTYPE_CH_ + + class GuidType; + + typedef + TAO_FixedSeq_Var_T< + GuidType, + CORBA::Octet + > + GuidType_var; + + typedef + TAO_Seq_Out_T< + GuidType, + GuidType_var, + CORBA::Octet + > + GuidType_out; + + class GuidType + : public + TAO_Unbounded_Sequence< + CORBA::Octet + > + { + public: + GuidType (void); + GuidType (CORBA::ULong max); + GuidType ( + CORBA::ULong max, + CORBA::ULong length, + CORBA::Octet* buffer, + CORBA::Boolean release = 0 + ); + GuidType (const GuidType &); + ~GuidType (void); + + static void _tao_any_destructor (void *); + + typedef GuidType_var _var_type; + +#if (TAO_NO_COPY_OCTET_SEQUENCES == 1) + GuidType ( + CORBA::ULong length, + const ACE_Message_Block* mb + ) + : TAO_Unbounded_Sequence<CORBA::Octet> (length, mb) {} +#endif /* TAO_NO_COPY_OCTET_SEQUENCE == 1 */ + }; + +#endif /* end #if !defined */ + + // TAO_IDL - Generated from + // be/be_visitor_typecode/typecode_decl.cpp:44 + + TAO_NAMESPACE_STORAGE_CLASS ::CORBA::TypeCode_ptr _tc_GuidType; + + // TAO_IDL - Generated from + // be/be_type.cpp:254 + + struct Svc_Ctxt_DSRT_QoS; + + typedef + TAO_Var_Var_T< + Svc_Ctxt_DSRT_QoS + > + Svc_Ctxt_DSRT_QoS_var; + + typedef + TAO_Out_T< + Svc_Ctxt_DSRT_QoS, + Svc_Ctxt_DSRT_QoS_var + > + Svc_Ctxt_DSRT_QoS_out; + + // TAO_IDL - Generated from + // be/be_visitor_structure/structure_ch.cpp:52 + + struct Svc_Ctxt_DSRT_QoS + { + typedef Svc_Ctxt_DSRT_QoS_var _var_type; + + static void _tao_any_destructor (void *); + Kokyu::GuidType guid; + CORBA::Long importance; + CORBA::Long criticality; + RTCORBA::Priority desired_priority; + TimeBase::TimeT deadline; + TimeBase::TimeT estimated_initial_execution_time; + }; + + // TAO_IDL - Generated from + // be/be_visitor_typecode/typecode_decl.cpp:44 + + TAO_NAMESPACE_STORAGE_CLASS ::CORBA::TypeCode_ptr _tc_Svc_Ctxt_DSRT_QoS; + +// TAO_IDL - Generated from +// be/be_visitor_module/module_ch.cpp:67 + +} +TAO_NAMESPACE_CLOSE // module Kokyu + +// TAO_IDL - Generated from +// be/be_visitor_sequence/any_op_ch.cpp:52 + + void operator<<= (CORBA::Any &, const Kokyu::GuidType &); // copying version + void operator<<= (CORBA::Any &, Kokyu::GuidType*); // noncopying version + CORBA::Boolean operator>>= (const CORBA::Any &, Kokyu::GuidType *&); // deprecated + CORBA::Boolean operator>>= (const CORBA::Any &, const Kokyu::GuidType *&); + +// TAO_IDL - Generated from +// be/be_visitor_structure/any_op_ch.cpp:52 + + void operator<<= (CORBA::Any &, const Kokyu::Svc_Ctxt_DSRT_QoS &); // copying version + void operator<<= (CORBA::Any &, Kokyu::Svc_Ctxt_DSRT_QoS*); // noncopying version + CORBA::Boolean operator>>= (const CORBA::Any &, Kokyu::Svc_Ctxt_DSRT_QoS *&); // deprecated + CORBA::Boolean operator>>= (const CORBA::Any &, const Kokyu::Svc_Ctxt_DSRT_QoS *&); + +// TAO_IDL - Generated from +// be/be_visitor_root/cdr_op.cpp:48 + +#ifndef __ACE_INLINE__ + +// TAO_IDL - Generated from +// be/be_visitor_sequence/cdr_op_ch.cpp:70 + +#if !defined _TAO_CDR_OP_Kokyu_GuidType_H_ +#define _TAO_CDR_OP_Kokyu_GuidType_H_ + + CORBA::Boolean operator<< ( + TAO_OutputCDR &, + const Kokyu::GuidType & + ); + CORBA::Boolean operator>> ( + TAO_InputCDR &, + Kokyu::GuidType & + ); + +#endif /* _TAO_CDR_OP_Kokyu_GuidType_H_ */ + +// TAO_IDL - Generated from +// be/be_visitor_structure/cdr_op_ch.cpp:53 + + CORBA::Boolean operator<< (TAO_OutputCDR &, const Kokyu::Svc_Ctxt_DSRT_QoS &); + CORBA::Boolean operator>> (TAO_InputCDR &, Kokyu::Svc_Ctxt_DSRT_QoS &); + +// TAO_IDL - Generated from +// be/be_visitor_root/cdr_op.cpp:64 + +#endif /* __ACE_INLINE__ */ + +// TAO_IDL - Generated from +// be/be_codegen.cpp:1060 + +#if defined (__ACE_INLINE__) +#include "Kokyu_qosC.i" +#endif /* defined INLINE */ + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +#pragma warning(pop) +#endif /* _MSC_VER */ + +#if defined (__BORLANDC__) +#pragma option pop +#endif /* __BORLANDC__ */ + +#endif /* ifndef */ + diff --git a/TAO/examples/Kokyu_dsrt_schedulers/Kokyu_qosC.h.diff b/TAO/examples/Kokyu_dsrt_schedulers/Kokyu_qosC.h.diff new file mode 100644 index 00000000000..6d155e3f8dd --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/Kokyu_qosC.h.diff @@ -0,0 +1,11 @@ +--- Kokyu_qosC.h.orig Mon Sep 1 11:01:16 2003 ++++ Kokyu_qosC.h Mon Sep 1 11:01:28 2003 +@@ -39,7 +39,7 @@ + #endif /* ACE_LACKS_PRAGMA_ONCE */ + + +-#include "tao/RTCORBA/RTCORBAC.h" ++#include "tao/RTCORBA/RTCORBA.h" + + #if defined (TAO_EXPORT_MACRO) + #undef TAO_EXPORT_MACRO diff --git a/TAO/examples/Kokyu_dsrt_schedulers/Kokyu_qosC.i b/TAO/examples/Kokyu_dsrt_schedulers/Kokyu_qosC.i new file mode 100644 index 00000000000..6644f932d8d --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/Kokyu_qosC.i @@ -0,0 +1,79 @@ +// -*- C++ -*- +// +// $Id$ + +// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** +// TAO and the TAO IDL Compiler have been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// and +// Distributed Object Computing Laboratory +// University of California at Irvine +// Irvine, CA +// USA +// http://doc.ece.uci.edu/ +// and +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + + +// TAO_IDL - Generated from +// be/be_visitor_sequence/cdr_op_ci.cpp:81 + +#if !defined _TAO_CDR_OP_Kokyu_GuidType_I_ +#define _TAO_CDR_OP_Kokyu_GuidType_I_ + +CORBA::Boolean operator<< ( + TAO_OutputCDR &, + const Kokyu::GuidType & + ); + +CORBA::Boolean operator>> ( + TAO_InputCDR &, + Kokyu::GuidType & + ); + +#endif /* _TAO_CDR_OP_Kokyu_GuidType_I_ */ + +// TAO_IDL - Generated from +// be/be_visitor_structure/cdr_op_ci.cpp:70 + +ACE_INLINE +CORBA::Boolean operator<< ( + TAO_OutputCDR &strm, + const Kokyu::Svc_Ctxt_DSRT_QoS &_tao_aggregate + ) +{ + return + (strm << _tao_aggregate.guid) && + (strm << _tao_aggregate.importance) && + (strm << _tao_aggregate.criticality) && + (strm << _tao_aggregate.desired_priority) && + (strm << _tao_aggregate.deadline) && + (strm << _tao_aggregate.estimated_initial_execution_time); +} + +ACE_INLINE +CORBA::Boolean operator>> ( + TAO_InputCDR &strm, + Kokyu::Svc_Ctxt_DSRT_QoS &_tao_aggregate + ) +{ + return + (strm >> _tao_aggregate.guid) && + (strm >> _tao_aggregate.importance) && + (strm >> _tao_aggregate.criticality) && + (strm >> _tao_aggregate.desired_priority) && + (strm >> _tao_aggregate.deadline) && + (strm >> _tao_aggregate.estimated_initial_execution_time); +} + diff --git a/TAO/examples/Kokyu_dsrt_schedulers/MIF_Scheduler.cpp b/TAO/examples/Kokyu_dsrt_schedulers/MIF_Scheduler.cpp new file mode 100644 index 00000000000..9c8477c7155 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/MIF_Scheduler.cpp @@ -0,0 +1,707 @@ +//$Id$ + +#include "MIF_Scheduler.h" +#include "Kokyu_qosC.h" +#include "utils.h" +#include "tao/RTScheduling/Request_Interceptor.h" + +MIF_Scheduling::SchedulingParameter +MIF_Sched_Param_Policy::value (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->value_; +} + +void +MIF_Sched_Param_Policy::value (const MIF_Scheduling::SchedulingParameter& value ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + this->value_ = value; +} + +MIF_Scheduler::MIF_Scheduler (CORBA::ORB_ptr orb, + Kokyu::DSRT_Dispatcher_Impl_t disp_impl_type, + int ace_sched_policy, + int ace_sched_scope) + : orb_ (orb), + disp_impl_type_ (disp_impl_type), + ace_sched_policy_ (ace_sched_policy), + ace_sched_scope_ (ace_sched_scope) +{ + ACE_DECLARE_NEW_ENV; + + Kokyu::DSRT_ConfigInfo config; + + config.impl_type_ = this->disp_impl_type_; + config.sched_policy_ = ace_sched_policy_; + config.sched_scope_ = ace_sched_scope_; + + Kokyu::DSRT_Dispatcher_Factory<MIF_Scheduler_Traits>::DSRT_Dispatcher_Auto_Ptr + tmp( Kokyu::DSRT_Dispatcher_Factory<MIF_Scheduler_Traits>:: + create_DSRT_dispatcher (config) ); + kokyu_dispatcher_ = tmp; + + CORBA::Object_var object = + orb->resolve_initial_references ("RTScheduler_Current" + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + this->current_ = + RTScheduling::Current::_narrow (object.in () ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + IOP::CodecFactory_var codec_factory; + CORBA::Object_var obj = orb->resolve_initial_references ("CodecFactory"); + + if (CORBA::is_nil(obj.in ())) + { + ACE_ERROR ((LM_ERROR, "Nil Codec factory\n")); + } + else + { + codec_factory = IOP::CodecFactory::_narrow (obj.in ()); + } + + IOP::Encoding encoding; + encoding.format = IOP::ENCODING_CDR_ENCAPS; + encoding.major_version = 1; + encoding.minor_version = 2; + + codec_ = codec_factory->create_codec (encoding); +} + +MIF_Scheduler::~MIF_Scheduler (void) +{ + // delete kokyu_dispatcher_; +} + +void +MIF_Scheduler::shutdown (void) +{ + kokyu_dispatcher_->shutdown (); + ACE_DEBUG ((LM_DEBUG, "kokyu DSRT dispatcher shutdown\n")); +} + +MIF_Scheduling::SchedulingParameterPolicy_ptr +MIF_Scheduler::create_scheduling_parameter (const MIF_Scheduling::SchedulingParameter & value ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + MIF_Scheduling::SchedulingParameterPolicy_ptr sched_param_policy; + ACE_NEW_THROW_EX (sched_param_policy, + MIF_Sched_Param_Policy, + CORBA::NO_MEMORY ( + CORBA::SystemException::_tao_minor_code ( + TAO_DEFAULT_MINOR_CODE, + ENOMEM), + CORBA::COMPLETED_NO)); + + sched_param_policy->value (value); + + return sched_param_policy; +} + + +void +MIF_Scheduler::begin_new_scheduling_segment (const RTScheduling::Current::IdType& guid, + const char *, + CORBA::Policy_ptr sched_policy, + CORBA::Policy_ptr + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE)) +{ +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, + "(%t|%T):MIF_Scheduler::begin_new_scheduling_segment enter\n")); +#endif + +#ifdef KOKYU_DSRT_LOGGING + int int_guid; + ACE_OS::memcpy (&int_guid, + guid.get_buffer (), + guid.length ()); + ACE_DEBUG ((LM_DEBUG, "(%t|%T): guid is %d\n", int_guid)); +#endif + + MIF_Scheduler_Traits::QoSDescriptor_t qos; + MIF_Scheduling::SchedulingParameterPolicy_var sched_param_policy = + MIF_Scheduling::SchedulingParameterPolicy::_narrow (sched_policy); + + MIF_Scheduling::SchedulingParameter_var sched_param = sched_param_policy->value (); + CORBA::Short importance = sched_param->importance; + qos.importance_ = importance; + kokyu_dispatcher_->schedule (guid, qos); + +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, + "(%t|%T):MIF_Scheduler::begin_new_scheduling_segment exit\n")); +#endif +} + +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, + RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE)) +{ + this->begin_new_scheduling_segment (guid, + name, + sched_param, + implicit_sched_param + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +} + +void +MIF_Scheduler::update_scheduling_segment (const RTScheduling::Current::IdType& guid, + const char* name, + CORBA::Policy_ptr sched_policy, + CORBA::Policy_ptr implicit_sched_param + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE)) +{ + ACE_UNUSED_ARG ((name)); + ACE_UNUSED_ARG ((implicit_sched_param)); + +#ifdef KOKYU_DSRT_LOGGING + int int_guid ; + ACE_OS::memcpy (&int_guid, + guid.get_buffer (), + guid.length ()); + ACE_DEBUG ((LM_DEBUG, "(%t|%T): update_sched_seg::guid is %d\n", int_guid)); +#endif + + MIF_Scheduling::SchedulingParameterPolicy_var sched_param_policy = + MIF_Scheduling::SchedulingParameterPolicy::_narrow (sched_policy); + + MIF_Scheduling::SchedulingParameter_var sched_param = sched_param_policy->value (); + CORBA::Short importance = sched_param->importance; + + MIF_Scheduler_Traits::QoSDescriptor_t qos; + qos.importance_ = importance; + + kokyu_dispatcher_->update_schedule (guid, qos); +} + +void +MIF_Scheduler::end_scheduling_segment ( + const RTScheduling::Current::IdType &guid, + const char * + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ +#ifdef KOKYU_DSRT_LOGGING + int int_guid; + ACE_OS::memcpy (&int_guid, + guid.get_buffer (), + guid.length ()); + ACE_DEBUG ((LM_DEBUG, "(%t|%T) call to end_sched_segment for guid %d\n", int_guid)); +#endif + + kokyu_dispatcher_->cancel_schedule (guid); +} + +void +MIF_Scheduler::end_nested_scheduling_segment ( + const RTScheduling::Current::IdType &, + const char *, + CORBA::Policy_ptr + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + +} + + +void +MIF_Scheduler::send_request (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + Kokyu::Svc_Ctxt_DSRT_QoS sc_qos; + + CORBA::String_var operation = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, + "(%t|%T): send_request " + "from \"%s\"\n", + operation.in ())); +#endif + + // Make the context to send the context to the target + IOP::ServiceContext sc; + sc.context_id = Client_Interceptor::SchedulingInfo; + + CORBA::Policy_ptr sched_policy = + this->current_->scheduling_parameter(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + /* + int guid; + ACE_OS::memcpy (&guid, + this->current_->id ()->get_buffer (), + this->current_->id ()->length ()); + */ + CORBA::Short importance; + if (CORBA::is_nil (sched_policy)) + { + importance = 0; + } + else + { + MIF_Scheduling::SchedulingParameterPolicy_var sched_param_policy = + MIF_Scheduling::SchedulingParameterPolicy::_narrow (sched_policy); + + MIF_Scheduling::SchedulingParameter_var sched_param = sched_param_policy->value (); + importance = sched_param->importance; + +#ifdef KOKYU_DSRT_LOGGING + int int_guid; + ACE_OS::memcpy (&int_guid, + this->current_->id ()->get_buffer (), + this->current_->id ()->length ()); + ACE_DEBUG ((LM_DEBUG, + "(%t|%T): send_request importance from current = %d, guid = %d\n", + importance, int_guid)); +#endif + + //Fill the guid in the SC Qos struct + sc_qos.guid.length (this->current_->id ()->length ()); + guid_copy (sc_qos.guid, *(this->current_->id ())); + sc_qos.importance = importance; + CORBA::Any sc_qos_as_any; + sc_qos_as_any <<= sc_qos; + + sc.context_data = + ACE_reinterpret_cast(IOP::ServiceContext:: + _tao_seq_Octet_context_data &, + *codec_->encode (sc_qos_as_any)); + +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%t|%T): send_request : about to add sched SC\n"))); +#endif + + // Add this context to the service context list. + ri->add_request_service_context (sc, 0 ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + + +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, + ACE_LIB_TEXT ("(%t|%T): send_request : ") + ACE_LIB_TEXT ("about to call scheduler to inform block\n") + )); +#endif + + kokyu_dispatcher_->update_schedule (*(this->current_->id ()), + Kokyu::BLOCK); + +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, + ACE_LIB_TEXT ("(%t|%T): send_request interceptor done\n"))); +#endif +} + +void +MIF_Scheduler::receive_request (PortableInterceptor::ServerRequestInfo_ptr ri, + RTScheduling::Current::IdType_out guid_out, + CORBA::String_out /*name*/, + CORBA::Policy_out sched_param_out, + CORBA::Policy_out /*implicit_sched_param_out*/ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + Kokyu::Svc_Ctxt_DSRT_QoS* sc_qos_ptr; + +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, "(%t|%T):entered MIF_Scheduler::receive_request\n")); +#endif + + RTScheduling::Current::IdType guid; + + CORBA::String_var operation = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, + "(%t|%T): receive_request from " + "\"%s\"\n", + operation.in ())); +#endif + + // Ignore the "_is_a" operation since it may have been invoked + // locally on the server side as a side effect of another call, + // meaning that the client hasn't added the service context yet. + if (ACE_OS_String::strcmp ("_is_a", operation.in ()) == 0) + return; + + IOP::ServiceContext_var sc = + ri->get_request_service_context (Server_Interceptor::SchedulingInfo + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + CORBA::Short importance; + + if (sc.ptr () == 0) + { + importance = 0; + } + else + { + CORBA::OctetSeq oc_seq = CORBA::OctetSeq (sc->context_data.length (), + sc->context_data.length (), + sc->context_data.get_buffer (), + 0); + CORBA::Any sc_qos_as_any; + sc_qos_as_any = *codec_->decode (oc_seq); + //Don't store in a _var, since >>= returns a pointer to an + //internal buffer and we are not supposed to free it. + sc_qos_as_any >>= sc_qos_ptr; + + importance = sc_qos_ptr->importance; + guid.length (sc_qos_ptr->guid.length ()); + guid_copy (guid, sc_qos_ptr->guid); + + ACE_NEW (guid_out.ptr (), + RTScheduling::Current::IdType); + guid_out.ptr ()->length (guid.length ()); + *(guid_out.ptr ()) = guid; + +#ifdef KOKYU_DSRT_LOGGING + int int_guid; + ACE_OS::memcpy (&int_guid, + guid.get_buffer (), + guid.length ()); + ACE_DEBUG ((LM_DEBUG, + "(%t|%T): Importance = %d, guid = %d in recvd service context\n", + importance, int_guid)); +#endif + + MIF_Scheduling::SchedulingParameter sched_param; + sched_param.importance = importance; + sched_param_out = this->create_scheduling_parameter (sched_param); + } + + MIF_Scheduler_Traits::QoSDescriptor_t qos; + qos.importance_ = importance; + this->kokyu_dispatcher_->schedule (guid, qos); + +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, "(%t|%T): receive_request interceptor done\n")); +#endif + +} + +void +MIF_Scheduler::send_reply (PortableInterceptor::ServerRequestInfo_ptr ri + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + CORBA::Short importance = 0; + Kokyu::Svc_Ctxt_DSRT_QoS sc_qos; + + CORBA::String_var operation = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, + "(%t|%T): send_reply from \"%s\"\n", + ri->operation ())); +#endif + + // Make the context to send the context to the target + IOP::ServiceContext sc; + sc.context_id = Server_Interceptor::SchedulingInfo; + + CORBA::Policy_ptr sched_policy = + this->current_->scheduling_parameter(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (sched_policy)) + { +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, + "(%t|%T): sched_policy nil. ", + "importance not set in sched params\n")); +#endif + importance = 0; + } + else + { +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, + "(%t|%T):sched_policy not nil. ", + "importance set in sched params\n")); +#endif + MIF_Scheduling::SchedulingParameterPolicy_var sched_param_policy = + MIF_Scheduling::SchedulingParameterPolicy::_narrow (sched_policy); + + MIF_Scheduling::SchedulingParameter_var sched_param = sched_param_policy->value (); + + importance = sched_param->importance; + + //Fill the guid in the SC Qos struct + sc_qos.guid.length (this->current_->id ()->length ()); + guid_copy (sc_qos.guid, *(this->current_->id ())); + sc_qos.importance = importance; + CORBA::Any sc_qos_as_any; + sc_qos_as_any <<= sc_qos; + + sc.context_data = ACE_reinterpret_cast( + IOP::ServiceContext:: + _tao_seq_Octet_context_data &, + *codec_->encode (sc_qos_as_any)); + + // Add this context to the service context list. + ri->add_reply_service_context (sc, 1 ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, "(%t|%T):reply sc added\n")); +#endif + } + + kokyu_dispatcher_->update_schedule (*(this->current_->id ()), + Kokyu::BLOCK); + +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, "(%t|%T): send_reply interceptor done\n")); +#endif +} + +void +MIF_Scheduler::send_exception (PortableInterceptor::ServerRequestInfo_ptr ri + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + send_reply (ri ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +} + +void +MIF_Scheduler::send_poll (PortableInterceptor::ClientRequestInfo_ptr + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ +} + +void +MIF_Scheduler::send_other (PortableInterceptor::ServerRequestInfo_ptr ri + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + send_reply (ri ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +} + +void +MIF_Scheduler::receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + RTScheduling::Current::IdType guid; + CORBA::Short importance=0; + + CORBA::String_var operation = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + CORBA::Object_var target = ri->target (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + ACE_CString opname = operation.in (); +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, + "(%t|%T):receive_reply from " + "\"%s\"\n", + opname.c_str ())); +#endif + + // Check that the reply service context was received as + // expected. + IOP::ServiceContext_var sc = + ri->get_reply_service_context (Client_Interceptor::SchedulingInfo + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (sc.ptr () == 0) + { + importance = 0; + } + else + { + CORBA::OctetSeq oc_seq = CORBA::OctetSeq (sc->context_data.length (), + sc->context_data.length (), + sc->context_data.get_buffer (), + 0); + + //Don't store in a _var, since >>= returns a pointer to an internal buffer + //and we are not supposed to free it. + Kokyu::Svc_Ctxt_DSRT_QoS* sc_qos_ptr; + CORBA::Any sc_qos_as_any; + sc_qos_as_any = *codec_->decode (oc_seq); + sc_qos_as_any >>= sc_qos_ptr; + importance = sc_qos_ptr->importance; + guid.length (sc_qos_ptr->guid.length ()); + guid_copy (guid, sc_qos_ptr->guid); + +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, + "(%t|%T): Importance = %d in recvd service context\n", + importance )); +#endif + } + + MIF_Scheduler_Traits::QoSDescriptor_t qos; + qos.importance_ = importance; + this->kokyu_dispatcher_->schedule (guid, qos); +} + +void +MIF_Scheduler::receive_exception (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + receive_reply (ri ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +} + +void +MIF_Scheduler::receive_other (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + receive_reply (ri ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +} + +void +MIF_Scheduler::cancel (const RTScheduling::Current::IdType & + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ +} + +CORBA::PolicyList* +MIF_Scheduler::scheduling_policies (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +void +MIF_Scheduler::scheduling_policies (const CORBA::PolicyList & + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_THROW (CORBA::NO_IMPLEMENT ()); +} + +CORBA::PolicyList* +MIF_Scheduler::poa_policies (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +char * +MIF_Scheduler::scheduling_discipline_name (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +RTScheduling::ResourceManager_ptr +MIF_Scheduler::create_resource_manager (const char *, + CORBA::Policy_ptr + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +void +MIF_Scheduler::set_scheduling_parameter (PortableServer::Servant &, + const char *, + CORBA::Policy_ptr + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_THROW (CORBA::NO_IMPLEMENT ()); +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) +template class Kokyu::DSRT_Dispatcher_Factory<MIF_Scheduler_Traits>; +template class Kokyu::DSRT_Dispatcher<MIF_Scheduler_Traits>; +template class Kokyu::DSRT_Dispatcher_Impl<MIF_Scheduler_Traits>; +template class Kokyu::DSRT_Direct_Dispatcher_Impl<MIF_Scheduler_Traits>; +template class Kokyu::DSRT_CV_Dispatcher_Impl<MIF_Scheduler_Traits>; +template class Kokyu::DSRT_Dispatch_Item_var<MIF_Scheduler_Traits>; +template class Kokyu::Comparator_Adapter_Generator<MIF_Scheduler_Traits>; +template class Kokyu::Sched_Ready_Queue<MIF_Scheduler_Traits, Kokyu::Comparator_Adapter_Generator<MIF_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex>; + +template class ACE_Hash_Map_Manager_Ex<MIF_Scheduler_Traits::Guid_t, ACE_RB_Tree_Node<Kokyu::DSRT_Dispatch_Item_var<MIF_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<MIF_Scheduler_Traits> > *, Kokyu::Sched_Ready_Queue<MIF_Scheduler_Traits, Kokyu::Comparator_Adapter_Generator<MIF_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex>::Guid_Hash, ACE_Equal_To<MIF_Scheduler_Traits::Guid_t>, ACE_Null_Mutex>; + +template class ACE_RB_Tree<Kokyu::DSRT_Dispatch_Item_var<MIF_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<MIF_Scheduler_Traits>, Kokyu::Comparator_Adapter_Generator<MIF_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex>; + +template class ACE_RB_Tree_Iterator<Kokyu::DSRT_Dispatch_Item_var<MIF_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<MIF_Scheduler_Traits>, Kokyu::Comparator_Adapter_Generator<MIF_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex>; + +template class ACE_Hash_Map_Entry<MIF_Scheduler_Traits::Guid_t, ACE_RB_Tree_Node<Kokyu::DSRT_Dispatch_Item_var<MIF_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<MIF_Scheduler_Traits> > *>; + +template class ACE_RB_Tree_Node<Kokyu::DSRT_Dispatch_Item_var<MIF_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<MIF_Scheduler_Traits> >; + +template class Kokyu::MIF_Comparator<MIF_Scheduler_Traits::QoSDescriptor_t>; + +template class ACE_Hash_Map_Iterator_Base_Ex<MIF_Scheduler_Traits::Guid_t, ACE_RB_Tree_Node<Kokyu::DSRT_Dispatch_Item_var<MIF_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<MIF_Scheduler_Traits> > *, Kokyu::Sched_Ready_Queue<MIF_Scheduler_Traits, Kokyu::Comparator_Adapter_Generator<MIF_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex>::Guid_Hash, ACE_Equal_To<MIF_Scheduler_Traits::Guid_t>, ACE_Null_Mutex>; + +template class ACE_RB_Tree_Reverse_Iterator<Kokyu::DSRT_Dispatch_Item_var<MIF_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<MIF_Scheduler_Traits>, Kokyu::Comparator_Adapter_Generator<MIF_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex>; + +template class ACE_RB_Tree_Iterator_Base<Kokyu::DSRT_Dispatch_Item_var<MIF_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<MIF_Scheduler_Traits>, Kokyu::Comparator_Adapter_Generator<MIF_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex>; + +#elif defined(ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate Kokyu::DSRT_Dispatcher_Factory<MIF_Scheduler_Traits> +#pragma instantiate Kokyu::DSRT_Dispatcher<MIF_Scheduler_Traits> +#pragma instantiate Kokyu::DSRT_Dispatcher_Impl<MIF_Scheduler_Traits> +#pragma instantiate Kokyu::DSRT_Direct_Dispatcher_Impl<MIF_Scheduler_Traits> +#pragma instantiate Kokyu::DSRT_CV_Dispatcher_Impl<MIF_Scheduler_Traits> +#pragma instantiate Kokyu::DSRT_Dispatch_Item_var<MIF_Scheduler_Traits> +#pragma instantiate Kokyu::Comparator_Adapter_Generator<MIF_Scheduler_Traits> + +#pragma instantiate Kokyu::Sched_Ready_Queue<MIF_Scheduler_Traits, Kokyu::Comparator_Adapter_Generator<MIF_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex> + +#pragma instantiate ACE_Hash_Map_Manager_Ex<MIF_Scheduler_Traits::Guid_t, ACE_RB_Tree_Node<Kokyu::DSRT_Dispatch_Item_var<MIF_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<MIF_Scheduler_Traits> > *, Kokyu::Sched_Ready_Queue<MIF_Scheduler_Traits, Kokyu::Comparator_Adapter_Generator<MIF_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex>::Guid_Hash, ACE_Equal_To<MIF_Scheduler_Traits::Guid_t>, ACE_Null_Mutex> + +#pragma instantiate ACE_RB_Tree<Kokyu::DSRT_Dispatch_Item_var<MIF_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<MIF_Scheduler_Traits>, Kokyu::Comparator_Adapter_Generator<MIF_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex> + +#pragma instantiate ACE_RB_Tree_Iterator<Kokyu::DSRT_Dispatch_Item_var<MIF_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<MIF_Scheduler_Traits>, Kokyu::Comparator_Adapter_Generator<MIF_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex> + +ACE_Hash_Map_Entry<MIF_Scheduler_Traits::Guid_t, ACE_RB_Tree_Node<Koky\ +u::DSRT_Dispatch_Item_var<MIF_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<\ +MIF_Scheduler_Traits> > + +#pragma instantiate ACE_Hash_Map_Entry<MIF_Scheduler_Traits::Guid_t, ACE_RB_Tree_Node<Kokyu::DSRT_Dispatch_Item_var<MIF_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<MIF_Scheduler_Traits> > *> + +#pragma instantiate ACE_RB_Tree_Node<Kokyu::DSRT_Dispatch_Item_var<MIF_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<MIF_Scheduler_Traits> > + +#pragma instantiate Kokyu::MIF_Comparator<MIF_Scheduler_Traits::QoSDescriptor_t> + +#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<MIF_Scheduler_Traits::Guid_t, ACE_RB_Tree_Node<Kokyu::DSRT_Dispatch_Item_var<MIF_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<MIF_Scheduler_Traits> > *, Kokyu::Sched_Ready_Queue<MIF_Scheduler_Traits, Kokyu::Comparator_Adapter_Generator<MIF_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex>::Guid_Hash, ACE_Equal_To<MIF_Scheduler_Traits::Guid_t>, ACE_Null_Mutex> + +#pragma instantiate ACE_RB_Tree_Reverse_Iterator<Kokyu::DSRT_Dispatch_Item_var<MIF_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<MIF_Scheduler_Traits>, Kokyu::Comparator_Adapter_Generator<MIF_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex> + +#pragma instantiate ACE_RB_Tree_Iterator_Base<Kokyu::DSRT_Dispatch_Item_var<MIF_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<MIF_Scheduler_Traits>, Kokyu::Comparator_Adapter_Generator<MIF_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex> + +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/examples/Kokyu_dsrt_schedulers/MIF_Scheduler.h b/TAO/examples/Kokyu_dsrt_schedulers/MIF_Scheduler.h new file mode 100644 index 00000000000..85c1ba77aa0 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/MIF_Scheduler.h @@ -0,0 +1,198 @@ +//$Id$ + +#ifndef MIF_SCHEDULER_H +#define MIF_SCHEDULER_H + +#include "tao/RTScheduling/RTScheduler.h" +#include "MIF_SchedulingC.h" +#include "Kokyu_dsrt.h" +#include "Kokyu_dsrt_schedulers_export.h" + +struct MIF_Scheduler_Traits +{ + typedef RTScheduling::Current::IdType Guid_t; + + struct _QoSDescriptor_t + { + typedef long Importance_t; + Importance_t importance_; + }; + + typedef _QoSDescriptor_t QoSDescriptor_t; + + typedef Kokyu::MIF_Comparator<QoSDescriptor_t> QoSComparator_t; + + class _Guid_Hash + { + public: + u_long operator () (const Guid_t& id) + { + return ACE::hash_pjw ((const char *) id.get_buffer (), + id.length ()); + } + }; + + typedef _Guid_Hash Guid_Hash; +}; + +class Kokyu_DSRT_Schedulers_Export MIF_Sched_Param_Policy: +public MIF_Scheduling::SchedulingParameterPolicy, + public TAO_Local_RefCounted_Object +{ + public: + + MIF_Scheduling::SchedulingParameter value (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void value (const MIF_Scheduling::SchedulingParameter & value + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + private: + MIF_Scheduling::SchedulingParameter value_; +}; + +class Kokyu_DSRT_Schedulers_Export MIF_Scheduler: +public MIF_Scheduling::Scheduler, +public TAO_Local_RefCounted_Object +{ + public: + + MIF_Scheduler (CORBA::ORB_ptr orb, + Kokyu::DSRT_Dispatcher_Impl_t, + int ace_sched_policy, + int ace_sched_scope); + + ~MIF_Scheduler (void); + + + virtual MIF_Scheduling::SchedulingParameterPolicy_ptr + create_scheduling_parameter (const MIF_Scheduling::SchedulingParameter & value + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void shutdown (void); + + virtual void begin_new_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, + 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, + RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE)); + + virtual void update_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, + 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 + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void send_request (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)); + + virtual void receive_request (PortableInterceptor::ServerRequestInfo_ptr ri, + RTScheduling::Current::IdType_out guid, + CORBA::String_out name, + CORBA::Policy_out sched_param, + CORBA::Policy_out implicit_sched_param + 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)); + + virtual void send_exception (PortableInterceptor::ServerRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)); + + virtual void send_poll (PortableInterceptor::ClientRequestInfo_ptr ri + 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 + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + private: + CORBA::ORB_var orb_; + IOP::Codec_var codec_; + RTScheduling::Current_var current_; + Kokyu::DSRT_Dispatcher_Factory<MIF_Scheduler_Traits>::DSRT_Dispatcher_Auto_Ptr + kokyu_dispatcher_; + Kokyu::DSRT_Dispatcher_Impl_t disp_impl_type_; + int ace_sched_policy_; + int ace_sched_scope_; +}; + +#endif //MIF_SCHEDULER_H diff --git a/TAO/examples/Kokyu_dsrt_schedulers/MIF_Scheduling.pidl b/TAO/examples/Kokyu_dsrt_schedulers/MIF_Scheduling.pidl new file mode 100644 index 00000000000..9db0627bf76 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/MIF_Scheduling.pidl @@ -0,0 +1,61 @@ +//$Id$ + +/** + * @file MIF_Scheduling.pidl + * + * $Id$ + * + * @brief Pre-compiled IDL source to help with the service context + * propagation of dynamic scheduling parameters using Kokyu + * + * This file was used to generate the code in MIF_SchedulingC.{h,i,cpp}. + * The steps to regenerate the code are as follows: + * + * 1. Run the tao_idl compiler on the pidl file. The command used for + * this is: + * + * tao_idl -I $TAO_ROOT -Ge 1 + * -Wb,export_macro=Kokyu_DSRT_Schedulers_Export + * -Wb,export_include=Kokyu_dsrt_schedulers_export.h + * + * + * 2. Then apply the patches in MIF_SchedulingC.h.diff to the generated code. + * The patch will replace the inclusion of RTCORBAC.h and RTSchedulerC.h + * with RTCORBA.h and RTScheduler.h respectively. + * + * Apply patches using the following command: + * + * patch < MIF_SchedulingC.h.diff + * + * Note: The diff was generated in the following way: + * + * Run the idl compiler as in step 1. + * cp MIF_SchedulingC.h MIF_SchedulingC.h.orig + * Modify MIF_SchedulingC.h with changes described in step 2. + * diff -wBbu MIF_SchedulingC.h.orig MIF_SchedulingC.h > MIF_SchedulingC.h.diff + * + */ + +#include <tao/RTScheduling/RTScheduler.pidl> +#include <tao/RTCORBA/RTCORBA.pidl> + +module MIF_Scheduling +{ + struct SchedulingParameter + { + long importance; + }; + + local interface SchedulingParameterPolicy + : CORBA::Policy + { + attribute SchedulingParameter value; + }; + + local interface Scheduler : RTScheduling::Scheduler + { + SchedulingParameterPolicy + create_scheduling_parameter + (in SchedulingParameter value); + }; +}; diff --git a/TAO/examples/Kokyu_dsrt_schedulers/MIF_SchedulingC.cpp b/TAO/examples/Kokyu_dsrt_schedulers/MIF_SchedulingC.cpp new file mode 100644 index 00000000000..014a0876c61 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/MIF_SchedulingC.cpp @@ -0,0 +1,785 @@ +// -*- C++ -*- +// +// $Id$ + +// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** +// TAO and the TAO IDL Compiler have been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// and +// Distributed Object Computing Laboratory +// University of California at Irvine +// Irvine, CA +// USA +// http://doc.ece.uci.edu/ +// and +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +// TAO_IDL - Generated from +// be/be_codegen.cpp:351 + + +#include "MIF_SchedulingC.h" +#include "tao/Stub.h" +#include "tao/ORB_Core.h" +#include "tao/Invocation.h" +#include "tao/PortableInterceptor.h" + +#if TAO_HAS_INTERCEPTORS == 1 +#include "tao/RequestInfo_Util.h" +#include "tao/ClientRequestInfo_i.h" +#include "tao/ClientInterceptorAdapter.h" +#endif /* TAO_HAS_INTERCEPTORS == 1 */ + + +#if defined (__BORLANDC__) +#pragma option -w-rvl -w-rch -w-ccc -w-aus -w-sig +#endif /* __BORLANDC__ */ + +#if !defined (__ACE_INLINE__) +#include "MIF_SchedulingC.i" +#endif /* !defined INLINE */ + +// TAO_IDL - Generated from +// be/be_visitor_typecode/typecode_defn.cpp:284 + +static const CORBA::Long _oc_MIF_Scheduling_SchedulingParameter[] = +{ + TAO_ENCAP_BYTE_ORDER, // byte order + 43, + ACE_NTOHL (0x49444c3a), + ACE_NTOHL (0x4d49465f), + ACE_NTOHL (0x53636865), + ACE_NTOHL (0x64756c69), + ACE_NTOHL (0x6e672f53), + ACE_NTOHL (0x63686564), + ACE_NTOHL (0x756c696e), + ACE_NTOHL (0x67506172), + ACE_NTOHL (0x616d6574), + ACE_NTOHL (0x65723a31), + ACE_NTOHL (0x2e300000), // repository ID = IDL:MIF_Scheduling/SchedulingParameter:1.0 + 20, + ACE_NTOHL (0x53636865), + ACE_NTOHL (0x64756c69), + ACE_NTOHL (0x6e675061), + ACE_NTOHL (0x72616d65), + ACE_NTOHL (0x74657200), // name = SchedulingParameter + 1, // member count + 11, + ACE_NTOHL (0x696d706f), + ACE_NTOHL (0x7274616e), + ACE_NTOHL (0x63650000), // name = importance + CORBA::tk_long, + +}; + +static CORBA::TypeCode _tc_TAO_tc_MIF_Scheduling_SchedulingParameter ( + CORBA::tk_struct, + sizeof (_oc_MIF_Scheduling_SchedulingParameter), + (char *) &_oc_MIF_Scheduling_SchedulingParameter, + 0, + sizeof (MIF_Scheduling::SchedulingParameter) + ); + +TAO_NAMESPACE_TYPE (CORBA::TypeCode_ptr) +TAO_NAMESPACE_BEGIN (MIF_Scheduling) +TAO_NAMESPACE_DEFINE ( + ::CORBA::TypeCode_ptr, + _tc_SchedulingParameter, + &_tc_TAO_tc_MIF_Scheduling_SchedulingParameter + ) +TAO_NAMESPACE_END + +// TAO_IDL - Generated from +// be/be_visitor_structure/structure_cs.cpp:66 + +void MIF_Scheduling::SchedulingParameter::_tao_any_destructor (void *_tao_void_pointer) +{ + SchedulingParameter *tmp = ACE_static_cast (SchedulingParameter*, _tao_void_pointer); + delete tmp; +} + +// TAO_IDL - Generated from +// be/be_type.cpp:297 + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +template class + TAO_Fixed_Var_T< + MIF_Scheduling::SchedulingParameter + >; + +template class TAO_Var_Base_T< + MIF_Scheduling::SchedulingParameter + >; + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +# pragma instantiate \ + TAO_Fixed_Var_T< \ + MIF_Scheduling::SchedulingParameter \ + > + +#pragma instantiate TAO_Var_Base_T< + MIF_Scheduling::SchedulingParameter + > + +#endif /* !ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + +// TAO_IDL - Generated from +// be/be_visitor_interface/interface_cs.cpp:63 + +int MIF_Scheduling::SchedulingParameterPolicy::_tao_class_id = 0; + +MIF_Scheduling::SchedulingParameterPolicy_ptr +MIF_Scheduling::tao_SchedulingParameterPolicy_life::tao_duplicate ( + SchedulingParameterPolicy_ptr p + ) +{ + return SchedulingParameterPolicy::_duplicate (p); +} + +void +MIF_Scheduling::tao_SchedulingParameterPolicy_life::tao_release ( + SchedulingParameterPolicy_ptr p + ) +{ + CORBA::release (p); +} + +MIF_Scheduling::SchedulingParameterPolicy_ptr +MIF_Scheduling::tao_SchedulingParameterPolicy_life::tao_nil ( + void + ) +{ + return SchedulingParameterPolicy::_nil (); +} + +CORBA::Boolean +MIF_Scheduling::tao_SchedulingParameterPolicy_life::tao_marshal ( + SchedulingParameterPolicy_ptr p, + TAO_OutputCDR &cdr + ) +{ + return p->marshal (cdr); +} + +MIF_Scheduling::SchedulingParameterPolicy_ptr +MIF_Scheduling::tao_SchedulingParameterPolicy_cast::tao_narrow ( + CORBA::Object *p + ACE_ENV_ARG_DECL + ) +{ + return SchedulingParameterPolicy::_narrow (p ACE_ENV_ARG_PARAMETER); +} + +CORBA::Object * +MIF_Scheduling::tao_SchedulingParameterPolicy_cast::tao_upcast ( + void *src + ) +{ + SchedulingParameterPolicy **tmp = + ACE_static_cast (SchedulingParameterPolicy **, src); + return *tmp; +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + template class + TAO_Objref_Var_T< + MIF_Scheduling::SchedulingParameterPolicy, + MIF_Scheduling::tao_SchedulingParameterPolicy_life + >; + template class + TAO_Objref_Out_T< + MIF_Scheduling::SchedulingParameterPolicy, + MIF_Scheduling::tao_SchedulingParameterPolicy_life + >; +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +# pragma instantiate \ + TAO_Objref_Var_T< \ + MIF_Scheduling::SchedulingParameterPolicy, \ + MIF_Scheduling::tao_SchedulingParameterPolicy_life \ + > +# pragma instantiate \ + TAO_Objref_Out_T< \ + MIF_Scheduling::SchedulingParameterPolicy, \ + MIF_Scheduling::tao_SchedulingParameterPolicy_life \ + > +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + +// TAO_IDL - Generated from +// be/be_visitor_interface/interface_cs.cpp:245 + +MIF_Scheduling::SchedulingParameterPolicy::SchedulingParameterPolicy (void) +{} + +MIF_Scheduling::SchedulingParameterPolicy::~SchedulingParameterPolicy (void) +{} + +void +MIF_Scheduling::SchedulingParameterPolicy::_tao_any_destructor (void *_tao_void_pointer) +{ + SchedulingParameterPolicy *tmp = ACE_static_cast (SchedulingParameterPolicy *, _tao_void_pointer); + CORBA::release (tmp); +} + +MIF_Scheduling::SchedulingParameterPolicy_ptr +MIF_Scheduling::SchedulingParameterPolicy::_narrow ( + CORBA::Object_ptr obj + ACE_ENV_ARG_DECL + ) +{ + return SchedulingParameterPolicy::_unchecked_narrow (obj ACE_ENV_ARG_PARAMETER); +} + +MIF_Scheduling::SchedulingParameterPolicy_ptr +MIF_Scheduling::SchedulingParameterPolicy::_unchecked_narrow ( + CORBA::Object_ptr obj + ACE_ENV_ARG_DECL_NOT_USED + ) +{ + if (CORBA::is_nil (obj)) + { + return SchedulingParameterPolicy::_nil (); + } + + return + ACE_reinterpret_cast ( + SchedulingParameterPolicy_ptr, + obj->_tao_QueryInterface ( + ACE_reinterpret_cast ( + ptrdiff_t, + &SchedulingParameterPolicy::_tao_class_id + ) + ) + ); +} + +MIF_Scheduling::SchedulingParameterPolicy_ptr +MIF_Scheduling::SchedulingParameterPolicy::_duplicate (SchedulingParameterPolicy_ptr obj) +{ + if (! CORBA::is_nil (obj)) + { + obj->_add_ref (); + } + + return obj; +} + +void *MIF_Scheduling::SchedulingParameterPolicy::_tao_QueryInterface (ptrdiff_t type) +{ + void *retv = 0; + + if (type == ACE_reinterpret_cast ( + ptrdiff_t, + &::CORBA::Policy::_tao_class_id) + ) + { + retv = + ACE_reinterpret_cast ( + void *, + ACE_static_cast ( + CORBA::Policy_ptr, + this + ) + ); + } + else if (type == ACE_reinterpret_cast ( + ptrdiff_t, + &ACE_NESTED_CLASS (::MIF_Scheduling, SchedulingParameterPolicy)::_tao_class_id) + ) + { + retv = ACE_reinterpret_cast (void*, this); + } + else if (type == ACE_reinterpret_cast ( + ptrdiff_t, + &CORBA::Object::_tao_class_id) + ) + { + retv = + ACE_reinterpret_cast ( + void *, + ACE_static_cast (CORBA::Object_ptr, this) + ); + } + + if (retv != 0) + { + this->_add_ref (); + } + + return retv; +} + +const char* MIF_Scheduling::SchedulingParameterPolicy::_interface_repository_id (void) const +{ + return "IDL:MIF_Scheduling/SchedulingParameterPolicy:1.0"; +} + +CORBA::Boolean +MIF_Scheduling::SchedulingParameterPolicy::marshal (TAO_OutputCDR &) +{ + return 0; +} + +// TAO_IDL - Generated from +// be/be_visitor_typecode/typecode_defn.cpp:284 + +static const CORBA::Long _oc_MIF_Scheduling_SchedulingParameterPolicy[] = +{ + TAO_ENCAP_BYTE_ORDER, // byte order + 49, + ACE_NTOHL (0x49444c3a), + ACE_NTOHL (0x4d49465f), + ACE_NTOHL (0x53636865), + ACE_NTOHL (0x64756c69), + ACE_NTOHL (0x6e672f53), + ACE_NTOHL (0x63686564), + ACE_NTOHL (0x756c696e), + ACE_NTOHL (0x67506172), + ACE_NTOHL (0x616d6574), + ACE_NTOHL (0x6572506f), + ACE_NTOHL (0x6c696379), + ACE_NTOHL (0x3a312e30), + ACE_NTOHL (0x0), // repository ID = IDL:MIF_Scheduling/SchedulingParameterPolicy:1.0 + 26, + ACE_NTOHL (0x53636865), + ACE_NTOHL (0x64756c69), + ACE_NTOHL (0x6e675061), + ACE_NTOHL (0x72616d65), + ACE_NTOHL (0x74657250), + ACE_NTOHL (0x6f6c6963), + ACE_NTOHL (0x79000000), // name = SchedulingParameterPolicy + }; + +static CORBA::TypeCode _tc_TAO_tc_MIF_Scheduling_SchedulingParameterPolicy ( + CORBA::tk_objref, + sizeof (_oc_MIF_Scheduling_SchedulingParameterPolicy), + (char *) &_oc_MIF_Scheduling_SchedulingParameterPolicy, + 0, + sizeof (MIF_Scheduling::SchedulingParameterPolicy) + ); + +TAO_NAMESPACE_TYPE (CORBA::TypeCode_ptr) +TAO_NAMESPACE_BEGIN (MIF_Scheduling) +TAO_NAMESPACE_DEFINE ( + ::CORBA::TypeCode_ptr, + _tc_SchedulingParameterPolicy, + &_tc_TAO_tc_MIF_Scheduling_SchedulingParameterPolicy + ) +TAO_NAMESPACE_END + +// TAO_IDL - Generated from +// be/be_visitor_interface/interface_cs.cpp:63 + +int MIF_Scheduling::Scheduler::_tao_class_id = 0; + +MIF_Scheduling::Scheduler_ptr +MIF_Scheduling::tao_Scheduler_life::tao_duplicate ( + Scheduler_ptr p + ) +{ + return Scheduler::_duplicate (p); +} + +void +MIF_Scheduling::tao_Scheduler_life::tao_release ( + Scheduler_ptr p + ) +{ + CORBA::release (p); +} + +MIF_Scheduling::Scheduler_ptr +MIF_Scheduling::tao_Scheduler_life::tao_nil ( + void + ) +{ + return Scheduler::_nil (); +} + +CORBA::Boolean +MIF_Scheduling::tao_Scheduler_life::tao_marshal ( + Scheduler_ptr p, + TAO_OutputCDR &cdr + ) +{ + return p->marshal (cdr); +} + +MIF_Scheduling::Scheduler_ptr +MIF_Scheduling::tao_Scheduler_cast::tao_narrow ( + CORBA::Object *p + ACE_ENV_ARG_DECL + ) +{ + return Scheduler::_narrow (p ACE_ENV_ARG_PARAMETER); +} + +CORBA::Object * +MIF_Scheduling::tao_Scheduler_cast::tao_upcast ( + void *src + ) +{ + Scheduler **tmp = + ACE_static_cast (Scheduler **, src); + return *tmp; +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + template class + TAO_Objref_Var_T< + MIF_Scheduling::Scheduler, + MIF_Scheduling::tao_Scheduler_life + >; + template class + TAO_Objref_Out_T< + MIF_Scheduling::Scheduler, + MIF_Scheduling::tao_Scheduler_life + >; +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +# pragma instantiate \ + TAO_Objref_Var_T< \ + MIF_Scheduling::Scheduler, \ + MIF_Scheduling::tao_Scheduler_life \ + > +# pragma instantiate \ + TAO_Objref_Out_T< \ + MIF_Scheduling::Scheduler, \ + MIF_Scheduling::tao_Scheduler_life \ + > +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + +// TAO_IDL - Generated from +// be/be_visitor_interface/interface_cs.cpp:245 + +MIF_Scheduling::Scheduler::Scheduler (void) +{} + +MIF_Scheduling::Scheduler::~Scheduler (void) +{} + +void +MIF_Scheduling::Scheduler::_tao_any_destructor (void *_tao_void_pointer) +{ + Scheduler *tmp = ACE_static_cast (Scheduler *, _tao_void_pointer); + CORBA::release (tmp); +} + +MIF_Scheduling::Scheduler_ptr +MIF_Scheduling::Scheduler::_narrow ( + CORBA::Object_ptr obj + ACE_ENV_ARG_DECL + ) +{ + return Scheduler::_unchecked_narrow (obj ACE_ENV_ARG_PARAMETER); +} + +MIF_Scheduling::Scheduler_ptr +MIF_Scheduling::Scheduler::_unchecked_narrow ( + CORBA::Object_ptr obj + ACE_ENV_ARG_DECL_NOT_USED + ) +{ + if (CORBA::is_nil (obj)) + { + return Scheduler::_nil (); + } + + return + ACE_reinterpret_cast ( + Scheduler_ptr, + obj->_tao_QueryInterface ( + ACE_reinterpret_cast ( + ptrdiff_t, + &Scheduler::_tao_class_id + ) + ) + ); +} + +MIF_Scheduling::Scheduler_ptr +MIF_Scheduling::Scheduler::_duplicate (Scheduler_ptr obj) +{ + if (! CORBA::is_nil (obj)) + { + obj->_add_ref (); + } + + return obj; +} + +void *MIF_Scheduling::Scheduler::_tao_QueryInterface (ptrdiff_t type) +{ + void *retv = 0; + + if (type == ACE_reinterpret_cast ( + ptrdiff_t, + &::RTScheduling::Scheduler::_tao_class_id) + ) + { + retv = + ACE_reinterpret_cast ( + void *, + ACE_static_cast ( + RTScheduling::Scheduler_ptr, + this + ) + ); + } + else if (type == ACE_reinterpret_cast ( + ptrdiff_t, + &ACE_NESTED_CLASS (::MIF_Scheduling, Scheduler)::_tao_class_id) + ) + { + retv = ACE_reinterpret_cast (void*, this); + } + else if (type == ACE_reinterpret_cast ( + ptrdiff_t, + &CORBA::Object::_tao_class_id) + ) + { + retv = + ACE_reinterpret_cast ( + void *, + ACE_static_cast (CORBA::Object_ptr, this) + ); + } + + if (retv != 0) + { + this->_add_ref (); + } + + return retv; +} + +const char* MIF_Scheduling::Scheduler::_interface_repository_id (void) const +{ + return "IDL:MIF_Scheduling/Scheduler:1.0"; +} + +CORBA::Boolean +MIF_Scheduling::Scheduler::marshal (TAO_OutputCDR &) +{ + return 0; +} + +// TAO_IDL - Generated from +// be/be_visitor_typecode/typecode_defn.cpp:284 + +static const CORBA::Long _oc_MIF_Scheduling_Scheduler[] = +{ + TAO_ENCAP_BYTE_ORDER, // byte order + 33, + ACE_NTOHL (0x49444c3a), + ACE_NTOHL (0x4d49465f), + ACE_NTOHL (0x53636865), + ACE_NTOHL (0x64756c69), + ACE_NTOHL (0x6e672f53), + ACE_NTOHL (0x63686564), + ACE_NTOHL (0x756c6572), + ACE_NTOHL (0x3a312e30), + ACE_NTOHL (0x0), // repository ID = IDL:MIF_Scheduling/Scheduler:1.0 + 10, + ACE_NTOHL (0x53636865), + ACE_NTOHL (0x64756c65), + ACE_NTOHL (0x72000000), // name = Scheduler + }; + +static CORBA::TypeCode _tc_TAO_tc_MIF_Scheduling_Scheduler ( + CORBA::tk_objref, + sizeof (_oc_MIF_Scheduling_Scheduler), + (char *) &_oc_MIF_Scheduling_Scheduler, + 0, + sizeof (MIF_Scheduling::Scheduler) + ); + +TAO_NAMESPACE_TYPE (CORBA::TypeCode_ptr) +TAO_NAMESPACE_BEGIN (MIF_Scheduling) +TAO_NAMESPACE_DEFINE ( + ::CORBA::TypeCode_ptr, + _tc_Scheduler, + &_tc_TAO_tc_MIF_Scheduling_Scheduler + ) +TAO_NAMESPACE_END + +// TAO_IDL - Generated from +// be/be_visitor_structure/any_op_cs.cpp:54 + +// Copying insertion. +void operator<<= ( + CORBA::Any &_tao_any, + const MIF_Scheduling::SchedulingParameter &_tao_elem + ) +{ + TAO::Any_Dual_Impl_T<MIF_Scheduling::SchedulingParameter>::insert_copy ( + _tao_any, + MIF_Scheduling::SchedulingParameter::_tao_any_destructor, + MIF_Scheduling::_tc_SchedulingParameter, + _tao_elem + ); +} + +// Non-copying insertion. +void operator<<= ( + CORBA::Any &_tao_any, + MIF_Scheduling::SchedulingParameter *_tao_elem + ) +{ + TAO::Any_Dual_Impl_T<MIF_Scheduling::SchedulingParameter>::insert ( + _tao_any, + MIF_Scheduling::SchedulingParameter::_tao_any_destructor, + MIF_Scheduling::_tc_SchedulingParameter, + _tao_elem + ); +} + +// Extraction to non-const pointer (deprecated). +CORBA::Boolean operator>>= ( + const CORBA::Any &_tao_any, + MIF_Scheduling::SchedulingParameter *&_tao_elem + ) +{ + return _tao_any >>= ACE_const_cast ( + const MIF_Scheduling::SchedulingParameter *&, + _tao_elem + ); +} + +// Extraction to const pointer. +CORBA::Boolean operator>>= ( + const CORBA::Any &_tao_any, + const MIF_Scheduling::SchedulingParameter *&_tao_elem + ) +{ + return + TAO::Any_Dual_Impl_T<MIF_Scheduling::SchedulingParameter>::extract ( + _tao_any, + MIF_Scheduling::SchedulingParameter::_tao_any_destructor, + MIF_Scheduling::_tc_SchedulingParameter, + _tao_elem + ); +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) || \ + defined (ACE_HAS_GNU_REPO) + template class TAO::Any_Dual_Impl_T<MIF_Scheduling::SchedulingParameter>; +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +# pragma instantiate TAO::Any_Dual_Impl_T<MIF_Scheduling::SchedulingParameter> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + +// TAO_IDL - Generated from +// be/be_visitor_interface/any_op_cs.cpp:50 + +// Copying insertion. +void +operator<<= ( + CORBA::Any &_tao_any, + MIF_Scheduling::SchedulingParameterPolicy_ptr _tao_elem + ) +{ + MIF_Scheduling::SchedulingParameterPolicy_ptr _tao_objptr = + MIF_Scheduling::SchedulingParameterPolicy::_duplicate (_tao_elem); + _tao_any <<= &_tao_objptr; +} + +// Non-copying insertion. +void +operator<<= ( + CORBA::Any &_tao_any, + MIF_Scheduling::SchedulingParameterPolicy_ptr *_tao_elem + ) +{ + TAO::Any_Impl_T<MIF_Scheduling::SchedulingParameterPolicy>::insert ( + _tao_any, + MIF_Scheduling::SchedulingParameterPolicy::_tao_any_destructor, + MIF_Scheduling::_tc_SchedulingParameterPolicy, + *_tao_elem + ); +} + +CORBA::Boolean +operator>>= ( + const CORBA::Any &_tao_any, + MIF_Scheduling::SchedulingParameterPolicy_ptr &_tao_elem + ) +{ + return + TAO::Any_Impl_T<MIF_Scheduling::SchedulingParameterPolicy>::extract ( + _tao_any, + MIF_Scheduling::SchedulingParameterPolicy::_tao_any_destructor, + MIF_Scheduling::_tc_SchedulingParameterPolicy, + _tao_elem + ); +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) || \ + defined (ACE_HAS_GNU_REPO) + template class TAO::Any_Impl_T<MIF_Scheduling::SchedulingParameterPolicy>; +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +# pragma instantiate TAO::Any_Impl_T<MIF_Scheduling::SchedulingParameterPolicy> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + +// TAO_IDL - Generated from +// be/be_visitor_interface/any_op_cs.cpp:50 + +// Copying insertion. +void +operator<<= ( + CORBA::Any &_tao_any, + MIF_Scheduling::Scheduler_ptr _tao_elem + ) +{ + MIF_Scheduling::Scheduler_ptr _tao_objptr = + MIF_Scheduling::Scheduler::_duplicate (_tao_elem); + _tao_any <<= &_tao_objptr; +} + +// Non-copying insertion. +void +operator<<= ( + CORBA::Any &_tao_any, + MIF_Scheduling::Scheduler_ptr *_tao_elem + ) +{ + TAO::Any_Impl_T<MIF_Scheduling::Scheduler>::insert ( + _tao_any, + MIF_Scheduling::Scheduler::_tao_any_destructor, + MIF_Scheduling::_tc_Scheduler, + *_tao_elem + ); +} + +CORBA::Boolean +operator>>= ( + const CORBA::Any &_tao_any, + MIF_Scheduling::Scheduler_ptr &_tao_elem + ) +{ + return + TAO::Any_Impl_T<MIF_Scheduling::Scheduler>::extract ( + _tao_any, + MIF_Scheduling::Scheduler::_tao_any_destructor, + MIF_Scheduling::_tc_Scheduler, + _tao_elem + ); +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) || \ + defined (ACE_HAS_GNU_REPO) + template class TAO::Any_Impl_T<MIF_Scheduling::Scheduler>; +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +# pragma instantiate TAO::Any_Impl_T<MIF_Scheduling::Scheduler> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + diff --git a/TAO/examples/Kokyu_dsrt_schedulers/MIF_SchedulingC.h b/TAO/examples/Kokyu_dsrt_schedulers/MIF_SchedulingC.h new file mode 100644 index 00000000000..cf54794e00b --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/MIF_SchedulingC.h @@ -0,0 +1,407 @@ +// -*- C++ -*- +// +// $Id$ + +// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** +// TAO and the TAO IDL Compiler have been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// and +// Distributed Object Computing Laboratory +// University of California at Irvine +// Irvine, CA +// USA +// http://doc.ece.uci.edu/ +// and +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +// TAO_IDL - Generated from +// be/be_codegen.cpp:151 + +#ifndef _TAO_IDL_MIF_SCHEDULINGC_H_ +#define _TAO_IDL_MIF_SCHEDULINGC_H_ + + +#include "tao/corba.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + + +#include "Kokyu_dsrt_schedulers_export.h" + +#include "tao/RTScheduling/RTScheduler.h" +#include "tao/RTCORBA/RTCORBA.h" + +#if defined (TAO_EXPORT_MACRO) +#undef TAO_EXPORT_MACRO +#endif +#define TAO_EXPORT_MACRO Kokyu_DSRT_Schedulers_Export + +#if defined (TAO_EXPORT_NESTED_CLASSES) +# if defined (TAO_EXPORT_NESTED_MACRO) +# undef TAO_EXPORT_NESTED_MACRO +# endif /* defined (TAO_EXPORT_NESTED_MACRO) */ +# define TAO_EXPORT_NESTED_MACRO Kokyu_DSRT_Schedulers_Export +#endif /* TAO_EXPORT_NESTED_CLASSES */ + +#if defined(_MSC_VER) +#if (_MSC_VER >= 1200) +#pragma warning(push) +#endif /* _MSC_VER >= 1200 */ +#pragma warning(disable:4250) +#endif /* _MSC_VER */ + +#if defined (__BORLANDC__) +#pragma option push -w-rvl -w-rch -w-ccc -w-inl +#endif /* __BORLANDC__ */ + +// TAO_IDL - Generated from +// be/be_visitor_module/module_ch.cpp:48 + +TAO_NAMESPACE MIF_Scheduling +{ + + // TAO_IDL - Generated from + // be/be_type.cpp:254 + + struct SchedulingParameter; + + typedef + TAO_Fixed_Var_T< + SchedulingParameter + > + SchedulingParameter_var; + + typedef + SchedulingParameter & + SchedulingParameter_out; + + // TAO_IDL - Generated from + // be/be_visitor_structure/structure_ch.cpp:52 + + struct Kokyu_DSRT_Schedulers_Export SchedulingParameter + { + typedef SchedulingParameter_var _var_type; + + static void _tao_any_destructor (void *); + CORBA::Long importance; + }; + + // TAO_IDL - Generated from + // be/be_visitor_typecode/typecode_decl.cpp:44 + + TAO_NAMESPACE_STORAGE_CLASS ::CORBA::TypeCode_ptr _tc_SchedulingParameter; + + // TAO_IDL - Generated from + // be/be_interface.cpp:584 + +#if !defined (_MIF_SCHEDULING_SCHEDULINGPARAMETERPOLICY__ODDS_N_ENDS_CH_) +#define _MIF_SCHEDULING_SCHEDULINGPARAMETERPOLICY__ODDS_N_ENDS_CH_ + + class SchedulingParameterPolicy; + typedef SchedulingParameterPolicy *SchedulingParameterPolicy_ptr; + struct tao_SchedulingParameterPolicy_life; + + typedef + TAO_Objref_Var_T< + SchedulingParameterPolicy, + tao_SchedulingParameterPolicy_life + > + SchedulingParameterPolicy_var; + + typedef + TAO_Objref_Out_T< + SchedulingParameterPolicy, + tao_SchedulingParameterPolicy_life + > + SchedulingParameterPolicy_out; + + struct Kokyu_DSRT_Schedulers_Export tao_SchedulingParameterPolicy_life + { + static SchedulingParameterPolicy_ptr tao_duplicate (SchedulingParameterPolicy_ptr); + static void tao_release (SchedulingParameterPolicy_ptr); + static SchedulingParameterPolicy_ptr tao_nil (void); + static CORBA::Boolean tao_marshal ( + SchedulingParameterPolicy_ptr, + TAO_OutputCDR & + ); + }; + + struct Kokyu_DSRT_Schedulers_Export tao_SchedulingParameterPolicy_cast + { + static SchedulingParameterPolicy_ptr tao_narrow ( + CORBA::Object_ptr + ACE_ENV_ARG_DECL + ); + static CORBA::Object_ptr tao_upcast (void *); + }; + +#endif /* end #if !defined */ + + // TAO_IDL - Generated from + // be/be_visitor_interface/interface_ch.cpp:53 + +#if !defined (_MIF_SCHEDULING_SCHEDULINGPARAMETERPOLICY_CH_) +#define _MIF_SCHEDULING_SCHEDULINGPARAMETERPOLICY_CH_ + + class Kokyu_DSRT_Schedulers_Export SchedulingParameterPolicy + : public virtual CORBA::Policy + { + public: + typedef SchedulingParameterPolicy_ptr _ptr_type; + typedef SchedulingParameterPolicy_var _var_type; + static int _tao_class_id; + + // The static operations. + static SchedulingParameterPolicy_ptr _duplicate (SchedulingParameterPolicy_ptr obj); + + static SchedulingParameterPolicy_ptr _narrow ( + CORBA::Object_ptr obj + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ); + + static SchedulingParameterPolicy_ptr _unchecked_narrow ( + CORBA::Object_ptr obj + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ); + + static SchedulingParameterPolicy_ptr _nil (void) + { + return (SchedulingParameterPolicy_ptr)0; + } + + static void _tao_any_destructor (void *); + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual ::MIF_Scheduling::SchedulingParameter value ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual void value ( + const MIF_Scheduling::SchedulingParameter & value + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_interface/interface_ch.cpp:210 + + virtual void *_tao_QueryInterface (ptrdiff_t type); + + virtual const char* _interface_repository_id (void) const; + virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr); + + protected: + SchedulingParameterPolicy (void); + virtual ~SchedulingParameterPolicy (void); + + private: + SchedulingParameterPolicy (const SchedulingParameterPolicy &); + void operator= (const SchedulingParameterPolicy &); + }; + +#endif /* end #if !defined */ + + // TAO_IDL - Generated from + // be/be_visitor_typecode/typecode_decl.cpp:44 + + TAO_NAMESPACE_STORAGE_CLASS ::CORBA::TypeCode_ptr _tc_SchedulingParameterPolicy; + + // TAO_IDL - Generated from + // be/be_interface.cpp:584 + +#if !defined (_MIF_SCHEDULING_SCHEDULER__ODDS_N_ENDS_CH_) +#define _MIF_SCHEDULING_SCHEDULER__ODDS_N_ENDS_CH_ + + class Scheduler; + typedef Scheduler *Scheduler_ptr; + struct tao_Scheduler_life; + + typedef + TAO_Objref_Var_T< + Scheduler, + tao_Scheduler_life + > + Scheduler_var; + + typedef + TAO_Objref_Out_T< + Scheduler, + tao_Scheduler_life + > + Scheduler_out; + + struct Kokyu_DSRT_Schedulers_Export tao_Scheduler_life + { + static Scheduler_ptr tao_duplicate (Scheduler_ptr); + static void tao_release (Scheduler_ptr); + static Scheduler_ptr tao_nil (void); + static CORBA::Boolean tao_marshal ( + Scheduler_ptr, + TAO_OutputCDR & + ); + }; + + struct Kokyu_DSRT_Schedulers_Export tao_Scheduler_cast + { + static Scheduler_ptr tao_narrow ( + CORBA::Object_ptr + ACE_ENV_ARG_DECL + ); + static CORBA::Object_ptr tao_upcast (void *); + }; + +#endif /* end #if !defined */ + + // TAO_IDL - Generated from + // be/be_visitor_interface/interface_ch.cpp:53 + +#if !defined (_MIF_SCHEDULING_SCHEDULER_CH_) +#define _MIF_SCHEDULING_SCHEDULER_CH_ + + class Kokyu_DSRT_Schedulers_Export Scheduler + : public virtual RTScheduling::Scheduler + { + public: + typedef Scheduler_ptr _ptr_type; + typedef Scheduler_var _var_type; + static int _tao_class_id; + + // The static operations. + static Scheduler_ptr _duplicate (Scheduler_ptr obj); + + static Scheduler_ptr _narrow ( + CORBA::Object_ptr obj + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ); + + static Scheduler_ptr _unchecked_narrow ( + CORBA::Object_ptr obj + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ); + + static Scheduler_ptr _nil (void) + { + return (Scheduler_ptr)0; + } + + static void _tao_any_destructor (void *); + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual ::MIF_Scheduling::SchedulingParameterPolicy_ptr create_scheduling_parameter ( + const MIF_Scheduling::SchedulingParameter & value + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_interface/interface_ch.cpp:210 + + virtual void *_tao_QueryInterface (ptrdiff_t type); + + virtual const char* _interface_repository_id (void) const; + virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr); + + protected: + Scheduler (void); + virtual ~Scheduler (void); + + private: + Scheduler (const Scheduler &); + void operator= (const Scheduler &); + }; + +#endif /* end #if !defined */ + + // TAO_IDL - Generated from + // be/be_visitor_typecode/typecode_decl.cpp:44 + + TAO_NAMESPACE_STORAGE_CLASS ::CORBA::TypeCode_ptr _tc_Scheduler; + +// TAO_IDL - Generated from +// be/be_visitor_module/module_ch.cpp:67 + +} +TAO_NAMESPACE_CLOSE // module MIF_Scheduling + +// TAO_IDL - Generated from +// be/be_visitor_structure/any_op_ch.cpp:52 + +Kokyu_DSRT_Schedulers_Export void operator<<= (CORBA::Any &, const MIF_Scheduling::SchedulingParameter &); // copying version +Kokyu_DSRT_Schedulers_Export void operator<<= (CORBA::Any &, MIF_Scheduling::SchedulingParameter*); // noncopying version +Kokyu_DSRT_Schedulers_Export CORBA::Boolean operator>>= (const CORBA::Any &, MIF_Scheduling::SchedulingParameter *&); // deprecated +Kokyu_DSRT_Schedulers_Export CORBA::Boolean operator>>= (const CORBA::Any &, const MIF_Scheduling::SchedulingParameter *&); + +// TAO_IDL - Generated from +// be/be_visitor_interface/any_op_ch.cpp:52 + +Kokyu_DSRT_Schedulers_Export void operator<<= (CORBA::Any &, MIF_Scheduling::SchedulingParameterPolicy_ptr); // copying +Kokyu_DSRT_Schedulers_Export void operator<<= (CORBA::Any &, MIF_Scheduling::SchedulingParameterPolicy_ptr *); // non-copying +Kokyu_DSRT_Schedulers_Export CORBA::Boolean operator>>= (const CORBA::Any &, MIF_Scheduling::SchedulingParameterPolicy_ptr &); + +// TAO_IDL - Generated from +// be/be_visitor_interface/any_op_ch.cpp:52 + +Kokyu_DSRT_Schedulers_Export void operator<<= (CORBA::Any &, MIF_Scheduling::Scheduler_ptr); // copying +Kokyu_DSRT_Schedulers_Export void operator<<= (CORBA::Any &, MIF_Scheduling::Scheduler_ptr *); // non-copying +Kokyu_DSRT_Schedulers_Export CORBA::Boolean operator>>= (const CORBA::Any &, MIF_Scheduling::Scheduler_ptr &); + +// TAO_IDL - Generated from +// be/be_visitor_root/cdr_op.cpp:48 + +#ifndef __ACE_INLINE__ + +// TAO_IDL - Generated from +// be/be_visitor_structure/cdr_op_ch.cpp:53 + +Kokyu_DSRT_Schedulers_Export CORBA::Boolean operator<< (TAO_OutputCDR &, const MIF_Scheduling::SchedulingParameter &); +Kokyu_DSRT_Schedulers_Export CORBA::Boolean operator>> (TAO_InputCDR &, MIF_Scheduling::SchedulingParameter &); + +// TAO_IDL - Generated from +// be/be_visitor_root/cdr_op.cpp:64 + +#endif /* __ACE_INLINE__ */ + +// TAO_IDL - Generated from +// be/be_codegen.cpp:1060 + +#if defined (__ACE_INLINE__) +#include "MIF_SchedulingC.i" +#endif /* defined INLINE */ + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +#pragma warning(pop) +#endif /* _MSC_VER */ + +#if defined (__BORLANDC__) +#pragma option pop +#endif /* __BORLANDC__ */ + +#endif /* ifndef */ + diff --git a/TAO/examples/Kokyu_dsrt_schedulers/MIF_SchedulingC.h.diff b/TAO/examples/Kokyu_dsrt_schedulers/MIF_SchedulingC.h.diff new file mode 100644 index 00000000000..c236f5578c5 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/MIF_SchedulingC.h.diff @@ -0,0 +1,13 @@ +--- MIF_SchedulingC.h.orig Mon Sep 1 10:52:30 2003 ++++ MIF_SchedulingC.h Mon Sep 1 10:53:05 2003 +@@ -41,8 +41,8 @@ + + #include "Kokyu_dsrt_schedulers_export.h" + +-#include "tao/RTScheduling/RTSchedulerC.h" +-#include "tao/RTCORBA/RTCORBAC.h" ++#include "tao/RTScheduling/RTScheduler.h" ++#include "tao/RTCORBA/RTCORBA.h" + + #if defined (TAO_EXPORT_MACRO) + #undef TAO_EXPORT_MACRO diff --git a/TAO/examples/Kokyu_dsrt_schedulers/MIF_SchedulingC.i b/TAO/examples/Kokyu_dsrt_schedulers/MIF_SchedulingC.i new file mode 100644 index 00000000000..dd75ec080f8 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/MIF_SchedulingC.i @@ -0,0 +1,121 @@ +// -*- C++ -*- +// +// $Id$ + +// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** +// TAO and the TAO IDL Compiler have been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// and +// Distributed Object Computing Laboratory +// University of California at Irvine +// Irvine, CA +// USA +// http://doc.ece.uci.edu/ +// and +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + + +// TAO_IDL - Generated from +// be/be_visitor_interface/interface_ci.cpp:63 + +#if !defined (_MIF_SCHEDULING_SCHEDULINGPARAMETERPOLICY___CI_) +#define _MIF_SCHEDULING_SCHEDULINGPARAMETERPOLICY___CI_ + +template<> +ACE_INLINE +CORBA::Boolean +TAO::Any_Impl_T<MIF_Scheduling::SchedulingParameterPolicy>::to_object ( + CORBA::Object_ptr &_tao_elem + ) const +{ + _tao_elem = CORBA::Object::_duplicate (this->value_); + return 1; +} + +template<> +ACE_INLINE +CORBA::Boolean +TAO::Any_Impl_T<MIF_Scheduling::SchedulingParameterPolicy>::marshal_value (TAO_OutputCDR &) +{ + return 0; +} + +template<> +ACE_INLINE +CORBA::Boolean +TAO::Any_Impl_T<MIF_Scheduling::SchedulingParameterPolicy>::demarshal_value (TAO_InputCDR &) +{ + return 0; +} + +#endif /* end #if !defined */ + +// TAO_IDL - Generated from +// be/be_visitor_interface/interface_ci.cpp:63 + +#if !defined (_MIF_SCHEDULING_SCHEDULER___CI_) +#define _MIF_SCHEDULING_SCHEDULER___CI_ + +template<> +ACE_INLINE +CORBA::Boolean +TAO::Any_Impl_T<MIF_Scheduling::Scheduler>::to_object ( + CORBA::Object_ptr &_tao_elem + ) const +{ + _tao_elem = CORBA::Object::_duplicate (this->value_); + return 1; +} + +template<> +ACE_INLINE +CORBA::Boolean +TAO::Any_Impl_T<MIF_Scheduling::Scheduler>::marshal_value (TAO_OutputCDR &) +{ + return 0; +} + +template<> +ACE_INLINE +CORBA::Boolean +TAO::Any_Impl_T<MIF_Scheduling::Scheduler>::demarshal_value (TAO_InputCDR &) +{ + return 0; +} + +#endif /* end #if !defined */ + +// TAO_IDL - Generated from +// be/be_visitor_structure/cdr_op_ci.cpp:70 + +ACE_INLINE +CORBA::Boolean operator<< ( + TAO_OutputCDR &strm, + const MIF_Scheduling::SchedulingParameter &_tao_aggregate + ) +{ + return + (strm << _tao_aggregate.importance); +} + +ACE_INLINE +CORBA::Boolean operator>> ( + TAO_InputCDR &strm, + MIF_Scheduling::SchedulingParameter &_tao_aggregate + ) +{ + return + (strm >> _tao_aggregate.importance); +} + diff --git a/TAO/examples/Kokyu_dsrt_schedulers/MUF_Scheduler.cpp b/TAO/examples/Kokyu_dsrt_schedulers/MUF_Scheduler.cpp new file mode 100644 index 00000000000..da0c4c79599 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/MUF_Scheduler.cpp @@ -0,0 +1,760 @@ +//$Id$ + +#include "MUF_Scheduler.h" +#include "Kokyu_qosC.h" +#include "utils.h" +#include "tao/RTScheduling/Request_Interceptor.h" + +MUF_Scheduling::SchedulingParameter +MUF_Sched_Param_Policy::value (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->value_; +} + +void +MUF_Sched_Param_Policy::value (const MUF_Scheduling::SchedulingParameter& value ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + this->value_ = value; +} + +MUF_Scheduler::MUF_Scheduler (CORBA::ORB_ptr orb, + Kokyu::DSRT_Dispatcher_Impl_t disp_impl_type, + int ace_sched_policy, + int ace_sched_scope) + : orb_ (orb), + disp_impl_type_ (disp_impl_type), + ace_sched_policy_ (ace_sched_policy), + ace_sched_scope_ (ace_sched_scope) +{ + ACE_DECLARE_NEW_ENV; + + Kokyu::DSRT_ConfigInfo config; + + config.impl_type_ = this->disp_impl_type_; + config.sched_policy_ = ace_sched_policy_; + config.sched_scope_ = ace_sched_scope_; + + Kokyu::DSRT_Dispatcher_Factory<MUF_Scheduler_Traits>::DSRT_Dispatcher_Auto_Ptr + tmp( Kokyu::DSRT_Dispatcher_Factory<MUF_Scheduler_Traits>:: + create_DSRT_dispatcher (config) ); + kokyu_dispatcher_ = tmp; + + CORBA::Object_var object = + orb->resolve_initial_references ("RTScheduler_Current" + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + this->current_ = + RTScheduling::Current::_narrow (object.in () ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + IOP::CodecFactory_var codec_factory; + CORBA::Object_var obj = + orb->resolve_initial_references ("CodecFactory" + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil(obj.in ())) + { + ACE_ERROR ((LM_ERROR, "Nil Codec factory\n")); + } + else + { + codec_factory = IOP::CodecFactory::_narrow (obj.in ()); + } + + IOP::Encoding encoding; + encoding.format = IOP::ENCODING_CDR_ENCAPS; + encoding.major_version = 1; + encoding.minor_version = 2; + + codec_ = codec_factory->create_codec (encoding); +} + +MUF_Scheduler::~MUF_Scheduler (void) +{ +} + +void +MUF_Scheduler::shutdown (void) +{ + kokyu_dispatcher_->shutdown (); + ACE_DEBUG ((LM_DEBUG, "kokyu DSRT dispatcher shutdown\n")); +} + +MUF_Scheduling::SchedulingParameterPolicy_ptr +MUF_Scheduler::create_scheduling_parameter (const MUF_Scheduling::SchedulingParameter & value ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + MUF_Scheduling::SchedulingParameterPolicy_ptr sched_param_policy; + ACE_NEW_THROW_EX (sched_param_policy, + MUF_Sched_Param_Policy, + CORBA::NO_MEMORY ( + CORBA::SystemException::_tao_minor_code ( + TAO_DEFAULT_MINOR_CODE, + ENOMEM), + CORBA::COMPLETED_NO)); + + sched_param_policy->value (value); + + return sched_param_policy; +} + + +void +MUF_Scheduler::begin_new_scheduling_segment (const RTScheduling::Current::IdType &guid, + const char *, + CORBA::Policy_ptr sched_policy, + CORBA::Policy_ptr + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE)) +{ +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, + "(%t|%T):MUF_Scheduler::begin_new_scheduling_segment enter\n")); +#endif + +#ifdef KOKYU_DSRT_LOGGING + int int_guid; + ACE_OS::memcpy (&int_guid, + guid.get_buffer (), + guid.length ()); + ACE_DEBUG ((LM_DEBUG, "(%t|%T): guid is %d\n", int_guid)); +#endif + + MUF_Scheduler_Traits::QoSDescriptor_t qos; + MUF_Scheduling::SchedulingParameterPolicy_var sched_param_policy = + MUF_Scheduling::SchedulingParameterPolicy::_narrow (sched_policy); + + MUF_Scheduling::SchedulingParameter_var sched_param = sched_param_policy->value (); + + qos.deadline_ = sched_param->deadline; + qos.exec_time_ = sched_param->estimated_initial_execution_time; + qos.criticality_ = sched_param->criticality; + + kokyu_dispatcher_->schedule (guid, qos); + +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, + "(%t|%T):MUF_Scheduler::begin_new_scheduling_segment exit\n")); +#endif +} + + +void +MUF_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, + RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE)) +{ + this->begin_new_scheduling_segment (guid, + name, + sched_param, + implicit_sched_param + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +} + +void +MUF_Scheduler::update_scheduling_segment (const RTScheduling::Current::IdType& guid, + const char* name, + CORBA::Policy_ptr sched_policy, + CORBA::Policy_ptr implicit_sched_param + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE)) +{ + ACE_UNUSED_ARG ((name)); + ACE_UNUSED_ARG ((implicit_sched_param)); + +#ifdef KOKYU_DSRT_LOGGING + int int_guid ; + ACE_OS::memcpy (&int_guid, + guid.get_buffer (), + guid.length ()); + ACE_DEBUG ((LM_DEBUG, "(%t|%T): update_sched_seg::guid is %d\n", int_guid)); +#endif + + MUF_Scheduling::SchedulingParameterPolicy_var sched_param_policy = + MUF_Scheduling::SchedulingParameterPolicy::_narrow (sched_policy); + + MUF_Scheduling::SchedulingParameter_var sched_param = sched_param_policy->value (); + MUF_Scheduler_Traits::QoSDescriptor_t qos; + + qos.deadline_ = sched_param->deadline; + qos.exec_time_ = sched_param->estimated_initial_execution_time; + qos.criticality_ = sched_param->criticality; + + kokyu_dispatcher_->update_schedule (guid, qos); +} + +void +MUF_Scheduler::end_scheduling_segment (const RTScheduling::Current::IdType &guid, + const char * + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ +#ifdef KOKYU_DSRT_LOGGING + int int_guid; + ACE_OS::memcpy (&int_guid, + guid.get_buffer (), + guid.length ()); + ACE_DEBUG ((LM_DEBUG, "(%t|%T) call to end_sched_segment for guid %d\n", int_guid)); +#endif + + kokyu_dispatcher_->cancel_schedule (guid); +} + +void +MUF_Scheduler::end_nested_scheduling_segment (const RTScheduling::Current::IdType &, + const char *, + CORBA::Policy_ptr + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ +} + + +void +MUF_Scheduler::send_request (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + Kokyu::Svc_Ctxt_DSRT_QoS sc_qos; + + CORBA::String_var operation = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, + "(%t|%T): send_request " + "from \"%s\"\n", + operation.in ())); +#endif + + // Make the context to send the context to the target + IOP::ServiceContext sc; + sc.context_id = Client_Interceptor::SchedulingInfo; + + CORBA::Policy_ptr sched_policy = + this->current_->scheduling_parameter(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + /* + int guid; + ACE_OS::memcpy (&guid, + this->current_->id ()->get_buffer (), + this->current_->id ()->length ()); + */ + + CORBA::Long criticality; + TimeBase::TimeT deadline,exec_time; + + if (CORBA::is_nil (sched_policy)) + { + //24 hrs from now - infinity + ACE_Time_Value deadline_tv = ACE_OS::gettimeofday () + ACE_Time_Value (24*60*60,0); + deadline = deadline_tv.sec () * 1000000 + deadline_tv.usec () * 10; //100s of nanoseconds for TimeBase::TimeT + exec_time = 0; + criticality = 0; + } + else + { + MUF_Scheduling::SchedulingParameterPolicy_var sched_param_policy = + MUF_Scheduling::SchedulingParameterPolicy::_narrow (sched_policy); + + MUF_Scheduling::SchedulingParameter_var sched_param = sched_param_policy->value (); + deadline = sched_param->deadline; + exec_time = sched_param->estimated_initial_execution_time; + criticality = sched_param->criticality; + +#ifdef KOKYU_DSRT_LOGGING + int int_guid; + ACE_OS::memcpy (&int_guid, + this->current_->id ()->get_buffer (), + this->current_->id ()->length ()); + ACE_DEBUG ((LM_DEBUG, + "(%t|%T): send_request guid = %d\n", + int_guid)); +#endif + + //Fill the guid in the SC Qos struct + sc_qos.guid.length (this->current_->id ()->length ()); + guid_copy (sc_qos.guid, *(this->current_->id ())); + sc_qos.deadline = deadline; + sc_qos.estimated_initial_execution_time = exec_time; + sc_qos.criticality = criticality; + CORBA::Any sc_qos_as_any; + sc_qos_as_any <<= sc_qos; + + sc.context_data = + ACE_reinterpret_cast(IOP::ServiceContext:: + _tao_seq_Octet_context_data &, + *codec_->encode (sc_qos_as_any)); + +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%t|%T): send_request : about to add sched SC\n"))); +#endif + + // Add this context to the service context list. + ri->add_request_service_context (sc, 0 ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + + +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, + ACE_LIB_TEXT ("(%t|%T): send_request : ") + ACE_LIB_TEXT ("about to call scheduler to inform block\n") + )); +#endif + + kokyu_dispatcher_->update_schedule (*(this->current_->id ()), + Kokyu::BLOCK); + +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, + ACE_LIB_TEXT ("(%t|%T): send_request interceptor done\n"))); +#endif +} + +void +MUF_Scheduler::receive_request (PortableInterceptor::ServerRequestInfo_ptr ri, + RTScheduling::Current::IdType_out guid_out, + CORBA::String_out /*name*/, + CORBA::Policy_out sched_param_out, + CORBA::Policy_out /*implicit_sched_param_out*/ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + Kokyu::Svc_Ctxt_DSRT_QoS* sc_qos_ptr; + +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, "(%t|%T):entered MUF_Scheduler::receive_request\n")); +#endif + + RTScheduling::Current::IdType guid; + + CORBA::String_var operation = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, + "(%t|%T): receive_request from " + "\"%s\"\n", + operation.in ())); +#endif + + // Ignore the "_is_a" operation since it may have been invoked + // locally on the server side as a side effect of another call, + // meaning that the client hasn't added the service context yet. + if (ACE_OS_String::strcmp ("_is_a", operation.in ()) == 0) + return; + + IOP::ServiceContext_var sc = + ri->get_request_service_context (Server_Interceptor::SchedulingInfo + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + CORBA::Long criticality; + TimeBase::TimeT deadline,exec_time; + + if (sc.ptr () == 0) + { + //24 hrs from now - infinity + ACE_Time_Value deadline_tv = ACE_OS::gettimeofday () + ACE_Time_Value (24*60*60,0); + deadline = deadline_tv.sec ()*1000000 + deadline_tv.usec ()*10; //100s of nanoseconds for TimeBase::TimeT + exec_time = 0; + criticality = 0; + } + else + { + CORBA::OctetSeq oc_seq = CORBA::OctetSeq (sc->context_data.length (), + sc->context_data.length (), + sc->context_data.get_buffer (), + 0); + CORBA::Any sc_qos_as_any; + sc_qos_as_any = *codec_->decode (oc_seq); + //Don't store in a _var, since >>= returns a pointer to an + //internal buffer and we are not supposed to free it. + sc_qos_as_any >>= sc_qos_ptr; + + deadline = sc_qos_ptr->deadline; + criticality = sc_qos_ptr->criticality; + exec_time = sc_qos_ptr->estimated_initial_execution_time; + + guid.length (sc_qos_ptr->guid.length ()); + guid_copy (guid, sc_qos_ptr->guid); + + ACE_NEW (guid_out.ptr (), + RTScheduling::Current::IdType); + guid_out.ptr ()->length (guid.length ()); + *(guid_out.ptr ()) = guid; + +#ifdef KOKYU_DSRT_LOGGING + int int_guid; + ACE_OS::memcpy (&int_guid, + guid.get_buffer (), + guid.length ()); + ACE_DEBUG ((LM_DEBUG, + "(%t|%T): Criticality = %d, guid = %d " + "in recvd service context\n", + criticality, + int_guid)); +#endif + MUF_Scheduling::SchedulingParameter sched_param; + sched_param.criticality = criticality; + sched_param.deadline = deadline; + sched_param_out = this->create_scheduling_parameter (sched_param); + } + + MUF_Scheduler_Traits::QoSDescriptor_t qos; + qos.criticality_ = criticality; + qos.deadline_ = deadline; + qos.exec_time_ = exec_time; + + this->kokyu_dispatcher_->schedule (guid, qos); + +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, "(%t|%T): receive_request interceptor done\n")); +#endif + +} + +void +MUF_Scheduler::send_poll (PortableInterceptor::ClientRequestInfo_ptr + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ +} + +void +MUF_Scheduler::send_reply (PortableInterceptor::ServerRequestInfo_ptr ri + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + + Kokyu::Svc_Ctxt_DSRT_QoS sc_qos; + + CORBA::String_var operation = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, + "(%t|%T): send_reply from \"%s\"\n", + ri->operation ())); +#endif + + // Make the context to send the context to the target + IOP::ServiceContext sc; + sc.context_id = Server_Interceptor::SchedulingInfo; + + + CORBA::Long criticality; + TimeBase::TimeT deadline,exec_time; + + CORBA::Policy_ptr sched_policy = + this->current_->scheduling_parameter(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (sched_policy)) + { +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, + "(%t|%T): sched_policy nil.\n ")); +#endif + //24 hrs from now - infinity + ACE_Time_Value deadline_tv = ACE_OS::gettimeofday () + ACE_Time_Value (24*60*60,0); + deadline = deadline_tv.sec ()*1000000 + deadline_tv.usec ()*10; //100s of nanoseconds for TimeBase::TimeT + exec_time = 0; + criticality = 0; + } + else + { +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, + "(%t|%T):sched_policy not nil. ", + "sched params set\n")); +#endif + MUF_Scheduling::SchedulingParameterPolicy_var sched_param_policy = + MUF_Scheduling::SchedulingParameterPolicy::_narrow (sched_policy); + MUF_Scheduling::SchedulingParameter_var sched_param = sched_param_policy->value (); + + + sc_qos.guid.length (this->current_->id ()->length ()); + guid_copy (sc_qos.guid, *(this->current_->id ())); + + deadline = sched_param->deadline; + exec_time = sched_param->estimated_initial_execution_time; + criticality = sched_param->criticality; + sc_qos.deadline = deadline; + sc_qos.estimated_initial_execution_time = exec_time; + sc_qos.criticality = criticality; + + CORBA::Any sc_qos_as_any; + sc_qos_as_any <<= sc_qos; + + sc.context_data = ACE_reinterpret_cast( + IOP::ServiceContext:: + _tao_seq_Octet_context_data &, + *codec_->encode (sc_qos_as_any)); + + // Add this context to the service context list. + ri->add_reply_service_context (sc, 1 ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, "(%t|%T):reply sc added\n")); +#endif + } + + kokyu_dispatcher_->update_schedule (*(this->current_->id ()), + Kokyu::BLOCK); + +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, "(%t|%T): send_reply interceptor done\n")); +#endif +} + +void +MUF_Scheduler::send_exception (PortableInterceptor::ServerRequestInfo_ptr ri + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + send_reply (ri ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +} + +void +MUF_Scheduler::send_other (PortableInterceptor::ServerRequestInfo_ptr ri + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + send_reply (ri ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +} + +void +MUF_Scheduler::receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + RTScheduling::Current::IdType guid; + + CORBA::String_var operation = ri->operation (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + CORBA::Object_var target = ri->target (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + ACE_CString opname = operation.in (); +#ifdef KOKYU_DSRT_LOGGING + ACE_DEBUG ((LM_DEBUG, + "(%t|%T):receive_reply from " + "\"%s\"\n", + opname.c_str ())); +#endif + + // Check that the reply service context was received as + // expected. + IOP::ServiceContext_var sc = + ri->get_reply_service_context (Client_Interceptor::SchedulingInfo + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + CORBA::Long criticality; + TimeBase::TimeT deadline,exec_time; + + if (sc.ptr () == 0) + { + ACE_DEBUG ((LM_DEBUG, "service context was not filled\n")); + //24 hrs from now - infinity + ACE_Time_Value deadline_tv = ACE_OS::gettimeofday () + ACE_Time_Value (24*60*60,0); + deadline = deadline_tv.sec ()*1000000 + deadline_tv.usec ()*10; //100s of nanoseconds for TimeBase::TimeT + exec_time = 0; + criticality = 0; + } + else + { + CORBA::OctetSeq oc_seq = CORBA::OctetSeq (sc->context_data.length (), + sc->context_data.length (), + sc->context_data.get_buffer (), + 0); + + //Don't store in a _var, since >>= returns a pointer to an internal buffer + //and we are not supposed to free it. + Kokyu::Svc_Ctxt_DSRT_QoS* sc_qos_ptr; + CORBA::Any sc_qos_as_any; + sc_qos_as_any = *codec_->decode (oc_seq); + sc_qos_as_any >>= sc_qos_ptr; + + deadline = sc_qos_ptr->deadline; + criticality = sc_qos_ptr->criticality; + exec_time = sc_qos_ptr->estimated_initial_execution_time; + + guid.length (sc_qos_ptr->guid.length ()); + guid_copy (guid, sc_qos_ptr->guid); + + ACE_DEBUG ((LM_DEBUG, + "(%t|%T): Criticality = %d in recvd service context\n", + criticality)); + } + + MUF_Scheduler_Traits::QoSDescriptor_t qos; + qos.deadline_ = qos.criticality_ = criticality; + qos.deadline_ = deadline; + qos.exec_time_ = exec_time; + this->kokyu_dispatcher_->schedule (guid, qos); +} + +void +MUF_Scheduler::receive_exception (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + receive_reply (ri ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +} + +void +MUF_Scheduler::receive_other (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)) +{ + receive_reply (ri ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +} + +void +MUF_Scheduler::cancel (const RTScheduling::Current::IdType & + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_THROW (CORBA::NO_IMPLEMENT ()); +} + +CORBA::PolicyList* +MUF_Scheduler::scheduling_policies (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +void +MUF_Scheduler::scheduling_policies (const CORBA::PolicyList & + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_THROW (CORBA::NO_IMPLEMENT ()); +} + +CORBA::PolicyList* +MUF_Scheduler::poa_policies (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +char * +MUF_Scheduler::scheduling_discipline_name (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +RTScheduling::ResourceManager_ptr +MUF_Scheduler::create_resource_manager (const char *, + CORBA::Policy_ptr + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +void +MUF_Scheduler::set_scheduling_parameter (PortableServer::Servant &, + const char *, + CORBA::Policy_ptr + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_THROW (CORBA::NO_IMPLEMENT ()); +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) +template class Kokyu::DSRT_Dispatcher_Factory<MUF_Scheduler_Traits>; +template class Kokyu::DSRT_Dispatcher<MUF_Scheduler_Traits>; +template class Kokyu::DSRT_Dispatcher_Impl<MUF_Scheduler_Traits>; +template class Kokyu::DSRT_Direct_Dispatcher_Impl<MUF_Scheduler_Traits>; +template class Kokyu::DSRT_CV_Dispatcher_Impl<MUF_Scheduler_Traits>; +template class Kokyu::DSRT_Dispatch_Item_var<MUF_Scheduler_Traits>; +template class Kokyu::Comparator_Adapter_Generator<MUF_Scheduler_Traits>; +template class Kokyu::Sched_Ready_Queue<MUF_Scheduler_Traits, Kokyu::Comparator_Adapter_Generator<MUF_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex>; + +template class ACE_Hash_Map_Manager_Ex<MUF_Scheduler_Traits::Guid_t, ACE_RB_Tree_Node<Kokyu::DSRT_Dispatch_Item_var<MUF_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<MUF_Scheduler_Traits> > *, Kokyu::Sched_Ready_Queue<MUF_Scheduler_Traits, Kokyu::Comparator_Adapter_Generator<MUF_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex>::Guid_Hash, ACE_Equal_To<MUF_Scheduler_Traits::Guid_t>, ACE_Null_Mutex>; + +template class ACE_RB_Tree<Kokyu::DSRT_Dispatch_Item_var<MUF_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<MUF_Scheduler_Traits>, Kokyu::Comparator_Adapter_Generator<MUF_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex>; + +template class ACE_RB_Tree_Iterator<Kokyu::DSRT_Dispatch_Item_var<MUF_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<MUF_Scheduler_Traits>, Kokyu::Comparator_Adapter_Generator<MUF_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex>; + +template class ACE_Hash_Map_Entry<MUF_Scheduler_Traits::Guid_t, ACE_RB_Tree_Node<Kokyu::DSRT_Dispatch_Item_var<MUF_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<MUF_Scheduler_Traits> > *>; + +template class ACE_RB_Tree_Node<Kokyu::DSRT_Dispatch_Item_var<MUF_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<MUF_Scheduler_Traits> >; + +template class Kokyu::MUF_Comparator<MUF_Scheduler_Traits::QoSDescriptor_t>; + +template class ACE_Hash_Map_Iterator_Base_Ex<MUF_Scheduler_Traits::Guid_t, ACE_RB_Tree_Node<Kokyu::DSRT_Dispatch_Item_var<MUF_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<MUF_Scheduler_Traits> > *, Kokyu::Sched_Ready_Queue<MUF_Scheduler_Traits, Kokyu::Comparator_Adapter_Generator<MUF_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex>::Guid_Hash, ACE_Equal_To<MUF_Scheduler_Traits::Guid_t>, ACE_Null_Mutex>; + +template class ACE_RB_Tree_Reverse_Iterator<Kokyu::DSRT_Dispatch_Item_var<MUF_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<MUF_Scheduler_Traits>, Kokyu::Comparator_Adapter_Generator<MUF_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex>; + +template class ACE_RB_Tree_Iterator_Base<Kokyu::DSRT_Dispatch_Item_var<MUF_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<MUF_Scheduler_Traits>, Kokyu::Comparator_Adapter_Generator<MUF_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex>; + +#elif defined(ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate Kokyu::DSRT_Dispatcher_Factory<MUF_Scheduler_Traits> +#pragma instantiate Kokyu::DSRT_Dispatcher<MUF_Scheduler_Traits> +#pragma instantiate Kokyu::DSRT_Dispatcher_Impl<MUF_Scheduler_Traits> +#pragma instantiate Kokyu::DSRT_Direct_Dispatcher_Impl<MUF_Scheduler_Traits> +#pragma instantiate Kokyu::DSRT_CV_Dispatcher_Impl<MUF_Scheduler_Traits> +#pragma instantiate Kokyu::DSRT_Dispatch_Item_var<MUF_Scheduler_Traits> +#pragma instantiate Kokyu::Comparator_Adapter_Generator<MUF_Scheduler_Traits> + +#pragma instantiate Kokyu::Sched_Ready_Queue<MUF_Scheduler_Traits, Kokyu::Comparator_Adapter_Generator<MUF_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex> + + +#pragma instantiate ACE_Hash_Map_Manager_Ex<MUF_Scheduler_Traits::Guid_t, ACE_RB_Tree_Node<Kokyu::DSRT_Dispatch_Item_var<MUF_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<MUF_Scheduler_Traits> > *, Kokyu::Sched_Ready_Queue<MUF_Scheduler_Traits, Kokyu::Comparator_Adapter_Generator<MUF_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex>::Guid_Hash, ACE_Equal_To<MUF_Scheduler_Traits::Guid_t>, ACE_Null_Mutex> + +#pragma instantiate ACE_RB_Tree<Kokyu::DSRT_Dispatch_Item_var<MUF_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<MUF_Scheduler_Traits>, Kokyu::Comparator_Adapter_Generator<MUF_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex> + +#pragma instantiate ACE_RB_Tree_Iterator<Kokyu::DSRT_Dispatch_Item_var<MUF_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<MUF_Scheduler_Traits>, Kokyu::Comparator_Adapter_Generator<MUF_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex> + +ACE_Hash_Map_Entry<MUF_Scheduler_Traits::Guid_t, ACE_RB_Tree_Node<Koky\ +u::DSRT_Dispatch_Item_var<MUF_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<\ +MUF_Scheduler_Traits> > + +#pragma instantiate ACE_Hash_Map_Entry<MUF_Scheduler_Traits::Guid_t, ACE_RB_Tree_Node<Kokyu::DSRT_Dispatch_Item_var<MUF_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<MUF_Scheduler_Traits> > *> + +#pragma instantiate ACE_RB_Tree_Node<Kokyu::DSRT_Dispatch_Item_var<MUF_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<MUF_Scheduler_Traits> > + +#pragma instantiate Kokyu::MUF_Comparator<MUF_Scheduler_Traits::QoSDescriptor_t> + +#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<MUF_Scheduler_Traits::Guid_t, ACE_RB_Tree_Node<Kokyu::DSRT_Dispatch_Item_var<MUF_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<MUF_Scheduler_Traits> > *, Kokyu::Sched_Ready_Queue<MUF_Scheduler_Traits, Kokyu::Comparator_Adapter_Generator<MUF_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex>::Guid_Hash, ACE_Equal_To<MUF_Scheduler_Traits::Guid_t>, ACE_Null_Mutex> + +#pragma instantiate ACE_RB_Tree_Reverse_Iterator<Kokyu::DSRT_Dispatch_Item_var<MUF_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<MUF_Scheduler_Traits>, Kokyu::Comparator_Adapter_Generator<MUF_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex> + +#pragma instantiate ACE_RB_Tree_Iterator_Base<Kokyu::DSRT_Dispatch_Item_var<MUF_Scheduler_Traits>, Kokyu::DSRT_Dispatch_Item_var<MUF_Scheduler_Traits>, Kokyu::Comparator_Adapter_Generator<MUF_Scheduler_Traits>::MoreEligible, ACE_Null_Mutex> + +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/examples/Kokyu_dsrt_schedulers/MUF_Scheduler.h b/TAO/examples/Kokyu_dsrt_schedulers/MUF_Scheduler.h new file mode 100644 index 00000000000..96875b1f7f3 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/MUF_Scheduler.h @@ -0,0 +1,214 @@ +//$Id$ + +#ifndef MUF_SCHEDULER_H +#define MUF_SCHEDULER_H + +#include "tao/RTScheduling/RTScheduler.h" +#include "MUF_SchedulingC.h" +#include "Kokyu_dsrt.h" +#include "Kokyu_dsrt_schedulers_export.h" + +struct MUF_Scheduler_Traits +{ + typedef RTScheduling::Current::IdType Guid_t; + + typedef TimeBase::TimeT Time_t; + class _Now + { + public: + Time_t operator () () + { + ACE_Time_Value time = ACE_OS::gettimeofday (); + return 10*time.usec () + 10000000*time.sec (); + } + }; + + struct _QoSDescriptor_t + { + typedef long Criticality_t; + + typedef TimeBase::TimeT Time_t; + typedef _Now Now; + + Criticality_t criticality_; + Time_t deadline_; + Time_t exec_time_; + }; + + typedef _QoSDescriptor_t QoSDescriptor_t; + + typedef Kokyu::MUF_Comparator<QoSDescriptor_t> QoSComparator_t; + + class _Guid_Hash + { + public: + u_long operator () (const Guid_t& id) + { + return ACE::hash_pjw ((const char *) id.get_buffer (), + id.length ()); + } + }; + typedef _Guid_Hash Guid_Hash; +}; + +class Kokyu_DSRT_Schedulers_Export MUF_Sched_Param_Policy: +public MUF_Scheduling::SchedulingParameterPolicy, + public TAO_Local_RefCounted_Object +{ + public: + + MUF_Scheduling::SchedulingParameter value (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void value (const MUF_Scheduling::SchedulingParameter & value + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + private: + MUF_Scheduling::SchedulingParameter value_; +}; + +class Kokyu_DSRT_Schedulers_Export MUF_Scheduler: +public MUF_Scheduling::Scheduler, +public TAO_Local_RefCounted_Object +{ + public: + + MUF_Scheduler (CORBA::ORB_ptr orb, + Kokyu::DSRT_Dispatcher_Impl_t, + int ace_sched_policy, + int ace_sched_scope); + + ~MUF_Scheduler (void); + + + virtual MUF_Scheduling::SchedulingParameterPolicy_ptr + create_scheduling_parameter (const MUF_Scheduling::SchedulingParameter & value + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void shutdown (void); + + virtual void begin_new_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, + 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, + RTScheduling::Current::UNSUPPORTED_SCHEDULING_DISCIPLINE)); + + virtual void update_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, + 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 + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void send_request (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)); + + virtual void send_poll (PortableInterceptor::ClientRequestInfo_ptr ri + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::ForwardRequest)); + + virtual void receive_request (PortableInterceptor::ServerRequestInfo_ptr ri, + RTScheduling::Current::IdType_out guid, + CORBA::String_out name, + CORBA::Policy_out sched_param, + CORBA::Policy_out implicit_sched_param + 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)); + + virtual void send_exception (PortableInterceptor::ServerRequestInfo_ptr ri + 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 + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + private: + CORBA::ORB_var orb_; + IOP::Codec_var codec_; + RTScheduling::Current_var current_; + Kokyu::DSRT_Dispatcher_Factory<MUF_Scheduler_Traits>::DSRT_Dispatcher_Auto_Ptr + kokyu_dispatcher_; + Kokyu::DSRT_Dispatcher_Impl_t disp_impl_type_; + int ace_sched_policy_; + int ace_sched_scope_; +}; + +#endif //MUF_SCHEDULER_H diff --git a/TAO/examples/Kokyu_dsrt_schedulers/MUF_Scheduling.pidl b/TAO/examples/Kokyu_dsrt_schedulers/MUF_Scheduling.pidl new file mode 100644 index 00000000000..2b01be5f76e --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/MUF_Scheduling.pidl @@ -0,0 +1,63 @@ +//$Id$ + +/** + * @file MUF_Scheduling.pidl + * + * $Id$ + * + * @brief Pre-compiled IDL source to help with the service context + * propagation of dynamic scheduling parameters using Kokyu + * + * This file was used to generate the code in MUF_SchedulingC.{h,i,cpp}. + * The steps to regenerate the code are as follows: + * + * 1. Run the tao_idl compiler on the pidl file. The command used for + * this is: + * + * tao_idl -I $TAO_ROOT -Ge 1 + * -Wb,export_macro=Kokyu_DSRT_Schedulers_Export + * -Wb,export_include=Kokyu_dsrt_schedulers_export.h + * + * + * 2. Then apply the patches in MUF_SchedulingC.h.diff to the generated code. + * The patch will replace the inclusion of RTCORBAC.h and RTSchedulerC.h + * with RTCORBA.h and RTScheduler.h respectively. + * + * Apply patches using the following command: + * + * patch < MUF_SchedulingC.h.diff + * + * Note: The diff was generated in the following way: + * + * Run the idl compiler as in step 1. + * cp MUF_SchedulingC.h MUF_SchedulingC.h.orig + * Modify MUF_SchedulingC.h with changes described in step 2. + * diff -wBbu MUF_SchedulingC.h.orig MUF_SchedulingC.h > MUF_SchedulingC.h.diff + * + */ + +#include <tao/RTScheduling/RTScheduler.pidl> +#include <tao/RTCORBA/RTCORBA.pidl> + +module MUF_Scheduling +{ + struct SchedulingParameter + { + TimeBase::TimeT deadline; + TimeBase::TimeT estimated_initial_execution_time; + long criticality; + }; + + local interface SchedulingParameterPolicy + : CORBA::Policy + { + attribute SchedulingParameter value; + }; + + local interface Scheduler : RTScheduling::Scheduler + { + SchedulingParameterPolicy + create_scheduling_parameter + (in SchedulingParameter value); + }; +}; diff --git a/TAO/examples/Kokyu_dsrt_schedulers/MUF_SchedulingC.cpp b/TAO/examples/Kokyu_dsrt_schedulers/MUF_SchedulingC.cpp new file mode 100644 index 00000000000..79e9debaaa5 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/MUF_SchedulingC.cpp @@ -0,0 +1,835 @@ +// -*- C++ -*- +// +// $Id$ + +// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** +// TAO and the TAO IDL Compiler have been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// and +// Distributed Object Computing Laboratory +// University of California at Irvine +// Irvine, CA +// USA +// http://doc.ece.uci.edu/ +// and +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +// TAO_IDL - Generated from +// be/be_codegen.cpp:351 + + +#include "MUF_SchedulingC.h" +#include "tao/Stub.h" +#include "tao/ORB_Core.h" +#include "tao/Invocation.h" +#include "tao/PortableInterceptor.h" + +#if TAO_HAS_INTERCEPTORS == 1 +#include "tao/RequestInfo_Util.h" +#include "tao/ClientRequestInfo_i.h" +#include "tao/ClientInterceptorAdapter.h" +#endif /* TAO_HAS_INTERCEPTORS == 1 */ + + +#if defined (__BORLANDC__) +#pragma option -w-rvl -w-rch -w-ccc -w-aus -w-sig +#endif /* __BORLANDC__ */ + +#if !defined (__ACE_INLINE__) +#include "MUF_SchedulingC.i" +#endif /* !defined INLINE */ + +// TAO_IDL - Generated from +// be/be_visitor_typecode/typecode_defn.cpp:284 + +static const CORBA::Long _oc_MUF_Scheduling_SchedulingParameter[] = +{ + TAO_ENCAP_BYTE_ORDER, // byte order + 43, + ACE_NTOHL (0x49444c3a), + ACE_NTOHL (0x4d55465f), + ACE_NTOHL (0x53636865), + ACE_NTOHL (0x64756c69), + ACE_NTOHL (0x6e672f53), + ACE_NTOHL (0x63686564), + ACE_NTOHL (0x756c696e), + ACE_NTOHL (0x67506172), + ACE_NTOHL (0x616d6574), + ACE_NTOHL (0x65723a31), + ACE_NTOHL (0x2e300000), // repository ID = IDL:MUF_Scheduling/SchedulingParameter:1.0 + 20, + ACE_NTOHL (0x53636865), + ACE_NTOHL (0x64756c69), + ACE_NTOHL (0x6e675061), + ACE_NTOHL (0x72616d65), + ACE_NTOHL (0x74657200), // name = SchedulingParameter + 3, // member count + 9, + ACE_NTOHL (0x64656164), + ACE_NTOHL (0x6c696e65), + ACE_NTOHL (0x0), // name = deadline + CORBA::tk_alias, // typecode kind for typedefs + 56, // encapsulation length + TAO_ENCAP_BYTE_ORDER, // byte order + 31, + ACE_NTOHL (0x49444c3a), + ACE_NTOHL (0x6f6d672e), + ACE_NTOHL (0x6f72672f), + ACE_NTOHL (0x54696d65), + ACE_NTOHL (0x42617365), + ACE_NTOHL (0x2f54696d), + ACE_NTOHL (0x65543a31), + ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/TimeBase/TimeT:1.0 + 6, + ACE_NTOHL (0x54696d65), + ACE_NTOHL (0x54000000), // name = TimeT + CORBA::tk_ulonglong, + + + 33, + ACE_NTOHL (0x65737469), + ACE_NTOHL (0x6d617465), + ACE_NTOHL (0x645f696e), + ACE_NTOHL (0x69746961), + ACE_NTOHL (0x6c5f6578), + ACE_NTOHL (0x65637574), + ACE_NTOHL (0x696f6e5f), + ACE_NTOHL (0x74696d65), + ACE_NTOHL (0x0), // name = estimated_initial_execution_time + CORBA::tk_alias, // typecode kind for typedefs + 56, // encapsulation length + TAO_ENCAP_BYTE_ORDER, // byte order + 31, + ACE_NTOHL (0x49444c3a), + ACE_NTOHL (0x6f6d672e), + ACE_NTOHL (0x6f72672f), + ACE_NTOHL (0x54696d65), + ACE_NTOHL (0x42617365), + ACE_NTOHL (0x2f54696d), + ACE_NTOHL (0x65543a31), + ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/TimeBase/TimeT:1.0 + 6, + ACE_NTOHL (0x54696d65), + ACE_NTOHL (0x54000000), // name = TimeT + CORBA::tk_ulonglong, + + + 12, + ACE_NTOHL (0x63726974), + ACE_NTOHL (0x6963616c), + ACE_NTOHL (0x69747900), // name = criticality + CORBA::tk_long, + +}; + +static CORBA::TypeCode _tc_TAO_tc_MUF_Scheduling_SchedulingParameter ( + CORBA::tk_struct, + sizeof (_oc_MUF_Scheduling_SchedulingParameter), + (char *) &_oc_MUF_Scheduling_SchedulingParameter, + 0, + sizeof (MUF_Scheduling::SchedulingParameter) + ); + +TAO_NAMESPACE_TYPE (CORBA::TypeCode_ptr) +TAO_NAMESPACE_BEGIN (MUF_Scheduling) +TAO_NAMESPACE_DEFINE ( + ::CORBA::TypeCode_ptr, + _tc_SchedulingParameter, + &_tc_TAO_tc_MUF_Scheduling_SchedulingParameter + ) +TAO_NAMESPACE_END + +// TAO_IDL - Generated from +// be/be_visitor_structure/structure_cs.cpp:66 + +void MUF_Scheduling::SchedulingParameter::_tao_any_destructor (void *_tao_void_pointer) +{ + SchedulingParameter *tmp = ACE_static_cast (SchedulingParameter*, _tao_void_pointer); + delete tmp; +} + +// TAO_IDL - Generated from +// be/be_type.cpp:297 + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +template class + TAO_Fixed_Var_T< + MUF_Scheduling::SchedulingParameter + >; + +template class TAO_Var_Base_T< + MUF_Scheduling::SchedulingParameter + >; + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +# pragma instantiate \ + TAO_Fixed_Var_T< \ + MUF_Scheduling::SchedulingParameter \ + > + +#pragma instantiate TAO_Var_Base_T< + MUF_Scheduling::SchedulingParameter + > + +#endif /* !ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + +// TAO_IDL - Generated from +// be/be_visitor_interface/interface_cs.cpp:63 + +int MUF_Scheduling::SchedulingParameterPolicy::_tao_class_id = 0; + +MUF_Scheduling::SchedulingParameterPolicy_ptr +MUF_Scheduling::tao_SchedulingParameterPolicy_life::tao_duplicate ( + SchedulingParameterPolicy_ptr p + ) +{ + return SchedulingParameterPolicy::_duplicate (p); +} + +void +MUF_Scheduling::tao_SchedulingParameterPolicy_life::tao_release ( + SchedulingParameterPolicy_ptr p + ) +{ + CORBA::release (p); +} + +MUF_Scheduling::SchedulingParameterPolicy_ptr +MUF_Scheduling::tao_SchedulingParameterPolicy_life::tao_nil ( + void + ) +{ + return SchedulingParameterPolicy::_nil (); +} + +CORBA::Boolean +MUF_Scheduling::tao_SchedulingParameterPolicy_life::tao_marshal ( + SchedulingParameterPolicy_ptr p, + TAO_OutputCDR &cdr + ) +{ + return p->marshal (cdr); +} + +MUF_Scheduling::SchedulingParameterPolicy_ptr +MUF_Scheduling::tao_SchedulingParameterPolicy_cast::tao_narrow ( + CORBA::Object *p + ACE_ENV_ARG_DECL + ) +{ + return SchedulingParameterPolicy::_narrow (p ACE_ENV_ARG_PARAMETER); +} + +CORBA::Object * +MUF_Scheduling::tao_SchedulingParameterPolicy_cast::tao_upcast ( + void *src + ) +{ + SchedulingParameterPolicy **tmp = + ACE_static_cast (SchedulingParameterPolicy **, src); + return *tmp; +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + template class + TAO_Objref_Var_T< + MUF_Scheduling::SchedulingParameterPolicy, + MUF_Scheduling::tao_SchedulingParameterPolicy_life + >; + template class + TAO_Objref_Out_T< + MUF_Scheduling::SchedulingParameterPolicy, + MUF_Scheduling::tao_SchedulingParameterPolicy_life + >; +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +# pragma instantiate \ + TAO_Objref_Var_T< \ + MUF_Scheduling::SchedulingParameterPolicy, \ + MUF_Scheduling::tao_SchedulingParameterPolicy_life \ + > +# pragma instantiate \ + TAO_Objref_Out_T< \ + MUF_Scheduling::SchedulingParameterPolicy, \ + MUF_Scheduling::tao_SchedulingParameterPolicy_life \ + > +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + +// TAO_IDL - Generated from +// be/be_visitor_interface/interface_cs.cpp:245 + +MUF_Scheduling::SchedulingParameterPolicy::SchedulingParameterPolicy (void) +{} + +MUF_Scheduling::SchedulingParameterPolicy::~SchedulingParameterPolicy (void) +{} + +void +MUF_Scheduling::SchedulingParameterPolicy::_tao_any_destructor (void *_tao_void_pointer) +{ + SchedulingParameterPolicy *tmp = ACE_static_cast (SchedulingParameterPolicy *, _tao_void_pointer); + CORBA::release (tmp); +} + +MUF_Scheduling::SchedulingParameterPolicy_ptr +MUF_Scheduling::SchedulingParameterPolicy::_narrow ( + CORBA::Object_ptr obj + ACE_ENV_ARG_DECL + ) +{ + return SchedulingParameterPolicy::_unchecked_narrow (obj ACE_ENV_ARG_PARAMETER); +} + +MUF_Scheduling::SchedulingParameterPolicy_ptr +MUF_Scheduling::SchedulingParameterPolicy::_unchecked_narrow ( + CORBA::Object_ptr obj + ACE_ENV_ARG_DECL_NOT_USED + ) +{ + if (CORBA::is_nil (obj)) + { + return SchedulingParameterPolicy::_nil (); + } + + return + ACE_reinterpret_cast ( + SchedulingParameterPolicy_ptr, + obj->_tao_QueryInterface ( + ACE_reinterpret_cast ( + ptrdiff_t, + &SchedulingParameterPolicy::_tao_class_id + ) + ) + ); +} + +MUF_Scheduling::SchedulingParameterPolicy_ptr +MUF_Scheduling::SchedulingParameterPolicy::_duplicate (SchedulingParameterPolicy_ptr obj) +{ + if (! CORBA::is_nil (obj)) + { + obj->_add_ref (); + } + + return obj; +} + +void *MUF_Scheduling::SchedulingParameterPolicy::_tao_QueryInterface (ptrdiff_t type) +{ + void *retv = 0; + + if (type == ACE_reinterpret_cast ( + ptrdiff_t, + &::CORBA::Policy::_tao_class_id) + ) + { + retv = + ACE_reinterpret_cast ( + void *, + ACE_static_cast ( + CORBA::Policy_ptr, + this + ) + ); + } + else if (type == ACE_reinterpret_cast ( + ptrdiff_t, + &ACE_NESTED_CLASS (::MUF_Scheduling, SchedulingParameterPolicy)::_tao_class_id) + ) + { + retv = ACE_reinterpret_cast (void*, this); + } + else if (type == ACE_reinterpret_cast ( + ptrdiff_t, + &CORBA::Object::_tao_class_id) + ) + { + retv = + ACE_reinterpret_cast ( + void *, + ACE_static_cast (CORBA::Object_ptr, this) + ); + } + + if (retv != 0) + { + this->_add_ref (); + } + + return retv; +} + +const char* MUF_Scheduling::SchedulingParameterPolicy::_interface_repository_id (void) const +{ + return "IDL:MUF_Scheduling/SchedulingParameterPolicy:1.0"; +} + +CORBA::Boolean +MUF_Scheduling::SchedulingParameterPolicy::marshal (TAO_OutputCDR &) +{ + return 0; +} + +// TAO_IDL - Generated from +// be/be_visitor_typecode/typecode_defn.cpp:284 + +static const CORBA::Long _oc_MUF_Scheduling_SchedulingParameterPolicy[] = +{ + TAO_ENCAP_BYTE_ORDER, // byte order + 49, + ACE_NTOHL (0x49444c3a), + ACE_NTOHL (0x4d55465f), + ACE_NTOHL (0x53636865), + ACE_NTOHL (0x64756c69), + ACE_NTOHL (0x6e672f53), + ACE_NTOHL (0x63686564), + ACE_NTOHL (0x756c696e), + ACE_NTOHL (0x67506172), + ACE_NTOHL (0x616d6574), + ACE_NTOHL (0x6572506f), + ACE_NTOHL (0x6c696379), + ACE_NTOHL (0x3a312e30), + ACE_NTOHL (0x0), // repository ID = IDL:MUF_Scheduling/SchedulingParameterPolicy:1.0 + 26, + ACE_NTOHL (0x53636865), + ACE_NTOHL (0x64756c69), + ACE_NTOHL (0x6e675061), + ACE_NTOHL (0x72616d65), + ACE_NTOHL (0x74657250), + ACE_NTOHL (0x6f6c6963), + ACE_NTOHL (0x79000000), // name = SchedulingParameterPolicy + }; + +static CORBA::TypeCode _tc_TAO_tc_MUF_Scheduling_SchedulingParameterPolicy ( + CORBA::tk_objref, + sizeof (_oc_MUF_Scheduling_SchedulingParameterPolicy), + (char *) &_oc_MUF_Scheduling_SchedulingParameterPolicy, + 0, + sizeof (MUF_Scheduling::SchedulingParameterPolicy) + ); + +TAO_NAMESPACE_TYPE (CORBA::TypeCode_ptr) +TAO_NAMESPACE_BEGIN (MUF_Scheduling) +TAO_NAMESPACE_DEFINE ( + ::CORBA::TypeCode_ptr, + _tc_SchedulingParameterPolicy, + &_tc_TAO_tc_MUF_Scheduling_SchedulingParameterPolicy + ) +TAO_NAMESPACE_END + +// TAO_IDL - Generated from +// be/be_visitor_interface/interface_cs.cpp:63 + +int MUF_Scheduling::Scheduler::_tao_class_id = 0; + +MUF_Scheduling::Scheduler_ptr +MUF_Scheduling::tao_Scheduler_life::tao_duplicate ( + Scheduler_ptr p + ) +{ + return Scheduler::_duplicate (p); +} + +void +MUF_Scheduling::tao_Scheduler_life::tao_release ( + Scheduler_ptr p + ) +{ + CORBA::release (p); +} + +MUF_Scheduling::Scheduler_ptr +MUF_Scheduling::tao_Scheduler_life::tao_nil ( + void + ) +{ + return Scheduler::_nil (); +} + +CORBA::Boolean +MUF_Scheduling::tao_Scheduler_life::tao_marshal ( + Scheduler_ptr p, + TAO_OutputCDR &cdr + ) +{ + return p->marshal (cdr); +} + +MUF_Scheduling::Scheduler_ptr +MUF_Scheduling::tao_Scheduler_cast::tao_narrow ( + CORBA::Object *p + ACE_ENV_ARG_DECL + ) +{ + return Scheduler::_narrow (p ACE_ENV_ARG_PARAMETER); +} + +CORBA::Object * +MUF_Scheduling::tao_Scheduler_cast::tao_upcast ( + void *src + ) +{ + Scheduler **tmp = + ACE_static_cast (Scheduler **, src); + return *tmp; +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + template class + TAO_Objref_Var_T< + MUF_Scheduling::Scheduler, + MUF_Scheduling::tao_Scheduler_life + >; + template class + TAO_Objref_Out_T< + MUF_Scheduling::Scheduler, + MUF_Scheduling::tao_Scheduler_life + >; +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +# pragma instantiate \ + TAO_Objref_Var_T< \ + MUF_Scheduling::Scheduler, \ + MUF_Scheduling::tao_Scheduler_life \ + > +# pragma instantiate \ + TAO_Objref_Out_T< \ + MUF_Scheduling::Scheduler, \ + MUF_Scheduling::tao_Scheduler_life \ + > +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + +// TAO_IDL - Generated from +// be/be_visitor_interface/interface_cs.cpp:245 + +MUF_Scheduling::Scheduler::Scheduler (void) +{} + +MUF_Scheduling::Scheduler::~Scheduler (void) +{} + +void +MUF_Scheduling::Scheduler::_tao_any_destructor (void *_tao_void_pointer) +{ + Scheduler *tmp = ACE_static_cast (Scheduler *, _tao_void_pointer); + CORBA::release (tmp); +} + +MUF_Scheduling::Scheduler_ptr +MUF_Scheduling::Scheduler::_narrow ( + CORBA::Object_ptr obj + ACE_ENV_ARG_DECL + ) +{ + return Scheduler::_unchecked_narrow (obj ACE_ENV_ARG_PARAMETER); +} + +MUF_Scheduling::Scheduler_ptr +MUF_Scheduling::Scheduler::_unchecked_narrow ( + CORBA::Object_ptr obj + ACE_ENV_ARG_DECL_NOT_USED + ) +{ + if (CORBA::is_nil (obj)) + { + return Scheduler::_nil (); + } + + return + ACE_reinterpret_cast ( + Scheduler_ptr, + obj->_tao_QueryInterface ( + ACE_reinterpret_cast ( + ptrdiff_t, + &Scheduler::_tao_class_id + ) + ) + ); +} + +MUF_Scheduling::Scheduler_ptr +MUF_Scheduling::Scheduler::_duplicate (Scheduler_ptr obj) +{ + if (! CORBA::is_nil (obj)) + { + obj->_add_ref (); + } + + return obj; +} + +void *MUF_Scheduling::Scheduler::_tao_QueryInterface (ptrdiff_t type) +{ + void *retv = 0; + + if (type == ACE_reinterpret_cast ( + ptrdiff_t, + &::RTScheduling::Scheduler::_tao_class_id) + ) + { + retv = + ACE_reinterpret_cast ( + void *, + ACE_static_cast ( + RTScheduling::Scheduler_ptr, + this + ) + ); + } + else if (type == ACE_reinterpret_cast ( + ptrdiff_t, + &ACE_NESTED_CLASS (::MUF_Scheduling, Scheduler)::_tao_class_id) + ) + { + retv = ACE_reinterpret_cast (void*, this); + } + else if (type == ACE_reinterpret_cast ( + ptrdiff_t, + &CORBA::Object::_tao_class_id) + ) + { + retv = + ACE_reinterpret_cast ( + void *, + ACE_static_cast (CORBA::Object_ptr, this) + ); + } + + if (retv != 0) + { + this->_add_ref (); + } + + return retv; +} + +const char* MUF_Scheduling::Scheduler::_interface_repository_id (void) const +{ + return "IDL:MUF_Scheduling/Scheduler:1.0"; +} + +CORBA::Boolean +MUF_Scheduling::Scheduler::marshal (TAO_OutputCDR &) +{ + return 0; +} + +// TAO_IDL - Generated from +// be/be_visitor_typecode/typecode_defn.cpp:284 + +static const CORBA::Long _oc_MUF_Scheduling_Scheduler[] = +{ + TAO_ENCAP_BYTE_ORDER, // byte order + 33, + ACE_NTOHL (0x49444c3a), + ACE_NTOHL (0x4d55465f), + ACE_NTOHL (0x53636865), + ACE_NTOHL (0x64756c69), + ACE_NTOHL (0x6e672f53), + ACE_NTOHL (0x63686564), + ACE_NTOHL (0x756c6572), + ACE_NTOHL (0x3a312e30), + ACE_NTOHL (0x0), // repository ID = IDL:MUF_Scheduling/Scheduler:1.0 + 10, + ACE_NTOHL (0x53636865), + ACE_NTOHL (0x64756c65), + ACE_NTOHL (0x72000000), // name = Scheduler + }; + +static CORBA::TypeCode _tc_TAO_tc_MUF_Scheduling_Scheduler ( + CORBA::tk_objref, + sizeof (_oc_MUF_Scheduling_Scheduler), + (char *) &_oc_MUF_Scheduling_Scheduler, + 0, + sizeof (MUF_Scheduling::Scheduler) + ); + +TAO_NAMESPACE_TYPE (CORBA::TypeCode_ptr) +TAO_NAMESPACE_BEGIN (MUF_Scheduling) +TAO_NAMESPACE_DEFINE ( + ::CORBA::TypeCode_ptr, + _tc_Scheduler, + &_tc_TAO_tc_MUF_Scheduling_Scheduler + ) +TAO_NAMESPACE_END + +// TAO_IDL - Generated from +// be/be_visitor_structure/any_op_cs.cpp:54 + +// Copying insertion. +void operator<<= ( + CORBA::Any &_tao_any, + const MUF_Scheduling::SchedulingParameter &_tao_elem + ) +{ + TAO::Any_Dual_Impl_T<MUF_Scheduling::SchedulingParameter>::insert_copy ( + _tao_any, + MUF_Scheduling::SchedulingParameter::_tao_any_destructor, + MUF_Scheduling::_tc_SchedulingParameter, + _tao_elem + ); +} + +// Non-copying insertion. +void operator<<= ( + CORBA::Any &_tao_any, + MUF_Scheduling::SchedulingParameter *_tao_elem + ) +{ + TAO::Any_Dual_Impl_T<MUF_Scheduling::SchedulingParameter>::insert ( + _tao_any, + MUF_Scheduling::SchedulingParameter::_tao_any_destructor, + MUF_Scheduling::_tc_SchedulingParameter, + _tao_elem + ); +} + +// Extraction to non-const pointer (deprecated). +CORBA::Boolean operator>>= ( + const CORBA::Any &_tao_any, + MUF_Scheduling::SchedulingParameter *&_tao_elem + ) +{ + return _tao_any >>= ACE_const_cast ( + const MUF_Scheduling::SchedulingParameter *&, + _tao_elem + ); +} + +// Extraction to const pointer. +CORBA::Boolean operator>>= ( + const CORBA::Any &_tao_any, + const MUF_Scheduling::SchedulingParameter *&_tao_elem + ) +{ + return + TAO::Any_Dual_Impl_T<MUF_Scheduling::SchedulingParameter>::extract ( + _tao_any, + MUF_Scheduling::SchedulingParameter::_tao_any_destructor, + MUF_Scheduling::_tc_SchedulingParameter, + _tao_elem + ); +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) || \ + defined (ACE_HAS_GNU_REPO) + template class TAO::Any_Dual_Impl_T<MUF_Scheduling::SchedulingParameter>; +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +# pragma instantiate TAO::Any_Dual_Impl_T<MUF_Scheduling::SchedulingParameter> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + +// TAO_IDL - Generated from +// be/be_visitor_interface/any_op_cs.cpp:50 + +// Copying insertion. +void +operator<<= ( + CORBA::Any &_tao_any, + MUF_Scheduling::SchedulingParameterPolicy_ptr _tao_elem + ) +{ + MUF_Scheduling::SchedulingParameterPolicy_ptr _tao_objptr = + MUF_Scheduling::SchedulingParameterPolicy::_duplicate (_tao_elem); + _tao_any <<= &_tao_objptr; +} + +// Non-copying insertion. +void +operator<<= ( + CORBA::Any &_tao_any, + MUF_Scheduling::SchedulingParameterPolicy_ptr *_tao_elem + ) +{ + TAO::Any_Impl_T<MUF_Scheduling::SchedulingParameterPolicy>::insert ( + _tao_any, + MUF_Scheduling::SchedulingParameterPolicy::_tao_any_destructor, + MUF_Scheduling::_tc_SchedulingParameterPolicy, + *_tao_elem + ); +} + +CORBA::Boolean +operator>>= ( + const CORBA::Any &_tao_any, + MUF_Scheduling::SchedulingParameterPolicy_ptr &_tao_elem + ) +{ + return + TAO::Any_Impl_T<MUF_Scheduling::SchedulingParameterPolicy>::extract ( + _tao_any, + MUF_Scheduling::SchedulingParameterPolicy::_tao_any_destructor, + MUF_Scheduling::_tc_SchedulingParameterPolicy, + _tao_elem + ); +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) || \ + defined (ACE_HAS_GNU_REPO) + template class TAO::Any_Impl_T<MUF_Scheduling::SchedulingParameterPolicy>; +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +# pragma instantiate TAO::Any_Impl_T<MUF_Scheduling::SchedulingParameterPolicy> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + +// TAO_IDL - Generated from +// be/be_visitor_interface/any_op_cs.cpp:50 + +// Copying insertion. +void +operator<<= ( + CORBA::Any &_tao_any, + MUF_Scheduling::Scheduler_ptr _tao_elem + ) +{ + MUF_Scheduling::Scheduler_ptr _tao_objptr = + MUF_Scheduling::Scheduler::_duplicate (_tao_elem); + _tao_any <<= &_tao_objptr; +} + +// Non-copying insertion. +void +operator<<= ( + CORBA::Any &_tao_any, + MUF_Scheduling::Scheduler_ptr *_tao_elem + ) +{ + TAO::Any_Impl_T<MUF_Scheduling::Scheduler>::insert ( + _tao_any, + MUF_Scheduling::Scheduler::_tao_any_destructor, + MUF_Scheduling::_tc_Scheduler, + *_tao_elem + ); +} + +CORBA::Boolean +operator>>= ( + const CORBA::Any &_tao_any, + MUF_Scheduling::Scheduler_ptr &_tao_elem + ) +{ + return + TAO::Any_Impl_T<MUF_Scheduling::Scheduler>::extract ( + _tao_any, + MUF_Scheduling::Scheduler::_tao_any_destructor, + MUF_Scheduling::_tc_Scheduler, + _tao_elem + ); +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) || \ + defined (ACE_HAS_GNU_REPO) + template class TAO::Any_Impl_T<MUF_Scheduling::Scheduler>; +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +# pragma instantiate TAO::Any_Impl_T<MUF_Scheduling::Scheduler> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + diff --git a/TAO/examples/Kokyu_dsrt_schedulers/MUF_SchedulingC.h b/TAO/examples/Kokyu_dsrt_schedulers/MUF_SchedulingC.h new file mode 100644 index 00000000000..a2f53d6a243 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/MUF_SchedulingC.h @@ -0,0 +1,409 @@ +// -*- C++ -*- +// +// $Id$ + +// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** +// TAO and the TAO IDL Compiler have been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// and +// Distributed Object Computing Laboratory +// University of California at Irvine +// Irvine, CA +// USA +// http://doc.ece.uci.edu/ +// and +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +// TAO_IDL - Generated from +// be/be_codegen.cpp:151 + +#ifndef _TAO_IDL_MUF_SCHEDULINGC_H_ +#define _TAO_IDL_MUF_SCHEDULINGC_H_ + + +#include "tao/corba.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + + +#include "Kokyu_dsrt_schedulers_export.h" + +#include "tao/RTScheduling/RTScheduler.h" +#include "tao/RTCORBA/RTCORBA.h" + +#if defined (TAO_EXPORT_MACRO) +#undef TAO_EXPORT_MACRO +#endif +#define TAO_EXPORT_MACRO Kokyu_DSRT_Schedulers_Export + +#if defined (TAO_EXPORT_NESTED_CLASSES) +# if defined (TAO_EXPORT_NESTED_MACRO) +# undef TAO_EXPORT_NESTED_MACRO +# endif /* defined (TAO_EXPORT_NESTED_MACRO) */ +# define TAO_EXPORT_NESTED_MACRO Kokyu_DSRT_Schedulers_Export +#endif /* TAO_EXPORT_NESTED_CLASSES */ + +#if defined(_MSC_VER) +#if (_MSC_VER >= 1200) +#pragma warning(push) +#endif /* _MSC_VER >= 1200 */ +#pragma warning(disable:4250) +#endif /* _MSC_VER */ + +#if defined (__BORLANDC__) +#pragma option push -w-rvl -w-rch -w-ccc -w-inl +#endif /* __BORLANDC__ */ + +// TAO_IDL - Generated from +// be/be_visitor_module/module_ch.cpp:48 + +TAO_NAMESPACE MUF_Scheduling +{ + + // TAO_IDL - Generated from + // be/be_type.cpp:254 + + struct SchedulingParameter; + + typedef + TAO_Fixed_Var_T< + SchedulingParameter + > + SchedulingParameter_var; + + typedef + SchedulingParameter & + SchedulingParameter_out; + + // TAO_IDL - Generated from + // be/be_visitor_structure/structure_ch.cpp:52 + + struct Kokyu_DSRT_Schedulers_Export SchedulingParameter + { + typedef SchedulingParameter_var _var_type; + + static void _tao_any_destructor (void *); + TimeBase::TimeT deadline; + TimeBase::TimeT estimated_initial_execution_time; + CORBA::Long criticality; + }; + + // TAO_IDL - Generated from + // be/be_visitor_typecode/typecode_decl.cpp:44 + + TAO_NAMESPACE_STORAGE_CLASS ::CORBA::TypeCode_ptr _tc_SchedulingParameter; + + // TAO_IDL - Generated from + // be/be_interface.cpp:584 + +#if !defined (_MUF_SCHEDULING_SCHEDULINGPARAMETERPOLICY__ODDS_N_ENDS_CH_) +#define _MUF_SCHEDULING_SCHEDULINGPARAMETERPOLICY__ODDS_N_ENDS_CH_ + + class SchedulingParameterPolicy; + typedef SchedulingParameterPolicy *SchedulingParameterPolicy_ptr; + struct tao_SchedulingParameterPolicy_life; + + typedef + TAO_Objref_Var_T< + SchedulingParameterPolicy, + tao_SchedulingParameterPolicy_life + > + SchedulingParameterPolicy_var; + + typedef + TAO_Objref_Out_T< + SchedulingParameterPolicy, + tao_SchedulingParameterPolicy_life + > + SchedulingParameterPolicy_out; + + struct Kokyu_DSRT_Schedulers_Export tao_SchedulingParameterPolicy_life + { + static SchedulingParameterPolicy_ptr tao_duplicate (SchedulingParameterPolicy_ptr); + static void tao_release (SchedulingParameterPolicy_ptr); + static SchedulingParameterPolicy_ptr tao_nil (void); + static CORBA::Boolean tao_marshal ( + SchedulingParameterPolicy_ptr, + TAO_OutputCDR & + ); + }; + + struct Kokyu_DSRT_Schedulers_Export tao_SchedulingParameterPolicy_cast + { + static SchedulingParameterPolicy_ptr tao_narrow ( + CORBA::Object_ptr + ACE_ENV_ARG_DECL + ); + static CORBA::Object_ptr tao_upcast (void *); + }; + +#endif /* end #if !defined */ + + // TAO_IDL - Generated from + // be/be_visitor_interface/interface_ch.cpp:53 + +#if !defined (_MUF_SCHEDULING_SCHEDULINGPARAMETERPOLICY_CH_) +#define _MUF_SCHEDULING_SCHEDULINGPARAMETERPOLICY_CH_ + + class Kokyu_DSRT_Schedulers_Export SchedulingParameterPolicy + : public virtual CORBA::Policy + { + public: + typedef SchedulingParameterPolicy_ptr _ptr_type; + typedef SchedulingParameterPolicy_var _var_type; + static int _tao_class_id; + + // The static operations. + static SchedulingParameterPolicy_ptr _duplicate (SchedulingParameterPolicy_ptr obj); + + static SchedulingParameterPolicy_ptr _narrow ( + CORBA::Object_ptr obj + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ); + + static SchedulingParameterPolicy_ptr _unchecked_narrow ( + CORBA::Object_ptr obj + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ); + + static SchedulingParameterPolicy_ptr _nil (void) + { + return (SchedulingParameterPolicy_ptr)0; + } + + static void _tao_any_destructor (void *); + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual ::MUF_Scheduling::SchedulingParameter value ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual void value ( + const MUF_Scheduling::SchedulingParameter & value + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_interface/interface_ch.cpp:210 + + virtual void *_tao_QueryInterface (ptrdiff_t type); + + virtual const char* _interface_repository_id (void) const; + virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr); + + protected: + SchedulingParameterPolicy (void); + virtual ~SchedulingParameterPolicy (void); + + private: + SchedulingParameterPolicy (const SchedulingParameterPolicy &); + void operator= (const SchedulingParameterPolicy &); + }; + +#endif /* end #if !defined */ + + // TAO_IDL - Generated from + // be/be_visitor_typecode/typecode_decl.cpp:44 + + TAO_NAMESPACE_STORAGE_CLASS ::CORBA::TypeCode_ptr _tc_SchedulingParameterPolicy; + + // TAO_IDL - Generated from + // be/be_interface.cpp:584 + +#if !defined (_MUF_SCHEDULING_SCHEDULER__ODDS_N_ENDS_CH_) +#define _MUF_SCHEDULING_SCHEDULER__ODDS_N_ENDS_CH_ + + class Scheduler; + typedef Scheduler *Scheduler_ptr; + struct tao_Scheduler_life; + + typedef + TAO_Objref_Var_T< + Scheduler, + tao_Scheduler_life + > + Scheduler_var; + + typedef + TAO_Objref_Out_T< + Scheduler, + tao_Scheduler_life + > + Scheduler_out; + + struct Kokyu_DSRT_Schedulers_Export tao_Scheduler_life + { + static Scheduler_ptr tao_duplicate (Scheduler_ptr); + static void tao_release (Scheduler_ptr); + static Scheduler_ptr tao_nil (void); + static CORBA::Boolean tao_marshal ( + Scheduler_ptr, + TAO_OutputCDR & + ); + }; + + struct Kokyu_DSRT_Schedulers_Export tao_Scheduler_cast + { + static Scheduler_ptr tao_narrow ( + CORBA::Object_ptr + ACE_ENV_ARG_DECL + ); + static CORBA::Object_ptr tao_upcast (void *); + }; + +#endif /* end #if !defined */ + + // TAO_IDL - Generated from + // be/be_visitor_interface/interface_ch.cpp:53 + +#if !defined (_MUF_SCHEDULING_SCHEDULER_CH_) +#define _MUF_SCHEDULING_SCHEDULER_CH_ + + class Kokyu_DSRT_Schedulers_Export Scheduler + : public virtual RTScheduling::Scheduler + { + public: + typedef Scheduler_ptr _ptr_type; + typedef Scheduler_var _var_type; + static int _tao_class_id; + + // The static operations. + static Scheduler_ptr _duplicate (Scheduler_ptr obj); + + static Scheduler_ptr _narrow ( + CORBA::Object_ptr obj + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ); + + static Scheduler_ptr _unchecked_narrow ( + CORBA::Object_ptr obj + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ); + + static Scheduler_ptr _nil (void) + { + return (Scheduler_ptr)0; + } + + static void _tao_any_destructor (void *); + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual ::MUF_Scheduling::SchedulingParameterPolicy_ptr create_scheduling_parameter ( + const MUF_Scheduling::SchedulingParameter & value + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_interface/interface_ch.cpp:210 + + virtual void *_tao_QueryInterface (ptrdiff_t type); + + virtual const char* _interface_repository_id (void) const; + virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr); + + protected: + Scheduler (void); + virtual ~Scheduler (void); + + private: + Scheduler (const Scheduler &); + void operator= (const Scheduler &); + }; + +#endif /* end #if !defined */ + + // TAO_IDL - Generated from + // be/be_visitor_typecode/typecode_decl.cpp:44 + + TAO_NAMESPACE_STORAGE_CLASS ::CORBA::TypeCode_ptr _tc_Scheduler; + +// TAO_IDL - Generated from +// be/be_visitor_module/module_ch.cpp:67 + +} +TAO_NAMESPACE_CLOSE // module MUF_Scheduling + +// TAO_IDL - Generated from +// be/be_visitor_structure/any_op_ch.cpp:52 + +Kokyu_DSRT_Schedulers_Export void operator<<= (CORBA::Any &, const MUF_Scheduling::SchedulingParameter &); // copying version +Kokyu_DSRT_Schedulers_Export void operator<<= (CORBA::Any &, MUF_Scheduling::SchedulingParameter*); // noncopying version +Kokyu_DSRT_Schedulers_Export CORBA::Boolean operator>>= (const CORBA::Any &, MUF_Scheduling::SchedulingParameter *&); // deprecated +Kokyu_DSRT_Schedulers_Export CORBA::Boolean operator>>= (const CORBA::Any &, const MUF_Scheduling::SchedulingParameter *&); + +// TAO_IDL - Generated from +// be/be_visitor_interface/any_op_ch.cpp:52 + +Kokyu_DSRT_Schedulers_Export void operator<<= (CORBA::Any &, MUF_Scheduling::SchedulingParameterPolicy_ptr); // copying +Kokyu_DSRT_Schedulers_Export void operator<<= (CORBA::Any &, MUF_Scheduling::SchedulingParameterPolicy_ptr *); // non-copying +Kokyu_DSRT_Schedulers_Export CORBA::Boolean operator>>= (const CORBA::Any &, MUF_Scheduling::SchedulingParameterPolicy_ptr &); + +// TAO_IDL - Generated from +// be/be_visitor_interface/any_op_ch.cpp:52 + +Kokyu_DSRT_Schedulers_Export void operator<<= (CORBA::Any &, MUF_Scheduling::Scheduler_ptr); // copying +Kokyu_DSRT_Schedulers_Export void operator<<= (CORBA::Any &, MUF_Scheduling::Scheduler_ptr *); // non-copying +Kokyu_DSRT_Schedulers_Export CORBA::Boolean operator>>= (const CORBA::Any &, MUF_Scheduling::Scheduler_ptr &); + +// TAO_IDL - Generated from +// be/be_visitor_root/cdr_op.cpp:48 + +#ifndef __ACE_INLINE__ + +// TAO_IDL - Generated from +// be/be_visitor_structure/cdr_op_ch.cpp:53 + +Kokyu_DSRT_Schedulers_Export CORBA::Boolean operator<< (TAO_OutputCDR &, const MUF_Scheduling::SchedulingParameter &); +Kokyu_DSRT_Schedulers_Export CORBA::Boolean operator>> (TAO_InputCDR &, MUF_Scheduling::SchedulingParameter &); + +// TAO_IDL - Generated from +// be/be_visitor_root/cdr_op.cpp:64 + +#endif /* __ACE_INLINE__ */ + +// TAO_IDL - Generated from +// be/be_codegen.cpp:1060 + +#if defined (__ACE_INLINE__) +#include "MUF_SchedulingC.i" +#endif /* defined INLINE */ + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +#pragma warning(pop) +#endif /* _MSC_VER */ + +#if defined (__BORLANDC__) +#pragma option pop +#endif /* __BORLANDC__ */ + +#endif /* ifndef */ + diff --git a/TAO/examples/Kokyu_dsrt_schedulers/MUF_SchedulingC.h.diff b/TAO/examples/Kokyu_dsrt_schedulers/MUF_SchedulingC.h.diff new file mode 100644 index 00000000000..2e907dbde38 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/MUF_SchedulingC.h.diff @@ -0,0 +1,13 @@ +--- MUF_SchedulingC.h.orig Mon Sep 1 11:06:24 2003 ++++ MUF_SchedulingC.h Mon Sep 1 11:07:10 2003 +@@ -41,8 +41,8 @@ + + #include "Kokyu_dsrt_schedulers_export.h" + +-#include "tao/RTScheduling/RTSchedulerC.h" +-#include "tao/RTCORBA/RTCORBAC.h" ++#include "tao/RTScheduling/RTScheduler.h" ++#include "tao/RTCORBA/RTCORBA.h" + + #if defined (TAO_EXPORT_MACRO) + #undef TAO_EXPORT_MACRO diff --git a/TAO/examples/Kokyu_dsrt_schedulers/MUF_SchedulingC.i b/TAO/examples/Kokyu_dsrt_schedulers/MUF_SchedulingC.i new file mode 100644 index 00000000000..e7157fb718b --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/MUF_SchedulingC.i @@ -0,0 +1,125 @@ +// -*- C++ -*- +// +// $Id$ + +// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** +// TAO and the TAO IDL Compiler have been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// and +// Distributed Object Computing Laboratory +// University of California at Irvine +// Irvine, CA +// USA +// http://doc.ece.uci.edu/ +// and +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + + +// TAO_IDL - Generated from +// be/be_visitor_interface/interface_ci.cpp:63 + +#if !defined (_MUF_SCHEDULING_SCHEDULINGPARAMETERPOLICY___CI_) +#define _MUF_SCHEDULING_SCHEDULINGPARAMETERPOLICY___CI_ + +template<> +ACE_INLINE +CORBA::Boolean +TAO::Any_Impl_T<MUF_Scheduling::SchedulingParameterPolicy>::to_object ( + CORBA::Object_ptr &_tao_elem + ) const +{ + _tao_elem = CORBA::Object::_duplicate (this->value_); + return 1; +} + +template<> +ACE_INLINE +CORBA::Boolean +TAO::Any_Impl_T<MUF_Scheduling::SchedulingParameterPolicy>::marshal_value (TAO_OutputCDR &) +{ + return 0; +} + +template<> +ACE_INLINE +CORBA::Boolean +TAO::Any_Impl_T<MUF_Scheduling::SchedulingParameterPolicy>::demarshal_value (TAO_InputCDR &) +{ + return 0; +} + +#endif /* end #if !defined */ + +// TAO_IDL - Generated from +// be/be_visitor_interface/interface_ci.cpp:63 + +#if !defined (_MUF_SCHEDULING_SCHEDULER___CI_) +#define _MUF_SCHEDULING_SCHEDULER___CI_ + +template<> +ACE_INLINE +CORBA::Boolean +TAO::Any_Impl_T<MUF_Scheduling::Scheduler>::to_object ( + CORBA::Object_ptr &_tao_elem + ) const +{ + _tao_elem = CORBA::Object::_duplicate (this->value_); + return 1; +} + +template<> +ACE_INLINE +CORBA::Boolean +TAO::Any_Impl_T<MUF_Scheduling::Scheduler>::marshal_value (TAO_OutputCDR &) +{ + return 0; +} + +template<> +ACE_INLINE +CORBA::Boolean +TAO::Any_Impl_T<MUF_Scheduling::Scheduler>::demarshal_value (TAO_InputCDR &) +{ + return 0; +} + +#endif /* end #if !defined */ + +// TAO_IDL - Generated from +// be/be_visitor_structure/cdr_op_ci.cpp:70 + +ACE_INLINE +CORBA::Boolean operator<< ( + TAO_OutputCDR &strm, + const MUF_Scheduling::SchedulingParameter &_tao_aggregate + ) +{ + return + (strm << _tao_aggregate.deadline) && + (strm << _tao_aggregate.estimated_initial_execution_time) && + (strm << _tao_aggregate.criticality); +} + +ACE_INLINE +CORBA::Boolean operator>> ( + TAO_InputCDR &strm, + MUF_Scheduling::SchedulingParameter &_tao_aggregate + ) +{ + return + (strm >> _tao_aggregate.deadline) && + (strm >> _tao_aggregate.estimated_initial_execution_time) && + (strm >> _tao_aggregate.criticality); +} + diff --git a/TAO/examples/Kokyu_dsrt_schedulers/Makefile b/TAO/examples/Kokyu_dsrt_schedulers/Makefile new file mode 100644 index 00000000000..a9256100276 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/Makefile @@ -0,0 +1,19 @@ +#---------------------------------------------------------------------------- +# GNU ACE Workspace +# +# @file Makefile +# +# $Id$ +# +# This file was automatically generated by MPC. Any changes made directly to +# this file will be lost the next time it is generated. +# +#---------------------------------------------------------------------------- + +TARGETS_NESTED = all debug profile optimize install deinstall clean realclean clobber depend rcs_info idl_stubs + +$(TARGETS_NESTED): + @$(MAKE) -f Makefile.Kokyu_DSRT_Schedulers $(@); + +reverseclean: + @$(MAKE) -f Makefile.Kokyu_DSRT_Schedulers realclean diff --git a/TAO/examples/Kokyu_dsrt_schedulers/Makefile.Kokyu_DSRT_Schedulers b/TAO/examples/Kokyu_dsrt_schedulers/Makefile.Kokyu_DSRT_Schedulers new file mode 100644 index 00000000000..51741d28edd --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/Makefile.Kokyu_DSRT_Schedulers @@ -0,0 +1,97 @@ +#---------------------------------------------------------------------------- +# GNU Makefile +# +# @file Makefile.Kokyu_DSRT_Schedulers +# +# $Id$ +# +# This file was automatically generated by MPC. Any changes made directly to +# this file will be lost the next time it is generated. +# +#---------------------------------------------------------------------------- +MAKEFILE = Makefile.Kokyu_DSRT_Schedulers +DEPENDENCY_FILE = .depend.Makefile.Kokyu_DSRT_Schedulers +LIB = libKokyu_DSRT_Schedulers.a +SHLIB = libKokyu_DSRT_Schedulers.$(SOEXT) + +ifndef TAO_ROOT + TAO_ROOT = $(ACE_ROOT)/TAO +endif +ifndef CIAO_ROOT + CIAO_ROOT = $(TAO_ROOT)/CIAO +endif + +FILES = \ + FP_Scheduler \ + MUF_Scheduler \ + MIF_Scheduler \ + Task_Stats \ + utils \ + Kokyu_qosC \ + FP_SchedulingC \ + MUF_SchedulingC \ + MIF_SchedulingC + +#---------------------------------------------------------------------------- +# Include macros and targets +#---------------------------------------------------------------------------- +ACE_SHLIBS = -lTAO_RTScheduler -lKokyu -lTAO_RTCORBA -lACE -lTAO +include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU +## We don't need the ACELIB setting from wrapper_macros.GNU +ACELIB = +include $(TAO_ROOT)/rules.tao.GNU + +# To build multiple executables in the same directory on AIX, it works +# best to have a template directory per project. +# The compiler/linker isn't too smart about instantiating templates... +ifdef TEMPINCDIR +TEMPINCDIR := $(TEMPINCDIR)/Kokyu_DSRT_Schedulers + +all: $(TEMPINCDIR) + +$(TEMPINCDIR): + @-test -d $(TEMPINCDIR) || mkdir -p $(TEMPINCDIR) $(ACE_NUL_STDERR) + +endif + + + +LSRC = $(addsuffix .cpp, $(FILES)) + +include $(ACE_ROOT)/include/makeinclude/macros.GNU +include $(ACE_ROOT)/include/makeinclude/rules.common.GNU +include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU + +INSTALL_CHECK = . +ifeq ($(INSTALL_CHECK),.) + INSLIB = $(PWD) +else + INSLIB = $(INSTALL_CHECK) +endif + +include $(ACE_ROOT)/include/makeinclude/rules.lib.GNU +include $(ACE_ROOT)/include/makeinclude/rules.local.GNU +include $(TAO_ROOT)/taoconfig.mk + +CPPFLAGS += -I../.. -I../../.. -I../../tao/RTScheduling -I../../tao/RTCORBA -I../../../Kokyu +ifeq ($(shared_libs),1) + ifneq ($(SHLIB),) + CPPFLAGS += -DKOKYU_DSRT_SCHEDULERS_BUILD_DLL + endif +endif + + +LDFLAGS += -L../../examples/Kokyu_dsrt_schedulers -L../../tao -L../../../ace -L../../tao/RTCORBA -L../../tao/RTScheduling -L../../../Kokyu + +#---------------------------------------------------------------------------- +# Local targets +#---------------------------------------------------------------------------- +.: + -@mkdir -p "." + + +realclean: clean +ifneq ($(GENERATED_DIRTY),) + -$(RM) -r $(GENERATED_DIRTY) +endif + diff --git a/TAO/examples/Kokyu_dsrt_schedulers/README b/TAO/examples/Kokyu_dsrt_schedulers/README new file mode 100644 index 00000000000..e2e4c5ee040 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/README @@ -0,0 +1,170 @@ +Design approaches for the Kokyu based DSRT scheduler/dispatcher +-------------------------------------------------------- + +The DSRT schedulers in this directory use the Kokyu DSRT +dispatching classes present in $ACE_ROOT/Kokyu. These +act as wrappers/adapters around the Kokyu DSRT dispatcher. +The Kokyu DSRT dispatcher is responsible for scheduling +threads which ask the dispatcher to schedule themselves. +Currently there are two implementations for the Kokyu +DSRT dispatcher. One uses a condition-variable based +approach for scheduling threads and the other manipulates +priorities of threads and relies on the OS scheduler for +dispatching the threads appropriately. + +CV-based approach +----------------- +In this approach, it is assumed that the threads "yield" +on a regular basis to the scheduler by calling +update_scheduling_segment. Only one thread is running at +any point in time. All the other threads are blocked +on a condition variable. When the currently running +thread yields, it will cause the condition variable +to be signalled. All the eligible threads are stored +in a scheduler queue (rbtree), the most eligible thread +determined by the scheduling discipline. This approach +has the drawback that it requires a cooperative +threading model, where threads yield voluntarily +on a regular basis. The application threads are +responsible for doing this voluntary yielding. + +OS-based approach +----------------- +This approach relies on the OS scheduler to do the +actual thread dispatching. The Kokyu DSRT dispatcher manipulates +the priorities of the threads. The scheduler maintains +a queue (rbtree) of threads. The scheduler also has +an executive thread, which runs at the maximum available +priority. This thread runs in a continuous loop until +the dispatcher is shut down. The executive thread is +responsible for selecting the most eligible thread from +the scheduler queue and bump up its priority if necessary +while bumping down the priority of the currently running +thread, if it is not the most eligible. There are four +priority levels required for this mechanism to work, +listed in descending order of priorities. For example, +a thread running at Active priority will preempt a +thread running at Inactive priority level. + +1. Executive priority - priority at which the scheduler + executive thread runs. +2. Blocked priority - this is the priority to which + threads about to block on remote calls will be bumped + up to. +3. Active priority - this is the priority to which + the most eligible thread is set to. +4. Inactive priority - this is the priority to which + all threads except the most eligible thread is set + to. + +As soon as a thread asks to be scheduled, a +wrapper object is created and inserted into the queue. +This object carries the qos (sched params) associated +with that thread. A condition variable is signalled +to inform the executive thread that the queue is +"dirty". The scheduler thread picks up the most +eligble one and sets its priority to "active" and +sets the currently running thread priority to +"inactive". + +The drawback to this approach is that it relies on +the OS scheduler to dispatch the threads. Also, +with the current implementation, there is only +one thread running at active priority and others +are all at "inactive" level. This will create +undesirable effects with multi-processor systems, +which could select any one of the "inactive" level +threads and this could cause priority inversions. + +How to write a new DSRT scheduler using Kokyu +--------------------------------------------- +One can use one of the schedulers as a starting +point. The variation points are + +1. The scheduler parameters that need to be propagated + along with the service context. +2. The QoS comparison function, that determines which + thread is more eligible. + +To aid (1), we have created a Svc_Ctxt_DSRT_QoS idl +interface (see ./Kokyu_qos.pidl). This interface +currently has the necessary things to be propagated +for FP, MIF and MUF schedulers. This can be altered +if necessary to accomodate new sched params. The +idea here is to let the IDL compiler generate the +marshalling code (including Any operators) so that +these parameters can be shipped across in the +service context in an encapsulated CDR. + +To create customized QoS comparator functions, we +used the idea of C++ traits to let the user define +customized comparator functions. For example, the +MIF scheduler uses the following traits class. + + struct MIF_Scheduler_Traits + { + typedef RTScheduling::Current::IdType Guid_t; + + struct _QoSDescriptor_t + { + typedef long Importance_t; + Importance_t importance_; + }; + + typedef _QoSDescriptor_t QoSDescriptor_t; + + typedef Kokyu::MIF_Comparator<QoSDescriptor_t> QoSComparator_t; + + class _Guid_Hash + { + public: + u_long operator () (const Guid_t& id) + { + return ACE::hash_pjw ((const char *) id.get_buffer (), + id.length ()); + } + }; + + typedef _Guid_Hash Guid_Hash; + }; + +The idea of traits makes the Kokyu dispatcher more flexible +in terms of creating new schedulers. For example, the +Kokyu classes do not care about what concrete type +Guid is. It could be an OctetSequence for some applications, +whereas it could be an int for some others. The exact type +is defined by the application (in this case, the MIF scheduler) +using the traits class. In the above traits class the +Guid's type is defined to be an octet sequence (indirectly). +The Kokyu dispatcher expects the following typedef's to +be present in the traits class: + +Guid_t - Type of GUID. +QoSDescriptor_t - aggregate for scheduler parameters +QoSComparator_t - used by the scheduler queue to determine most eligible item +Guid_Hash - used by the internal hash map in the scheduler to hash the guid. + +It is also expected that the following operator be defined +for comparing QoS parameters. This comparator function +will be used by the scheduler queue to determine +the most eligible item in the queue. + +QoSComparator_t::operator ()(const QoSDescriptor_t& qos1, + const QoSDescriptor_t& qos2) + +Future work +----------- +1. It looks like there is a general structure to the + different schedulers. May be this can be abstracted + using templates or some similar mechanism. + +2. Thread sched policy and sched scope are currently + being passed explicitly from the application to + the scheduler. This can be changed later to get + this information from the ORB. This requires the + usage of RTORB and the actual values can be set + using svc.conf parameters for RT_ORB_Loader. + +3. See whether the approaches could be extended + to multiprocessor systems. + diff --git a/TAO/examples/Kokyu_dsrt_schedulers/Task_Stats.cpp b/TAO/examples/Kokyu_dsrt_schedulers/Task_Stats.cpp new file mode 100644 index 00000000000..d38bb0f652f --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/Task_Stats.cpp @@ -0,0 +1,106 @@ +//$Id$ +#include "Task_Stats.h" +#include "ace/OS.h" +#include "ace/Log_Msg.h" +#include "ace/OS_String.h" + +#if !defined (__ACE_INLINE__) +#include "Task_Stats.inl" +#endif /* __ACE_INLINE__ */ + +Base_Time::Base_Time (void) +{ + base_time_ = ACE_OS::gethrtime (); +} + +Task_Stats::Task_Stats (void) + : base_time_(0), + end_time_ (0), + max_samples_ (0), + samples_count_ (0), + thr_run_time_ (0), + thr_count_ (0), + exec_time_min_ (0), + exec_time_min_at_ (0), + exec_time_max_ (0), + exec_time_max_at_(0), + sum_ (0), + sum2_ (0) +{ +} + +Task_Stats::~Task_Stats (void) +{ + delete[] this->thr_run_time_; + delete[] this->thr_count_; +} + +int +Task_Stats::init (size_t max_samples) +{ + max_samples_ = max_samples; + ACE_NEW_RETURN (this->thr_run_time_, ACE_UINT32[this->max_samples_], -1); + ACE_NEW_RETURN (this->thr_count_, int[this->max_samples_], -1); + return 0; +} + +void +Task_Stats::base_time (ACE_hrtime_t time) +{ + base_time_ = time; +} + +void +Task_Stats::end_time (ACE_hrtime_t time) +{ + end_time_ = time; +} + +void +Task_Stats::dump_samples (const ACE_TCHAR *file_name, const ACE_TCHAR *msg, + ACE_UINT32) +{ + FILE* output_file = ACE_OS::fopen (file_name, "w"); + + if (output_file == 0) + { + ACE_ERROR ((LM_ERROR, + "%s cannot be opened \n", + file_name)); + } + + // first dump what the caller has to say. + ACE_OS::fprintf (output_file, "%s\n",msg); + + // next, compose and dump what we want to say. + ACE_UINT32 val_1; + int val_2; + ACE_UINT64 x; + + // dump the samples recorded. + for (size_t i = 0; i < this->samples_count_; ++i) + { + x = this->thr_run_time_[i]; + val_1 = ACE_CU64_TO_CU32 (x); + val_2 = this->thr_count_[i]; + ACE_OS::fprintf (output_file, "%u \t %d\n",val_1,val_2); + } + + ACE_OS::fclose (output_file); + + ACE_DEBUG ((LM_DEBUG, + "Samples are ready to be viewed\n")); +} + + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +template class ACE_Singleton<Base_Time, TAO_SYNCH_MUTEX>; +template class ACE_Singleton<Task_Stats, TAO_SYNCH_MUTEX>; + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +#pragma instantiate ACE_Singleton<Base_Time, TAO_SYNCH_MUTEX> +#pragma instantiate ACE_Singleton<Task_Stats, TAO_SYNCH_MUTEX> + +#endif /*ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/examples/Kokyu_dsrt_schedulers/Task_Stats.h b/TAO/examples/Kokyu_dsrt_schedulers/Task_Stats.h new file mode 100644 index 00000000000..cde29b3037a --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/Task_Stats.h @@ -0,0 +1,108 @@ +/* -*- C++ -*- */ +//============================================================================= +/** + * @file Task_Stats.h + * + * $Id$ + * + * Utility Stats class that maintains the readings. + * + * @author Pradeep Gore <pradeep@cs.wustl.edu> + */ +//============================================================================= +#ifndef TASK_STATS_H +#define TASK_STATS_H + +#include "ace/OS.h" +#include "ace/Singleton.h" +#include "tao/orbconf.h" +#include "tao/debug.h" +#include "Kokyu_dsrt_schedulers_export.h" + +/** + * @class Base_Time + * + * @brief maintains readings recorded by tasks. + * + */ +class Kokyu_DSRT_Schedulers_Export Base_Time +{ + public: + Base_Time (void); + ACE_hrtime_t base_time_; +}; + +typedef ACE_Singleton<Base_Time, TAO_SYNCH_MUTEX> BASE_TIME; + +/** + * @class Task_Stats + * + * @brief maintains readings recorded by tasks. + * + */ +class Kokyu_DSRT_Schedulers_Export Task_Stats +{ + public: + /// Constructor + Task_Stats (void); + + /// Destructor + ~Task_Stats (void); + + /// Init + int init (size_t max_samples); + + /// Set the base time value. + void base_time (ACE_hrtime_t time); + + /// Set the end time value. + void end_time (ACE_hrtime_t time); + + /// Record a sample + int sample (ACE_UINT32 thr_run_time, int thr_count); + + void dump_samples (const ACE_TCHAR *file_name, const ACE_TCHAR *msg, + ACE_UINT32 scale_factor); + protected: + void dump_latency_stats (ACE_TCHAR *out_msg, ACE_UINT32 sf); + + /// Base and end times + ACE_hrtime_t base_time_; + ACE_hrtime_t end_time_; + + /// The maximum number of samples + ACE_UINT32 max_samples_; + + /// The number of samples + ACE_UINT32 samples_count_; + + /// The samples : the time of execution. and the recorded exec. time . + ACE_UINT32 *thr_run_time_; + int *thr_count_; + + /// The minimum value + ACE_UINT64 exec_time_min_; + + /// The number of the sample that had the minimum value + ACE_UINT32 exec_time_min_at_; + + /// The maximum value + ACE_UINT64 exec_time_max_; + + /// The number of the sample that had the maximum value + ACE_UINT32 exec_time_max_at_; + + /// The sum of all the values + ACE_UINT64 sum_; + + /// The sum of the square of all the values + ACE_UINT64 sum2_; +}; + +typedef ACE_Singleton<Task_Stats, TAO_SYNCH_MUTEX> TASK_STATS; + +#if defined (__ACE_INLINE__) +#include "Task_Stats.inl" +#endif /* __ACE_INLINE__ */ + +#endif /* TASK_STATS_H */ diff --git a/TAO/examples/Kokyu_dsrt_schedulers/Task_Stats.inl b/TAO/examples/Kokyu_dsrt_schedulers/Task_Stats.inl new file mode 100644 index 00000000000..3b50f8c52a4 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/Task_Stats.inl @@ -0,0 +1,17 @@ +//$Id$ + +ACE_INLINE int +Task_Stats::sample (ACE_UINT32 thr_run_time, int thr_count) +{ + if (this->samples_count_ >= this->max_samples_) + { + ACE_DEBUG ((LM_DEBUG, "Task_Stats::sample ret -1\n")); + return -1; + } + + this->thr_run_time_[this->samples_count_] = thr_run_time; + this->thr_count_[this->samples_count_] = thr_count; + + this->samples_count_++; + return 0; +} diff --git a/TAO/examples/Kokyu_dsrt_schedulers/fp_example/Makefile b/TAO/examples/Kokyu_dsrt_schedulers/fp_example/Makefile new file mode 100644 index 00000000000..6daaa332c57 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/fp_example/Makefile @@ -0,0 +1,57 @@ +#---------------------------------------------------------------------------- +# GNU ACE Workspace +# +# @file Makefile +# +# $Id$ +# +# This file was automatically generated by MPC. Any changes made directly to +# this file will be lost the next time it is generated. +# +#---------------------------------------------------------------------------- + + +MAKE_OPTIONS=$(shell echo $(MAKEFLAGS) | sed 's/--unix *//; s/ .*//') +ifeq ($(findstring k,$(MAKE_OPTIONS)),k) + KEEP_GOING = 1 +else + KEEP_GOING = 0 +endif + +%.tgt0: +ifeq ($(KEEP_GOING),1) + -@$(MAKE) -f Makefile.fp_client -C . $(*); +else + @$(MAKE) -f Makefile.fp_client -C . $(*); +endif +%.tgt1: %.tgt0 +ifeq ($(KEEP_GOING),1) + -@$(MAKE) -f Makefile.fp_server -C . $(*); +else + @$(MAKE) -f Makefile.fp_server -C . $(*); +endif + + +all: all.tgt0 all.tgt1 + +debug: debug.tgt0 debug.tgt1 + +profile: profile.tgt0 profile.tgt1 + +optimize: optimize.tgt0 optimize.tgt1 + +install: install.tgt0 install.tgt1 + +deinstall: deinstall.tgt0 deinstall.tgt1 + +clean: clean.tgt0 clean.tgt1 + +realclean: realclean.tgt0 realclean.tgt1 + +clobber: clobber.tgt0 clobber.tgt1 + +depend: depend.tgt0 depend.tgt1 + +rcs_info: rcs_info.tgt0 rcs_info.tgt1 + +idl_stubs: idl_stubs.tgt0 idl_stubs.tgt1 diff --git a/TAO/examples/Kokyu_dsrt_schedulers/fp_example/Makefile.fp_client b/TAO/examples/Kokyu_dsrt_schedulers/fp_example/Makefile.fp_client new file mode 100644 index 00000000000..6842bf18d23 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/fp_example/Makefile.fp_client @@ -0,0 +1,108 @@ +#---------------------------------------------------------------------------- +# GNU Makefile +# +# @file Makefile.fp_client +# +# $Id$ +# +# This file was automatically generated by MPC. Any changes made directly to +# this file will be lost the next time it is generated. +# +#---------------------------------------------------------------------------- +MAKEFILE = Makefile.fp_client +DEPENDENCY_FILE = .depend.Makefile.fp_client +BIN_UNCHECKED = client + +ifndef TAO_ROOT + TAO_ROOT = $(ACE_ROOT)/TAO +endif +ifndef CIAO_ROOT + CIAO_ROOT = $(TAO_ROOT)/CIAO +endif + +TAO_IDL = ../../../../bin/tao_idl +IDL_FILES = test +IDL_SRC = $(foreach ext, C.cpp S.cpp, $(foreach file, $(IDL_FILES), $(file)$(ext))) + +FILES = \ + testC \ + client + +#---------------------------------------------------------------------------- +# Include macros and targets +#---------------------------------------------------------------------------- +LDLIBS = -lTAO_RTScheduler -lKokyu -lKokyu_DSRT_Schedulers -lTAO_RTCORBA -lTAO -lACE +include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU +## We don't need the ACELIB setting from wrapper_macros.GNU +ACELIB = +include $(TAO_ROOT)/rules.tao.GNU + +# To build multiple executables in the same directory on AIX, it works +# best to have a template directory per project. +# The compiler/linker isn't too smart about instantiating templates... +ifdef TEMPINCDIR +TEMPINCDIR := $(TEMPINCDIR)/fp_client + +all: $(TEMPINCDIR) + +$(TEMPINCDIR): + @-test -d $(TEMPINCDIR) || mkdir -p $(TEMPINCDIR) $(ACE_NUL_STDERR) + +endif + +BIN = $(BIN_UNCHECKED) + +OBJS = $(addsuffix .o, $(notdir $(FILES))) +SRC = $(addsuffix .cpp, $(FILES)) + +ifneq ($(BIN),) +all: idl_stubs + +# This rule forces make to run the idl_stubs +# target before building any of the source files. +testC.cpp client.cpp: idl_stubs +endif + +include $(ACE_ROOT)/include/makeinclude/macros.GNU +include $(ACE_ROOT)/include/makeinclude/rules.common.GNU +include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU + +include $(ACE_ROOT)/include/makeinclude/rules.local.GNU +include $(TAO_ROOT)/taoconfig.mk + +CPPFLAGS += -I../../../tao/RTScheduling -I../../../tao/RTCORBA -I../../../../Kokyu -I../../../examples/Kokyu_dsrt_schedulers -I../../.. -I../../../tao -I../../../.. +ifeq ($(static_libs),1) + ifneq ($(LIB),) + CPPFLAGS += -DTAO_AS_STATIC_LIBS -DACE_AS_STATIC_LIBS + endif +endif + + +LDFLAGS += -L../../../examples/Kokyu_dsrt_schedulers -L../../../tao/RTScheduling -L../../../tao/RTCORBA -L../../../../Kokyu -L../../../tao -L../../../../ace -L../../../../lib + +TAO_IDLFLAGS += -Ge 1 -Sc -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h +#---------------------------------------------------------------------------- +# Local targets +#---------------------------------------------------------------------------- +.: + -@mkdir -p "." + + +ADDITIONAL_IDL_TARGETS = +# IDL File Directory: . + +ifneq ($(ADDITIONAL_IDL_TARGETS),) +idl_stubs: $(ADDITIONAL_IDL_TARGETS) +endif + +.PRECIOUS: $(foreach ext, $(IDL_EXT), $(foreach file, $(IDL_FILES), $(file)$(ext))) + +$(BIN): $(addprefix $(VDIR), $(OBJS)) + $(LINK.cc) $(LDFLAGS) $(CC_OUTPUT_FLAG) $@ $^ $(VLDLIBS) $(POSTLINK) + +realclean: clean + -$(RM) $(foreach ext, $(IDL_EXT), $(foreach file, $(IDL_FILES), $(file)$(ext))) +ifneq ($(GENERATED_DIRTY),) + -$(RM) -r $(GENERATED_DIRTY) +endif + diff --git a/TAO/examples/Kokyu_dsrt_schedulers/fp_example/Makefile.fp_server b/TAO/examples/Kokyu_dsrt_schedulers/fp_example/Makefile.fp_server new file mode 100644 index 00000000000..c96092c4db5 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/fp_example/Makefile.fp_server @@ -0,0 +1,110 @@ +#---------------------------------------------------------------------------- +# GNU Makefile +# +# @file Makefile.fp_server +# +# $Id$ +# +# This file was automatically generated by MPC. Any changes made directly to +# this file will be lost the next time it is generated. +# +#---------------------------------------------------------------------------- +MAKEFILE = Makefile.fp_server +DEPENDENCY_FILE = .depend.Makefile.fp_server +BIN_UNCHECKED = server + +ifndef TAO_ROOT + TAO_ROOT = $(ACE_ROOT)/TAO +endif +ifndef CIAO_ROOT + CIAO_ROOT = $(TAO_ROOT)/CIAO +endif + +TAO_IDL = ../../../../bin/tao_idl +IDL_FILES = test +IDL_SRC = $(foreach ext, C.cpp S.cpp, $(foreach file, $(IDL_FILES), $(file)$(ext))) + +FILES = \ + testC \ + testS \ + test_i \ + server + +#---------------------------------------------------------------------------- +# Include macros and targets +#---------------------------------------------------------------------------- +LDLIBS = -lTAO_RTScheduler -lKokyu -lKokyu_DSRT_Schedulers -lTAO_RTCORBA -lTAO_PortableServer -lTAO_IORInterceptor -lTAO_Valuetype -lTAO_ObjRefTemplate -lTAO -lACE +include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU +## We don't need the ACELIB setting from wrapper_macros.GNU +ACELIB = +include $(TAO_ROOT)/rules.tao.GNU + +# To build multiple executables in the same directory on AIX, it works +# best to have a template directory per project. +# The compiler/linker isn't too smart about instantiating templates... +ifdef TEMPINCDIR +TEMPINCDIR := $(TEMPINCDIR)/fp_server + +all: $(TEMPINCDIR) + +$(TEMPINCDIR): + @-test -d $(TEMPINCDIR) || mkdir -p $(TEMPINCDIR) $(ACE_NUL_STDERR) + +endif + +BIN = $(BIN_UNCHECKED) + +OBJS = $(addsuffix .o, $(notdir $(FILES))) +SRC = $(addsuffix .cpp, $(FILES)) + +ifneq ($(BIN),) +all: idl_stubs + +# This rule forces make to run the idl_stubs +# target before building any of the source files. +testC.cpp testS.cpp test_i.cpp server.cpp: idl_stubs +endif + +include $(ACE_ROOT)/include/makeinclude/macros.GNU +include $(ACE_ROOT)/include/makeinclude/rules.common.GNU +include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU + +include $(ACE_ROOT)/include/makeinclude/rules.local.GNU +include $(TAO_ROOT)/taoconfig.mk + +CPPFLAGS += -I../../../tao/RTScheduling -I../../../tao/RTCORBA -I../../../../Kokyu -I../../../examples/Kokyu_dsrt_schedulers -I../../.. -I../../../tao -I../../../.. +ifeq ($(static_libs),1) + ifneq ($(LIB),) + CPPFLAGS += -DTAO_AS_STATIC_LIBS -DTAO_AS_STATIC_LIBS -DACE_AS_STATIC_LIBS + endif +endif + + +LDFLAGS += -L../../../examples/Kokyu_dsrt_schedulers -L../../../tao/RTScheduling -L../../../tao/RTCORBA -L../../../tao/PortableServer -L../../../tao/IORInterceptor -L../../../tao/Valuetype -L../../../tao/ObjRefTemplate -L../../../../Kokyu -L../../../tao -L../../../../ace -L../../../../lib + +TAO_IDLFLAGS += -Gv -Ge 1 -Sc -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h +#---------------------------------------------------------------------------- +# Local targets +#---------------------------------------------------------------------------- +../../../../lib: + -@mkdir -p "../../../../lib" + + +ADDITIONAL_IDL_TARGETS = +# IDL File Directory: . + +ifneq ($(ADDITIONAL_IDL_TARGETS),) +idl_stubs: $(ADDITIONAL_IDL_TARGETS) +endif + +.PRECIOUS: $(foreach ext, $(IDL_EXT), $(foreach file, $(IDL_FILES), $(file)$(ext))) + +$(BIN): $(addprefix $(VDIR), $(OBJS)) + $(LINK.cc) $(LDFLAGS) $(CC_OUTPUT_FLAG) $@ $^ $(VLDLIBS) $(POSTLINK) + +realclean: clean + -$(RM) $(foreach ext, $(IDL_EXT), $(foreach file, $(IDL_FILES), $(file)$(ext))) +ifneq ($(GENERATED_DIRTY),) + -$(RM) -r $(GENERATED_DIRTY) +endif + diff --git a/TAO/examples/Kokyu_dsrt_schedulers/fp_example/README b/TAO/examples/Kokyu_dsrt_schedulers/fp_example/README new file mode 100644 index 00000000000..951fdfa0e2b --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/fp_example/README @@ -0,0 +1,34 @@ +This example illustrates the working of a Kokyu +based DSRT scheduler. There are 2 threads waiting +for requests on the server side. Two threads are +started on the client side. The main thread as +well as the worker threads are given the maximum +priority so that their "release" happen immediately. +Each of the worker threads make a remote two-way +call to the server. The two requests are processed +in different threads on the server side. + +On the client side, the first thread is given lesser +priority than the second thread and the second thread +is started a little later than the first. It is +expected that, on the server side, the first request +is processed by one of the two threads. When the +second request comes in, the other thread that processes +this request should become more eligible since the +second request carries more importance than the first. +A timeline is generated which shows the sequence of +execution of the two different threads on the server. + +Make sure that you run in privileged mode. + +To run the test using the CV-based approach (see ../README), + +./server -d +./client -d -x + +To run the test using the OS-based approach (see ../README), + +./server -d -s +./client -d -x -s + +The timeline is generated in timeline.txt diff --git a/TAO/examples/Kokyu_dsrt_schedulers/fp_example/client.cpp b/TAO/examples/Kokyu_dsrt_schedulers/fp_example/client.cpp new file mode 100644 index 00000000000..774bfbfedf3 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/fp_example/client.cpp @@ -0,0 +1,367 @@ +// $Id$ + +#include "ace/Get_Opt.h" +#include "ace/Task.h" +#include "ace/High_Res_Timer.h" +#include "tao/RTScheduling/RTScheduler_Manager.h" +#include "testC.h" +#include "FP_Scheduler.h" + +ACE_RCSID(MT_Server, client, "$Id$") + +const char *ior = "file://test.ior"; +int niterations = 5; +int do_shutdown = 0; +int enable_dynamic_scheduling = 0; +int enable_yield = 1; + +class Worker : public ACE_Task_Base +{ + // = TITLE + // Run a server thread + // + // = DESCRIPTION + // Use the ACE_Task_Base class to run server threads + // +public: + Worker (CORBA::ORB_ptr orb, + Simple_Server_ptr server_ptr, + RTScheduling::Current_ptr current, + Fixed_Priority_Scheduler* scheduler, + CORBA::Short importance, + CORBA::Long server_load); + // int sleep_time); + // ctor + + virtual int svc (void); + // The thread entry point. + +private: + CORBA::ORB_var orb_; + // The orb + + Simple_Server_var server_; + RTScheduling::Current_var scheduler_current_; + Fixed_Priority_Scheduler* scheduler_; + RTCORBA::Priority prio_; + CORBA::Long server_load_; + int sleep_time_; +}; + +int +parse_args (int argc, char *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, "xk:i:ds"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'x': + do_shutdown = 1; + break; + + case 'k': + ior = get_opts.opt_arg (); + break; + + case 'i': + niterations = ACE_OS::atoi (get_opts.opt_arg ()); + break; + + case 'd': + enable_dynamic_scheduling = 1; + break; + + case 's': + enable_yield = 0; + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-k <ior> " + "-i <niterations> " + "-d (enable dynamic scheduling)" + "-s (disable yield)" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int +main (int argc, char *argv[]) +{ + Fixed_Priority_Scheduler* scheduler=0; + RTScheduling::Current_var current; + int prio; + int max_prio; + ACE_Sched_Params::Policy sched_policy = ACE_SCHED_RR; + int sched_scope = ACE_SCOPE_THREAD; + long flags; + + if (sched_policy == ACE_SCHED_RR) + flags = THR_NEW_LWP | THR_BOUND | THR_JOINABLE | THR_SCHED_RR; + else + flags = THR_NEW_LWP | THR_BOUND | THR_JOINABLE | THR_SCHED_FIFO; + + ACE_hthread_t main_thr_handle; + ACE_Thread::self (main_thr_handle); + + max_prio = ACE_Sched_Params::priority_max (sched_policy, + sched_scope); + + ACE_Sched_Params sched_params (sched_policy, max_prio); + + ACE_OS::sched_params (sched_params); + + if (ACE_Thread::getprio (main_thr_handle, prio) == -1) + { + if (errno == ENOTSUP) + { + ACE_ERROR((LM_ERROR, + ACE_TEXT ("getprio not supported\n") + )); + } + else + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n") + ACE_TEXT ("thr_getprio failed"))); + } + } + + ACE_DEBUG ((LM_DEBUG, "(%t): main thread prio is %d\n", prio)); + + ACE_TRY_NEW_ENV + { + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (parse_args (argc, argv) != 0) + return 1; + + CORBA::Object_var object = + orb->string_to_object (ior ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + Simple_Server_var server = + Simple_Server::_narrow (object.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (server.in ())) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Object reference <%s> is nil\n", + ior), + 1); + } + + if (enable_dynamic_scheduling) + { + ACE_DEBUG ((LM_DEBUG, "Dyn Sched enabled\n")); + CORBA::Object_ptr manager_obj = + orb->resolve_initial_references ("RTSchedulerManager" + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + TAO_RTScheduler_Manager_var manager = + TAO_RTScheduler_Manager::_narrow (manager_obj + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + Kokyu::DSRT_Dispatcher_Impl_t disp_impl_type; + if (enable_yield) + { + disp_impl_type = Kokyu::DSRT_CV_BASED; + } + else + { + disp_impl_type = Kokyu::DSRT_OS_BASED; + } + + ACE_NEW_RETURN (scheduler, + Fixed_Priority_Scheduler (orb.in (), + disp_impl_type, + sched_policy, + sched_scope), -1); + + manager->rtscheduler (scheduler); + + CORBA::Object_var object = + orb->resolve_initial_references ("RTScheduler_Current" + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + current = + RTScheduling::Current::_narrow (object.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + } + + Worker worker1 (orb.in (), + server.in (), + current.in (), + scheduler, 10, 15); + + if (worker1.activate (flags, 1, 0, max_prio) != 0) + { + ACE_ERROR ((LM_ERROR, + "(%t|%T) cannot activate worker thread.\n")); + } + + ACE_OS::sleep(2); + + Worker worker2 (orb.in (), + server.in (), + current.in (), + scheduler, 12, 5); + + if (worker2.activate (flags, 1, 0, max_prio) != 0) + { + ACE_ERROR ((LM_ERROR, + "(%t|%T) cannot activate scheduler thread in RT mode.\n")); + } + + worker1.wait (); + worker2.wait (); + + ACE_DEBUG ((LM_DEBUG, + "(%t): wait for worker threads done in main thread\n")); + + if (do_shutdown) + { + if (enable_dynamic_scheduling) + { + FP_Scheduling::SegmentSchedulingParameter sched_param; + sched_param.base_priority = 0; + CORBA::Policy_var sched_param_policy + = scheduler->create_segment_scheduling_parameter (sched_param); + CORBA::Policy_ptr implicit_sched_param = 0; + current->begin_scheduling_segment (0, + sched_param_policy.in (), + implicit_sched_param + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + + ACE_DEBUG ((LM_DEBUG, "(%t): about to call server shutdown\n")); + server->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_DEBUG ((LM_DEBUG, "after shutdown call in main thread\n")); + + + if (enable_dynamic_scheduling) + { + current->end_scheduling_segment (0 + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + } + + scheduler->shutdown (); + ACE_DEBUG ((LM_DEBUG, "scheduler shutdown done\n")); + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Exception caught:"); + return 1; + } + ACE_ENDTRY; + + return 0; +} + +// **************************************************************** + +Worker::Worker (CORBA::ORB_ptr orb, + Simple_Server_ptr server_ptr, + RTScheduling::Current_ptr current, + Fixed_Priority_Scheduler* scheduler, + RTCORBA::Priority prio, + CORBA::Long server_load) + // int sleep_time) + : orb_ (CORBA::ORB::_duplicate (orb)), + server_ (Simple_Server::_duplicate (server_ptr)), + scheduler_current_ (RTScheduling::Current::_duplicate (current)), + scheduler_ (scheduler), + prio_ (prio), + server_load_ (server_load) + // sleep_time_ (sleep_time) +{ +} + +int +Worker::svc (void) +{ + ACE_DECLARE_NEW_CORBA_ENV; + const char * name = 0; + /* + ACE_DEBUG ((LM_DEBUG, "(%t|%T):about to sleep for %d sec\n", sleep_time_)); + ACE_OS::sleep (sleep_time_); + ACE_DEBUG ((LM_DEBUG, "(%t|%T):woke up from sleep for %d sec\n", sleep_time_)); + */ + ACE_hthread_t thr_handle; + ACE_Thread::self (thr_handle); + int prio; + + if (ACE_Thread::getprio (thr_handle, prio) == -1) + { + if (errno == ENOTSUP) + { + ACE_ERROR((LM_ERROR, + ACE_TEXT ("getprio not supported\n") + )); + } + else + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n") + ACE_TEXT ("thr_getprio failed"))); + } + } + + ACE_DEBUG ((LM_DEBUG, "(%t|%T) worker activated with prio %d\n", prio)); + + if (enable_dynamic_scheduling) + { + FP_Scheduling::SegmentSchedulingParameter sched_param; + sched_param.base_priority = prio_; + CORBA::Policy_var sched_param_policy + = scheduler_->create_segment_scheduling_parameter (sched_param); + + CORBA::Policy_ptr implicit_sched_param = 0; + ACE_DEBUG ((LM_DEBUG, "(%t|%T):before begin_sched_segment\n")); + scheduler_current_->begin_scheduling_segment (name, + sched_param_policy.in (), + implicit_sched_param + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + ACE_DEBUG ((LM_DEBUG, "(%t|%T):after begin_sched_segment\n")); + } + + ACE_DEBUG ((LM_DEBUG, "(%t|%T):about to make two way call\n")); + server_->test_method (server_load_ ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + ACE_DEBUG ((LM_DEBUG, "(%t|%T):two way call done\n")); + + if (enable_dynamic_scheduling) + { + scheduler_current_->end_scheduling_segment (name); + ACE_CHECK_RETURN (-1); + } + + ACE_DEBUG ((LM_DEBUG, "client worker thread (%t) done\n")); + + return 0; +} diff --git a/TAO/examples/Kokyu_dsrt_schedulers/fp_example/fp_client.dsp b/TAO/examples/Kokyu_dsrt_schedulers/fp_example/fp_client.dsp new file mode 100644 index 00000000000..81eccf3070b --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/fp_example/fp_client.dsp @@ -0,0 +1,180 @@ +# Microsoft Developer Studio Project File - Name="fp_client" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=fp_client - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE run the tool that generated this project file and specify the
+!MESSAGE nmake output type. You can then use the following command:
+!MESSAGE
+!MESSAGE NMAKE /f "fp_client.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "fp_client.mak" CFG="fp_client - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "fp_client - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "fp_client - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "fp_client - Win32 Release"
+
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release\fp_client"
+# PROP Target_Dir ""
+# ADD CPP /nologo /O2 /W3 /GX /MD /GR /I "..\..\..\tao\RTScheduling" /I "..\..\..\tao\RTCORBA" /I "..\..\..\..\Kokyu" /I "..\..\..\examples\Kokyu_dsrt_schedulers" /I "..\..\.." /I "..\..\..\tao" /I "..\..\..\.." /D NDEBUG /D WIN32 /D _CONSOLE /FD /c
+# SUBTRACT CPP /YX
+# ADD RSC /l 0x409 /d NDEBUG /i "..\..\..\tao\RTScheduling" /i "..\..\..\tao\RTCORBA" /i "..\..\..\..\Kokyu" /i "..\..\..\examples\Kokyu_dsrt_schedulers" /i "..\..\.." /i "..\..\..\tao" /i "..\..\..\.."
+BSC32=bscmake.exe
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD LINK32 advapi32.lib user32.lib /INCREMENTAL:NO TAO_RTScheduler.lib Kokyu.lib Kokyu_DSRT_Schedulers.lib TAO_RTCORBA.lib TAO.lib ACE.lib /libpath:"..\..\..\examples\Kokyu_dsrt_schedulers" /libpath:"..\..\..\tao\RTScheduling" /libpath:"..\..\..\tao\RTCORBA" /libpath:"..\..\..\..\Kokyu" /libpath:"..\..\..\tao" /libpath:"..\..\..\..\ace" /libpath:"..\..\..\..\lib" /nologo /version:1.3.4 /subsystem:console /pdb:"Release\client.pdb" /machine:I386 /out:"Release\client.exe"
+
+!ELSEIF "$(CFG)" == "fp_client - Win32 Debug"
+
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "."
+# PROP Intermediate_Dir "Debug\fp_client"
+# PROP Target_Dir ""
+# ADD CPP /nologo /Ob0 /W3 /Gm /GX /Zi /MDd /GR /Gy /I "..\..\..\tao\RTScheduling" /I "..\..\..\tao\RTCORBA" /I "..\..\..\..\Kokyu" /I "..\..\..\examples\Kokyu_dsrt_schedulers" /I "..\..\.." /I "..\..\..\tao" /I "..\..\..\.." /D _DEBUG /D WIN32 /D _CONSOLE /FD /c
+# SUBTRACT CPP /YX
+# ADD RSC /l 0x409 /d _DEBUG /i "..\..\..\tao\RTScheduling" /i "..\..\..\tao\RTCORBA" /i "..\..\..\..\Kokyu" /i "..\..\..\examples\Kokyu_dsrt_schedulers" /i "..\..\.." /i "..\..\..\tao" /i "..\..\..\.."
+BSC32=bscmake.exe
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD LINK32 advapi32.lib user32.lib /INCREMENTAL:NO TAO_RTSchedulerd.lib Kokyud.lib Kokyu_DSRT_Schedulersd.lib TAO_RTCORBAd.lib TAOd.lib ACEd.lib /libpath:"..\..\..\examples\Kokyu_dsrt_schedulers" /libpath:"..\..\..\tao\RTScheduling" /libpath:"..\..\..\tao\RTCORBA" /libpath:"..\..\..\..\Kokyu" /libpath:"..\..\..\tao" /libpath:"..\..\..\..\ace" /libpath:"..\..\..\..\lib" /nologo /version:1.3.4 /subsystem:console /pdb:".\client.pdb" /debug /machine:I386 /out:".\client.exe"
+
+!ENDIF
+
+# Begin Target
+
+# Name "fp_client - Win32 Release"
+# Name "fp_client - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;cxx;c"
+# Begin Source File
+
+SOURCE=".\client.cpp"
+# End Source File
+# Begin Source File
+
+SOURCE=".\testC.cpp"
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hh"
+# Begin Source File
+
+SOURCE=".\testC.h"
+# End Source File
+# End Group
+# Begin Group "Inline Files"
+
+# PROP Default_Filter "i;inl"
+# Begin Source File
+
+SOURCE=".\testC.i"
+# End Source File
+# End Group
+# Begin Group "Documentation"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=".\README"
+# End Source File
+# End Group
+# Begin Group "IDL Files"
+
+# PROP Default_Filter "idl"
+# Begin Source File
+
+SOURCE=".\test.idl"
+
+!IF "$(CFG)" == "fp_client - Win32 Release"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking IDL Compiler on $(InputPath)
+InputPath=.\test.idl
+InputName=test
+InputDir=.
+
+BuildCmds= \
+ PATH=%PATH%;..\..\..\..\lib \
+ ..\..\..\..\bin\tao_idl -o . -Ge 1 -Sc -Wb,pre_include=ace\pre.h -Wb,post_include=ace\post.h $(InputPath)
+
+".\$(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)
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "fp_client - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking IDL Compiler on $(InputPath)
+InputPath=.\test.idl
+InputName=test
+InputDir=.
+
+BuildCmds= \
+ PATH=%PATH%;..\..\..\..\lib \
+ ..\..\..\..\bin\tao_idl -o . -Ge 1 -Sc -Wb,pre_include=ace\pre.h -Wb,post_include=ace\post.h $(InputPath)
+
+".\$(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)
+
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/examples/Kokyu_dsrt_schedulers/fp_example/fp_example.dsw b/TAO/examples/Kokyu_dsrt_schedulers/fp_example/fp_example.dsw new file mode 100644 index 00000000000..91f13256dde --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/fp_example/fp_example.dsw @@ -0,0 +1,41 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "fp_server"=fp_server.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "fp_client"=fp_client.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/TAO/examples/Kokyu_dsrt_schedulers/fp_example/fp_example.mpc b/TAO/examples/Kokyu_dsrt_schedulers/fp_example/fp_example.mpc new file mode 100644 index 00000000000..fec3cea3337 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/fp_example/fp_example.mpc @@ -0,0 +1,46 @@ +project(fp_server): taoserver { + + includes += $(TAO_ROOT) \ + $(TAO_ROOT)/tao/RTScheduling \ + $(TAO_ROOT)/tao/RTCORBA \ + $(ACE_ROOT)/Kokyu \ + $(TAO_ROOT)/examples/Kokyu_dsrt_schedulers + + libs += TAO_RTScheduler Kokyu Kokyu_DSRT_Schedulers TAO_RTCORBA + libpaths += $(TAO_ROOT)/examples/Kokyu_dsrt_schedulers \ + $(TAO_ROOT)/tao/RTScheduling \ + $(TAO_ROOT)/tao/RTCORBA \ + $(TAO_ROOT)/tao/PortableServer \ + $(TAO_ROOT)/tao/IORInterceptor \ + $(TAO_ROOT)/tao/Valuetype \ + $(TAO_ROOT)/tao/ObjRefTemplate \ + $(ACE_ROOT)/Kokyu \ + $(TAO_ROOT)/tao \ + $(ACE_ROOT)/ace + + Source_Files { + test_i.cpp + server.cpp + } +} + +project(fp_client): taoclient { + + includes += $(TAO_ROOT)/tao/RTScheduling \ + $(TAO_ROOT)/tao/RTCORBA \ + $(ACE_ROOT)/Kokyu \ + $(TAO_ROOT)/examples/Kokyu_dsrt_schedulers + libs += TAO_RTScheduler Kokyu Kokyu_DSRT_Schedulers TAO_RTCORBA + libpaths += $(TAO_ROOT)/examples/Kokyu_dsrt_schedulers \ + $(TAO_ROOT)/tao/RTScheduling \ + $(TAO_ROOT)/tao/RTCORBA \ + $(ACE_ROOT)/Kokyu \ + $(TAO_ROOT)/tao \ + $(ACE_ROOT)/ace + + Source_Files { + testC.cpp + client.cpp + } +} + diff --git a/TAO/examples/Kokyu_dsrt_schedulers/fp_example/fp_server.dsp b/TAO/examples/Kokyu_dsrt_schedulers/fp_example/fp_server.dsp new file mode 100644 index 00000000000..86a5f0eb13f --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/fp_example/fp_server.dsp @@ -0,0 +1,204 @@ +# Microsoft Developer Studio Project File - Name="fp_server" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=fp_server - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE run the tool that generated this project file and specify the
+!MESSAGE nmake output type. You can then use the following command:
+!MESSAGE
+!MESSAGE NMAKE /f "fp_server.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "fp_server.mak" CFG="fp_server - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "fp_server - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "fp_server - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "fp_server - Win32 Release"
+
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release\fp_server"
+# PROP Target_Dir ""
+# ADD CPP /nologo /O2 /W3 /GX /MD /GR /I "..\..\..\tao\RTScheduling" /I "..\..\..\tao\RTCORBA" /I "..\..\..\..\Kokyu" /I "..\..\..\examples\Kokyu_dsrt_schedulers" /I "..\..\.." /I "..\..\..\tao" /I "..\..\..\.." /D NDEBUG /D WIN32 /D _CONSOLE /FD /c
+# SUBTRACT CPP /YX
+# ADD RSC /l 0x409 /d NDEBUG /i "..\..\..\tao\RTScheduling" /i "..\..\..\tao\RTCORBA" /i "..\..\..\..\Kokyu" /i "..\..\..\examples\Kokyu_dsrt_schedulers" /i "..\..\.." /i "..\..\..\tao" /i "..\..\..\.."
+BSC32=bscmake.exe
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD LINK32 advapi32.lib user32.lib /INCREMENTAL:NO TAO_RTScheduler.lib Kokyu.lib Kokyu_DSRT_Schedulers.lib TAO_RTCORBA.lib TAO_PortableServer.lib TAO_IORInterceptor.lib TAO_Valuetype.lib TAO_ObjRefTemplate.lib TAO.lib ACE.lib /libpath:"..\..\..\examples\Kokyu_dsrt_schedulers" /libpath:"..\..\..\tao\RTScheduling" /libpath:"..\..\..\tao\RTCORBA" /libpath:"..\..\..\tao\PortableServer" /libpath:"..\..\..\tao\IORInterceptor" /libpath:"..\..\..\tao\Valuetype" /libpath:"..\..\..\tao\ObjRefTemplate" /libpath:"..\..\..\..\Kokyu" /libpath:"..\..\..\tao" /libpath:"..\..\..\..\ace" /libpath:"..\..\..\..\lib" /nologo /version:1.3.4 /subsystem:console /pdb:"Release\server.pdb" /machine:I386 /out:"Release\server.exe"
+
+!ELSEIF "$(CFG)" == "fp_server - Win32 Debug"
+
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "."
+# PROP Intermediate_Dir "Debug\fp_server"
+# PROP Target_Dir ""
+# ADD CPP /nologo /Ob0 /W3 /Gm /GX /Zi /MDd /GR /Gy /I "..\..\..\tao\RTScheduling" /I "..\..\..\tao\RTCORBA" /I "..\..\..\..\Kokyu" /I "..\..\..\examples\Kokyu_dsrt_schedulers" /I "..\..\.." /I "..\..\..\tao" /I "..\..\..\.." /D _DEBUG /D WIN32 /D _CONSOLE /FD /c
+# SUBTRACT CPP /YX
+# ADD RSC /l 0x409 /d _DEBUG /i "..\..\..\tao\RTScheduling" /i "..\..\..\tao\RTCORBA" /i "..\..\..\..\Kokyu" /i "..\..\..\examples\Kokyu_dsrt_schedulers" /i "..\..\.." /i "..\..\..\tao" /i "..\..\..\.."
+BSC32=bscmake.exe
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD LINK32 advapi32.lib user32.lib /INCREMENTAL:NO TAO_RTSchedulerd.lib Kokyud.lib Kokyu_DSRT_Schedulersd.lib TAO_RTCORBAd.lib TAO_PortableServerd.lib TAO_IORInterceptord.lib TAO_Valuetyped.lib TAO_ObjRefTemplated.lib TAOd.lib ACEd.lib /libpath:"..\..\..\examples\Kokyu_dsrt_schedulers" /libpath:"..\..\..\tao\RTScheduling" /libpath:"..\..\..\tao\RTCORBA" /libpath:"..\..\..\tao\PortableServer" /libpath:"..\..\..\tao\IORInterceptor" /libpath:"..\..\..\tao\Valuetype" /libpath:"..\..\..\tao\ObjRefTemplate" /libpath:"..\..\..\..\Kokyu" /libpath:"..\..\..\tao" /libpath:"..\..\..\..\ace" /libpath:"..\..\..\..\lib" /nologo /version:1.3.4 /subsystem:console /pdb:".\server.pdb" /debug /machine:I386 /out:".\server.exe"
+
+!ENDIF
+
+# Begin Target
+
+# Name "fp_server - Win32 Release"
+# Name "fp_server - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;cxx;c"
+# Begin Source File
+
+SOURCE=".\server.cpp"
+# End Source File
+# Begin Source File
+
+SOURCE=".\test_i.cpp"
+# End Source File
+# Begin Source File
+
+SOURCE=".\testC.cpp"
+# End Source File
+# Begin Source File
+
+SOURCE=".\testS.cpp"
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hh"
+# Begin Source File
+
+SOURCE=".\test_i.h"
+# End Source File
+# Begin Source File
+
+SOURCE=".\testC.h"
+# End Source File
+# Begin Source File
+
+SOURCE=".\testS.h"
+# End Source File
+# End Group
+# Begin Group "Inline Files"
+
+# PROP Default_Filter "i;inl"
+# Begin Source File
+
+SOURCE=".\test_i.i"
+# End Source File
+# Begin Source File
+
+SOURCE=".\testC.i"
+# End Source File
+# Begin Source File
+
+SOURCE=".\testS.i"
+# End Source File
+# End Group
+# Begin Group "Documentation"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=".\README"
+# End Source File
+# End Group
+# Begin Group "IDL Files"
+
+# PROP Default_Filter "idl"
+# Begin Source File
+
+SOURCE=".\test.idl"
+
+!IF "$(CFG)" == "fp_server - Win32 Release"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking IDL Compiler on $(InputPath)
+InputPath=.\test.idl
+InputName=test
+InputDir=.
+
+BuildCmds= \
+ PATH=%PATH%;..\..\..\..\lib \
+ ..\..\..\..\bin\tao_idl -o . -Gv -Ge 1 -Sc -Wb,pre_include=ace\pre.h -Wb,post_include=ace\post.h $(InputPath)
+
+".\$(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)
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "fp_server - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking IDL Compiler on $(InputPath)
+InputPath=.\test.idl
+InputName=test
+InputDir=.
+
+BuildCmds= \
+ PATH=%PATH%;..\..\..\..\lib \
+ ..\..\..\..\bin\tao_idl -o . -Gv -Ge 1 -Sc -Wb,pre_include=ace\pre.h -Wb,post_include=ace\post.h $(InputPath)
+
+".\$(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)
+
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/examples/Kokyu_dsrt_schedulers/fp_example/server.cpp b/TAO/examples/Kokyu_dsrt_schedulers/fp_example/server.cpp new file mode 100644 index 00000000000..839dcd2c9cf --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/fp_example/server.cpp @@ -0,0 +1,261 @@ +// $Id$ + +#include "test_i.h" +#include "ace/Get_Opt.h" +#include "ace/Task.h" +#include "ace/High_Res_Timer.h" +#include "tao/RTScheduling/RTScheduler_Manager.h" +#include "FP_Scheduler.h" +#include "Task_Stats.h" + +ACE_RCSID(MT_Server, server, "$Id$") + +const char *ior_output_file = "test.ior"; + +int nthreads = 2; +int enable_dynamic_scheduling = 0; +const CORBA::Short max_importance = 100; +int enable_yield = 1; + +int +parse_args (int argc, char *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, "o:n:ds"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + + case 'n': + nthreads = ACE_OS::atoi (get_opts.opt_arg ()); + break; + + case 'd': + enable_dynamic_scheduling = 1; + break; + + case 's': + enable_yield = 0; + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-o <iorfile>" + "-d (enable dynamic scheduling)" + "-s (disable yield)" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +class Worker : public ACE_Task_Base +{ + // = TITLE + // Run a server thread + // + // = DESCRIPTION + // Use the ACE_Task_Base class to run server threads + // +public: + Worker (CORBA::ORB_ptr orb); + // ctor + + virtual int svc (void); + // The thread entry point. + +private: + CORBA::ORB_var orb_; + // The orb +}; + +Task_Stats task_stats; + +int +main (int argc, char *argv[]) +{ + Fixed_Priority_Scheduler* scheduler=0; + RTScheduling::Current_var current; + long flags; + int sched_policy = ACE_SCHED_RR; + int sched_scope = ACE_SCOPE_THREAD; + + if (sched_policy == ACE_SCHED_RR) + flags = THR_NEW_LWP | THR_BOUND | THR_JOINABLE | THR_SCHED_RR; + else + flags = THR_NEW_LWP | THR_BOUND | THR_JOINABLE | THR_SCHED_FIFO; + + task_stats.init (100000); + + ACE_TRY_NEW_ENV + { + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + CORBA::Object_var poa_object = + orb->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (poa_object.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Unable to initialize the POA.\n"), + 1); + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (parse_args (argc, argv) != 0) + return 1; + + if (enable_dynamic_scheduling) + { + CORBA::Object_ptr manager_obj = + orb->resolve_initial_references ("RTSchedulerManager" + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + TAO_RTScheduler_Manager_var manager = + TAO_RTScheduler_Manager::_narrow (manager_obj + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + Kokyu::DSRT_Dispatcher_Impl_t disp_impl_type; + if (enable_yield) + { + disp_impl_type = Kokyu::DSRT_CV_BASED; + } + else + { + disp_impl_type = Kokyu::DSRT_OS_BASED; + } + + ACE_NEW_RETURN (scheduler, + Fixed_Priority_Scheduler (orb.in (), + disp_impl_type, + sched_policy, + sched_scope), -1); + + manager->rtscheduler (scheduler); + + CORBA::Object_var object = + orb->resolve_initial_references ("RTScheduler_Current" + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + current = + RTScheduling::Current::_narrow (object.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + + Simple_Server_i server_impl (orb.in (), + current.in (), + task_stats, + enable_yield); + + Simple_Server_var server = + server_impl._this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + CORBA::String_var ior = + orb->object_to_string (server.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_DEBUG ((LM_DEBUG, "Activated as <%s>\n", ior.in ())); + + // If the ior_output_file exists, output the ior to it + if (ior_output_file != 0) + { + FILE *output_file= ACE_OS::fopen (ior_output_file, "w"); + if (output_file == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Cannot open output file for writing IOR: %s", + ior_output_file), + 1); + ACE_OS::fprintf (output_file, "%s", ior.in ()); + ACE_OS::fclose (output_file); + } + + poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + Worker worker (orb.in ()); + if (worker.activate (flags, + nthreads, + 0, + ACE_Sched_Params::priority_max(sched_policy, + sched_scope)) != 0) + { + ACE_ERROR ((LM_ERROR, + "Cannot activate threads in RT class.", + "Trying to activate in non-RT class\n")); + + flags = THR_NEW_LWP | THR_JOINABLE | THR_BOUND; + if (worker.activate (flags, nthreads) != 0) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Cannot activate server threads\n"), + 1); + } + } + + worker.wait (); + + ACE_DEBUG ((LM_DEBUG, "event loop finished\n")); + + ACE_DEBUG ((LM_DEBUG, "shutting down scheduler\n")); + scheduler->shutdown (); + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Exception caught:"); + return 1; + } + ACE_ENDTRY; + + ACE_DEBUG ((LM_DEBUG, "Exiting main...\n")); + task_stats.dump_samples ("timeline.txt", + "Time\t\tGUID", + ACE_High_Res_Timer::global_scale_factor ()); + return 0; +} + +// **************************************************************** + +Worker::Worker (CORBA::ORB_ptr orb) + : orb_ (CORBA::ORB::_duplicate (orb)) +{ +} + +int +Worker::svc (void) +{ + ACE_DECLARE_NEW_CORBA_ENV; + ACE_Time_Value tv(120); + + ACE_TRY + { + this->orb_->run (tv ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + } + ACE_ENDTRY; + ACE_DEBUG ((LM_DEBUG, "(%t|%T): Worker thread exiting...\n")); + return 0; +} diff --git a/TAO/examples/Kokyu_dsrt_schedulers/fp_example/test.idl b/TAO/examples/Kokyu_dsrt_schedulers/fp_example/test.idl new file mode 100644 index 00000000000..deed5409437 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/fp_example/test.idl @@ -0,0 +1,10 @@ +// +// $Id$ +// + +interface Simple_Server +{ + long test_method (in long x); + + void shutdown (); +}; diff --git a/TAO/examples/Kokyu_dsrt_schedulers/fp_example/test_i.cpp b/TAO/examples/Kokyu_dsrt_schedulers/fp_example/test_i.cpp new file mode 100644 index 00000000000..704cb646f3f --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/fp_example/test_i.cpp @@ -0,0 +1,129 @@ +// $Id$ + +#include "test_i.h" +#include "ace/High_Res_Timer.h" +#include "ace/Task.h" +#include "ace/ACE.h" +#include "tao/debug.h" + +#if !defined(__ACE_INLINE__) +#include "test_i.i" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(MT_Server, test_i, "$Id$") + +CORBA::Long +Simple_Server_i::test_method (CORBA::Long exec_duration ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_hthread_t thr_handle; + ACE_Thread::self (thr_handle); + int prio; + int guid; + + ACE_OS:: + memcpy (&guid, + this->current_->id (ACE_ENV_SINGLE_ARG_PARAMETER)->get_buffer (), + sizeof (this->current_->id (ACE_ENV_SINGLE_ARG_PARAMETER)->length ())); + + ACE_High_Res_Timer timer; + ACE_Time_Value elapsed_time; + + ACE_DEBUG ((LM_DEBUG, "Request in thread %t\n")); + + if (ACE_Thread::getprio (thr_handle, prio) == -1) + { + if (errno == ENOTSUP) + { + ACE_DEBUG((LM_DEBUG, + ACE_TEXT ("getprio not supported on this platform\n") + )); + return 0; + } + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("getprio failed")), + -1); + } + + ACE_DEBUG ((LM_DEBUG, + "Request in thread %t, prio = %d," + "exec duration = %u\n", prio, exec_duration)); + + static CORBA::ULong prime_number = 9619899; + + ACE_Time_Value compute_count_down_time (exec_duration, 0); + ACE_Countdown_Time compute_count_down (&compute_count_down_time); + + //Applicable only for CV based implementations + //yield every 1 sec + ACE_Time_Value yield_interval (1,0); + + ACE_Time_Value yield_count_down_time (yield_interval); + ACE_Countdown_Time yield_count_down (&yield_count_down_time); + + timer.start (); + int j=0; + while (compute_count_down_time > ACE_Time_Value::zero) + { + ACE::is_prime (prime_number, + 2, + prime_number / 2); + + ++j; + +#ifdef KOKYU_DSRT_LOGGING + if (j%1000 == 0) + { + ACE_DEBUG ((LM_DEBUG, + "(%t|%T) loop # = %d, load = %usec\n", j, exec_duration)); + } +#endif + if (j%1000 == 0) + { + ACE_Time_Value run_time = ACE_OS::gettimeofday (); + task_stats_.sample (ACE_UINT64 (run_time.msec ()), guid); + } + + compute_count_down.update (); + + if (enable_yield_) + { + yield_count_down.update (); + if (yield_count_down_time <= ACE_Time_Value::zero) + { + CORBA::Policy_var sched_param_policy = + CORBA::Policy::_duplicate (current_-> + scheduling_parameter(ACE_ENV_SINGLE_ARG_PARAMETER)); + + const char * name = 0; + + CORBA::Policy_ptr implicit_sched_param = 0; + current_->update_scheduling_segment (name, + sched_param_policy.in (), + implicit_sched_param + ACE_ENV_ARG_PARAMETER); + yield_count_down_time = yield_interval; + yield_count_down.start (); + } + } + } + + timer.stop (); + timer.elapsed_time (elapsed_time); + + ACE_DEBUG ((LM_DEBUG, + "Request processing in thread %t done, " + "prio = %d, load = %d, elapsed time = %umsec\n", + prio, exec_duration, elapsed_time.msec () )); + + return exec_duration; +} + +void +Simple_Server_i::shutdown (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_DEBUG ((LM_DEBUG, "shutdown request from client\n")); + this->orb_->shutdown (0 ACE_ENV_ARG_PARAMETER); +} diff --git a/TAO/examples/Kokyu_dsrt_schedulers/fp_example/test_i.h b/TAO/examples/Kokyu_dsrt_schedulers/fp_example/test_i.h new file mode 100644 index 00000000000..76a77f98c35 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/fp_example/test_i.h @@ -0,0 +1,57 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO/tests/MT_Server +// +// = FILENAME +// test_i.h +// +// = AUTHOR +// Carlos O'Ryan +// +// ============================================================================ + +#ifndef TAO_MT_SERVER_TEST_I_H +#define TAO_MT_SERVER_TEST_I_H + +#include "testS.h" +#include "tao/RTScheduling/RTScheduler_Manager.h" +#include "Task_Stats.h" + +class Simple_Server_i : public POA_Simple_Server +{ + // = TITLE + // Simpler Server implementation + // + // = DESCRIPTION + // Implements the Simple_Server interface in test.idl + // +public: + Simple_Server_i (CORBA::ORB_ptr orb, + RTScheduling::Current_ptr current, + Task_Stats&, + int); + // ctor + + // = The Simple_Server methods. + CORBA::Long test_method (CORBA::Long x ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void shutdown (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)); + +private: + CORBA::ORB_var orb_; + RTScheduling::Current_var current_; + Task_Stats& task_stats_; + int enable_yield_; + // The ORB +}; + +#if defined(__ACE_INLINE__) +#include "test_i.i" +#endif /* __ACE_INLINE__ */ + +#endif /* TAO_MT_SERVER_TEST_I_H */ diff --git a/TAO/examples/Kokyu_dsrt_schedulers/fp_example/test_i.i b/TAO/examples/Kokyu_dsrt_schedulers/fp_example/test_i.i new file mode 100644 index 00000000000..5ce482af7aa --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/fp_example/test_i.i @@ -0,0 +1,13 @@ +// $Id$ + +ACE_INLINE +Simple_Server_i::Simple_Server_i (CORBA::ORB_ptr orb, + RTScheduling::Current_ptr current, + Task_Stats& task_stats, + int enable_yield) + : orb_ (CORBA::ORB::_duplicate (orb)), + current_ (RTScheduling::Current::_duplicate (current)), + task_stats_ (task_stats), + enable_yield_ (enable_yield) +{ +} diff --git a/TAO/examples/Kokyu_dsrt_schedulers/mif_example/Makefile b/TAO/examples/Kokyu_dsrt_schedulers/mif_example/Makefile new file mode 100644 index 00000000000..73187c602fe --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/mif_example/Makefile @@ -0,0 +1,57 @@ +#---------------------------------------------------------------------------- +# GNU ACE Workspace +# +# @file Makefile +# +# $Id$ +# +# This file was automatically generated by MPC. Any changes made directly to +# this file will be lost the next time it is generated. +# +#---------------------------------------------------------------------------- + + +MAKE_OPTIONS=$(shell echo $(MAKEFLAGS) | sed 's/--unix *//; s/ .*//') +ifeq ($(findstring k,$(MAKE_OPTIONS)),k) + KEEP_GOING = 1 +else + KEEP_GOING = 0 +endif + +%.tgt0: +ifeq ($(KEEP_GOING),1) + -@$(MAKE) -f Makefile.mif_server -C . $(*); +else + @$(MAKE) -f Makefile.mif_server -C . $(*); +endif +%.tgt1: +ifeq ($(KEEP_GOING),1) + -@$(MAKE) -f Makefile.mif_client -C . $(*); +else + @$(MAKE) -f Makefile.mif_client -C . $(*); +endif + + +all: all.tgt0 all.tgt1 + +debug: debug.tgt0 debug.tgt1 + +profile: profile.tgt0 profile.tgt1 + +optimize: optimize.tgt0 optimize.tgt1 + +install: install.tgt0 install.tgt1 + +deinstall: deinstall.tgt0 deinstall.tgt1 + +clean: clean.tgt0 clean.tgt1 + +realclean: realclean.tgt0 realclean.tgt1 + +clobber: clobber.tgt0 clobber.tgt1 + +depend: depend.tgt0 depend.tgt1 + +rcs_info: rcs_info.tgt0 rcs_info.tgt1 + +idl_stubs: idl_stubs.tgt0 idl_stubs.tgt1 diff --git a/TAO/examples/Kokyu_dsrt_schedulers/mif_example/Makefile.mif_client b/TAO/examples/Kokyu_dsrt_schedulers/mif_example/Makefile.mif_client new file mode 100644 index 00000000000..8d35cbdd4f2 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/mif_example/Makefile.mif_client @@ -0,0 +1,105 @@ +#---------------------------------------------------------------------------- +# GNU Makefile +# +# @file Makefile.mif_client +# +# $Id$ +# +# This file was automatically generated by MPC. Any changes made directly to +# this file will be lost the next time it is generated. +# +#---------------------------------------------------------------------------- +MAKEFILE = Makefile.mif_client +DEPENDENCY_FILE = .depend.Makefile.mif_client +BIN_UNCHECKED = client + +ifndef TAO_ROOT + TAO_ROOT = $(ACE_ROOT)/TAO +endif +ifndef CIAO_ROOT + CIAO_ROOT = $(TAO_ROOT)/CIAO +endif + +TAO_IDL = ../../../../bin/tao_idl +IDL_FILES = test +IDL_SRC = $(foreach ext, C.cpp S.cpp, $(foreach file, $(IDL_FILES), $(file)$(ext))) + +FILES = \ + testC \ + client + +#---------------------------------------------------------------------------- +# Include macros and targets +#---------------------------------------------------------------------------- +LDLIBS = -lTAO_RTScheduler -lKokyu -lKokyu_DSRT_Schedulers -lTAO_RTCORBA -lTAO -lACE +include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU +## We don't need the ACELIB setting from wrapper_macros.GNU +ACELIB = +include $(TAO_ROOT)/rules.tao.GNU + +# To build multiple executables in the same directory on AIX, it works +# best to have a template directory per project. +# The compiler/linker isn't too smart about instantiating templates... +ifdef TEMPINCDIR +TEMPINCDIR := $(TEMPINCDIR)/mif_client + +all: $(TEMPINCDIR) + +$(TEMPINCDIR): + @-test -d $(TEMPINCDIR) || mkdir -p $(TEMPINCDIR) $(ACE_NUL_STDERR) + +endif + +BIN = $(BIN_UNCHECKED) + +OBJS = $(addsuffix .o, $(notdir $(FILES))) +SRC = $(addsuffix .cpp, $(FILES)) + +ifneq ($(BIN),) +all: idl_stubs +testC.cpp client.cpp: idl_stubs +endif + +include $(ACE_ROOT)/include/makeinclude/macros.GNU +include $(ACE_ROOT)/include/makeinclude/rules.common.GNU +include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU + +include $(ACE_ROOT)/include/makeinclude/rules.local.GNU +include $(TAO_ROOT)/taoconfig.mk + +CPPFLAGS += -I../../../tao/RTScheduling -I../../../tao/RTCORBA -I../../../../Kokyu -I../../../examples/Kokyu_dsrt_schedulers -I../../.. -I../../../tao -I../../../.. +ifeq ($(static_libs),1) + ifneq ($(LIB),) + CPPFLAGS += -DTAO_AS_STATIC_LIBS -DACE_AS_STATIC_LIBS + endif +endif + + +LDFLAGS += -L../../../examples/Kokyu_dsrt_schedulers -L../../../tao/RTScheduling -L../../../tao/RTCORBA -L../../../../Kokyu -L../../../tao -L../../../../ace -L../../../../lib + +TAO_IDLFLAGS += -Ge 1 -Sc -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h +#---------------------------------------------------------------------------- +# Local targets +#---------------------------------------------------------------------------- +.: + -@mkdir -p "." + + +ADDITIONAL_IDL_TARGETS = +# IDL File Directory: . + +ifneq ($(ADDITIONAL_IDL_TARGETS),) +idl_stubs: $(ADDITIONAL_IDL_TARGETS) +endif + +.PRECIOUS: $(foreach ext, $(IDL_EXT), $(foreach file, $(IDL_FILES), $(file)$(ext))) + +$(BIN): $(addprefix $(VDIR), $(OBJS)) + $(LINK.cc) $(LDFLAGS) $(CC_OUTPUT_FLAG) $@ $^ $(VLDLIBS) $(POSTLINK) + +realclean: clean + -$(RM) $(foreach ext, $(IDL_EXT), $(foreach file, $(IDL_FILES), $(file)$(ext))) +ifneq ($(GENERATED_DIRTY),) + -$(RM) -r $(GENERATED_DIRTY) +endif + diff --git a/TAO/examples/Kokyu_dsrt_schedulers/mif_example/Makefile.mif_server b/TAO/examples/Kokyu_dsrt_schedulers/mif_example/Makefile.mif_server new file mode 100644 index 00000000000..c763a57232f --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/mif_example/Makefile.mif_server @@ -0,0 +1,107 @@ +#---------------------------------------------------------------------------- +# GNU Makefile +# +# @file Makefile.mif_server +# +# $Id$ +# +# This file was automatically generated by MPC. Any changes made directly to +# this file will be lost the next time it is generated. +# +#---------------------------------------------------------------------------- +MAKEFILE = Makefile.mif_server +DEPENDENCY_FILE = .depend.Makefile.mif_server +BIN_UNCHECKED = server + +ifndef TAO_ROOT + TAO_ROOT = $(ACE_ROOT)/TAO +endif +ifndef CIAO_ROOT + CIAO_ROOT = $(TAO_ROOT)/CIAO +endif + +TAO_IDL = ../../../../bin/tao_idl +IDL_FILES = test +IDL_SRC = $(foreach ext, C.cpp S.cpp, $(foreach file, $(IDL_FILES), $(file)$(ext))) + +FILES = \ + testC \ + testS \ + test_i \ + server + +#---------------------------------------------------------------------------- +# Include macros and targets +#---------------------------------------------------------------------------- +LDLIBS = -lTAO_RTScheduler -lKokyu -lKokyu_DSRT_Schedulers -lTAO_RTCORBA -lTAO_PortableServer -lTAO_IORInterceptor -lTAO_Valuetype -lTAO_ObjRefTemplate -lTAO -lACE +include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU +## We don't need the ACELIB setting from wrapper_macros.GNU +ACELIB = +include $(TAO_ROOT)/rules.tao.GNU + +# To build multiple executables in the same directory on AIX, it works +# best to have a template directory per project. +# The compiler/linker isn't too smart about instantiating templates... +ifdef TEMPINCDIR +TEMPINCDIR := $(TEMPINCDIR)/mif_server + +all: $(TEMPINCDIR) + +$(TEMPINCDIR): + @-test -d $(TEMPINCDIR) || mkdir -p $(TEMPINCDIR) $(ACE_NUL_STDERR) + +endif + +BIN = $(BIN_UNCHECKED) + +OBJS = $(addsuffix .o, $(notdir $(FILES))) +SRC = $(addsuffix .cpp, $(FILES)) + +ifneq ($(BIN),) +all: idl_stubs +testC.cpp testS.cpp test_i.cpp server.cpp: idl_stubs +endif + +include $(ACE_ROOT)/include/makeinclude/macros.GNU +include $(ACE_ROOT)/include/makeinclude/rules.common.GNU +include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU + +include $(ACE_ROOT)/include/makeinclude/rules.local.GNU +include $(TAO_ROOT)/taoconfig.mk + +CPPFLAGS += -I../../../tao/RTScheduling -I../../../tao/RTCORBA -I../../../../Kokyu -I../../../examples/Kokyu_dsrt_schedulers -I../../.. -I../../../tao -I../../../.. +ifeq ($(static_libs),1) + ifneq ($(LIB),) + CPPFLAGS += -DTAO_AS_STATIC_LIBS -DTAO_AS_STATIC_LIBS -DACE_AS_STATIC_LIBS + endif +endif + + +LDFLAGS += -L../../../examples/Kokyu_dsrt_schedulers -L../../../tao/RTScheduling -L../../../tao/RTCORBA -L../../../tao/PortableServer -L../../../tao/IORInterceptor -L../../../tao/Valuetype -L../../../tao/ObjRefTemplate -L../../../../Kokyu -L../../../tao -L../../../../ace -L../../../../lib + +TAO_IDLFLAGS += -Gv -Ge 1 -Sc -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h +#---------------------------------------------------------------------------- +# Local targets +#---------------------------------------------------------------------------- +../../../../lib: + -@mkdir -p "../../../../lib" + + +ADDITIONAL_IDL_TARGETS = +# IDL File Directory: . + +ifneq ($(ADDITIONAL_IDL_TARGETS),) +idl_stubs: $(ADDITIONAL_IDL_TARGETS) +endif + +.PRECIOUS: $(foreach ext, $(IDL_EXT), $(foreach file, $(IDL_FILES), $(file)$(ext))) + +$(BIN): $(addprefix $(VDIR), $(OBJS)) + $(LINK.cc) $(LDFLAGS) $(CC_OUTPUT_FLAG) $@ $^ $(VLDLIBS) $(POSTLINK) + +realclean: clean + -$(RM) $(foreach ext, $(IDL_EXT), $(foreach file, $(IDL_FILES), $(file)$(ext))) +ifneq ($(GENERATED_DIRTY),) + -$(RM) -r $(GENERATED_DIRTY) +endif + diff --git a/TAO/examples/Kokyu_dsrt_schedulers/mif_example/README b/TAO/examples/Kokyu_dsrt_schedulers/mif_example/README new file mode 100644 index 00000000000..5499ca9e937 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/mif_example/README @@ -0,0 +1,34 @@ +This example illustrates the working of a Kokyu +based DSRT scheduler. There are 2 threads waiting +for requests on the server side. Two threads are +started on the client side. The main thread as +well as the worker threads are given the maximum +priority so that their "release" happen immediately. +Each of the worker threads make a remote two-way +call to the server. The two requests are processed +in different threads on the server side. + +On the client side, the first thread is given lesser +importance than the second thread and the second thread +is started a little later than the first. It is +expected that, on the server side, the first request +is processed by one of the two threads. When the +second request comes in, the other thread that processes +this request should become more eligible since the +second request carries more importance than the first. +A timeline is generated which shows the sequence of +execution of the two different threads on the server. + +Make sure that you run in privileged mode. + +To run the test using the CV-based approach (see ../README), + +./server -d +./client -d -x + +To run the test using the OS-based approach (see ../README), + +./server -d -s +./client -d -x -s + +The timeline is generated in timeline.txt diff --git a/TAO/examples/Kokyu_dsrt_schedulers/mif_example/client.cpp b/TAO/examples/Kokyu_dsrt_schedulers/mif_example/client.cpp new file mode 100644 index 00000000000..71cc7f62e17 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/mif_example/client.cpp @@ -0,0 +1,356 @@ +// $Id$ + +#include "ace/Get_Opt.h" +#include "ace/Task.h" +#include "ace/High_Res_Timer.h" +#include "tao/RTScheduling/RTScheduler_Manager.h" +#include "testC.h" +#include "MIF_Scheduler.h" + +ACE_RCSID(MT_Server, client, "$Id$") + +const char *ior = "file://test.ior"; +int niterations = 5; +int do_shutdown = 0; +int enable_dynamic_scheduling = 0; +int enable_yield = 1; + +class Worker : public ACE_Task_Base +{ + // = TITLE + // Run a server thread + // + // = DESCRIPTION + // Use the ACE_Task_Base class to run server threads + // +public: + Worker (CORBA::ORB_ptr orb, + Simple_Server_ptr server_ptr, + RTScheduling::Current_ptr current, + MIF_Scheduler* scheduler, + CORBA::Short importance, + CORBA::Long server_load); + // int sleep_time); + // ctor + + virtual int svc (void); + // The thread entry point. + +private: + CORBA::ORB_var orb_; + // The orb + + Simple_Server_var server_; + RTScheduling::Current_var scheduler_current_; + MIF_Scheduler* scheduler_; + CORBA::Short importance_; + CORBA::Long server_load_; + int sleep_time_; +}; + +int +parse_args (int argc, char *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, "xk:i:ds"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'x': + do_shutdown = 1; + break; + + case 'k': + ior = get_opts.opt_arg (); + break; + + case 'i': + niterations = ACE_OS::atoi (get_opts.opt_arg ()); + break; + + case 'd': + enable_dynamic_scheduling = 1; + break; + + case 's': + enable_yield = 0; + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-k <ior> " + "-i <niterations> " + "-d (enable dynamic scheduling)" + "-s (disable yield)" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int +main (int argc, char *argv[]) +{ + MIF_Scheduler* scheduler=0; + RTScheduling::Current_var current; + int prio; + int max_prio; + ACE_Sched_Params::Policy sched_policy = ACE_SCHED_RR; + int sched_scope = ACE_SCOPE_THREAD; + long flags; + + if (sched_policy == ACE_SCHED_RR) + flags = THR_NEW_LWP | THR_BOUND | THR_JOINABLE | THR_SCHED_RR; + else + flags = THR_NEW_LWP | THR_BOUND | THR_JOINABLE | THR_SCHED_FIFO; + + ACE_hthread_t main_thr_handle; + ACE_Thread::self (main_thr_handle); + + max_prio = ACE_Sched_Params::priority_max (sched_policy, + sched_scope); + + ACE_Sched_Params sched_params (sched_policy, max_prio); + + ACE_OS::sched_params (sched_params); + + if (ACE_Thread::getprio (main_thr_handle, prio) == -1) + { + if (errno == ENOTSUP) + { + ACE_ERROR((LM_ERROR, + ACE_TEXT ("getprio not supported\n") + )); + } + else + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n") + ACE_TEXT ("thr_getprio failed"))); + } + } + + ACE_DEBUG ((LM_DEBUG, "(%t): main thread prio is %d\n", prio)); + + ACE_TRY_NEW_ENV + { + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (parse_args (argc, argv) != 0) + return 1; + + CORBA::Object_var object = + orb->string_to_object (ior ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + Simple_Server_var server = + Simple_Server::_narrow (object.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (server.in ())) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Object reference <%s> is nil\n", + ior), + 1); + } + + if (enable_dynamic_scheduling) + { + ACE_DEBUG ((LM_DEBUG, "Dyn Sched enabled\n")); + CORBA::Object_ptr manager_obj = + orb->resolve_initial_references ("RTSchedulerManager" + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + TAO_RTScheduler_Manager_var manager = + TAO_RTScheduler_Manager::_narrow (manager_obj + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + Kokyu::DSRT_Dispatcher_Impl_t disp_impl_type; + if (enable_yield) + { + disp_impl_type = Kokyu::DSRT_CV_BASED; + } + else + { + disp_impl_type = Kokyu::DSRT_OS_BASED; + } + + ACE_NEW_RETURN (scheduler, + MIF_Scheduler (orb.in (), + disp_impl_type, + sched_policy, + sched_scope), -1); + + manager->rtscheduler (scheduler); + + CORBA::Object_var object = + orb->resolve_initial_references ("RTScheduler_Current" + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + current = + RTScheduling::Current::_narrow (object.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + } + + Worker worker1 (orb.in (), server.in (), current.in (), scheduler, 10, 15); + + if (worker1.activate (flags, 1, 0, max_prio) != 0) + { + ACE_ERROR ((LM_ERROR, + "(%t|%T) cannot activate worker thread.\n")); + } + + ACE_OS::sleep(2); + + Worker worker2 (orb.in (), server.in (), current.in (), scheduler, 12, 5); + + if (worker2.activate (flags, 1, 0, max_prio) != 0) + { + ACE_ERROR ((LM_ERROR, + "(%t|%T) cannot activate scheduler thread in RT mode.\n")); + } + + worker1.wait (); + worker2.wait (); + + ACE_DEBUG ((LM_DEBUG, + "(%t): wait for worker threads done in main thread\n")); + + if (do_shutdown) + { + if (enable_dynamic_scheduling) + { + MIF_Scheduling::SchedulingParameter sched_param; + sched_param.importance = 0; + CORBA::Policy_var sched_param_policy = + scheduler->create_scheduling_parameter (sched_param); + CORBA::Policy_ptr implicit_sched_param = 0; + current->begin_scheduling_segment (0, + sched_param_policy.in (), + implicit_sched_param + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + + ACE_DEBUG ((LM_DEBUG, "(%t): about to call server shutdown\n")); + server->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_DEBUG ((LM_DEBUG, "after shutdown call in main thread\n")); + + + if (enable_dynamic_scheduling) + { + current->end_scheduling_segment (0 ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + } + + scheduler->shutdown (); + ACE_DEBUG ((LM_DEBUG, "scheduler shutdown done\n")); + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Exception caught:"); + return 1; + } + ACE_ENDTRY; + + return 0; +} + +// **************************************************************** + +Worker::Worker (CORBA::ORB_ptr orb, + Simple_Server_ptr server_ptr, + RTScheduling::Current_ptr current, + MIF_Scheduler* scheduler, + CORBA::Short importance, + CORBA::Long server_load) + // int sleep_time) + : orb_ (CORBA::ORB::_duplicate (orb)), + server_ (Simple_Server::_duplicate (server_ptr)), + scheduler_current_ (RTScheduling::Current::_duplicate (current)), + scheduler_ (scheduler), + importance_ (importance), + server_load_ (server_load) + // sleep_time_ (sleep_time) +{ +} + +int +Worker::svc (void) +{ + ACE_DECLARE_NEW_CORBA_ENV; + const char * name = 0; + /* + ACE_DEBUG ((LM_DEBUG, "(%t|%T):about to sleep for %d sec\n", sleep_time_)); + ACE_OS::sleep (sleep_time_); + ACE_DEBUG ((LM_DEBUG, "(%t|%T):woke up from sleep for %d sec\n", sleep_time_)); + */ + ACE_hthread_t thr_handle; + ACE_Thread::self (thr_handle); + int prio; + + if (ACE_Thread::getprio (thr_handle, prio) == -1) + { + if (errno == ENOTSUP) + { + ACE_ERROR((LM_ERROR, + ACE_TEXT ("getprio not supported\n") + )); + } + else + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n") + ACE_TEXT ("thr_getprio failed"))); + } + } + + ACE_DEBUG ((LM_DEBUG, "(%t|%T) worker activated with prio %d\n", prio)); + + if (enable_dynamic_scheduling) + { + MIF_Scheduling::SchedulingParameter sched_param; + CORBA::Policy_var sched_param_policy; + sched_param.importance = importance_; + sched_param_policy = scheduler_->create_scheduling_parameter (sched_param); + CORBA::Policy_ptr implicit_sched_param = 0; + ACE_DEBUG ((LM_DEBUG, "(%t|%T):before begin_sched_segment\n")); + scheduler_current_->begin_scheduling_segment (name, + sched_param_policy.in (), + implicit_sched_param + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + ACE_DEBUG ((LM_DEBUG, "(%t|%T):after begin_sched_segment\n")); + } + + ACE_DEBUG ((LM_DEBUG, "(%t|%T):about to make two way call\n")); + server_->test_method (server_load_ ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + ACE_DEBUG ((LM_DEBUG, "(%t|%T):two way call done\n")); + + if (enable_dynamic_scheduling) + { + scheduler_current_->end_scheduling_segment (name); + ACE_CHECK_RETURN (-1); + } + + ACE_DEBUG ((LM_DEBUG, "client worker thread (%t) done\n")); + + return 0; +} diff --git a/TAO/examples/Kokyu_dsrt_schedulers/mif_example/mif_client.dsp b/TAO/examples/Kokyu_dsrt_schedulers/mif_example/mif_client.dsp new file mode 100644 index 00000000000..254391f268a --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/mif_example/mif_client.dsp @@ -0,0 +1,201 @@ +# Microsoft Developer Studio Project File - Name="mif_client" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=mif_client - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE run the tool that generated this project file and specify the
+!MESSAGE nmake output type. You can then use the following command:
+!MESSAGE
+!MESSAGE NMAKE /f "mif_client.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "mif_client.mak" CFG="mif_client - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "mif_client - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "mif_client - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "mif_client - Win32 Release"
+
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release\mif_client"
+# PROP Target_Dir ""
+# ADD CPP /nologo /O2 /W3 /GX /MD /GR /I "..\..\..\tao\RTScheduling" /I "..\..\..\tao\RTCORBA" /I "..\..\..\..\Kokyu" /I "..\..\..\examples\Kokyu_dsrt_schedulers" /I "..\..\.." /I "..\..\..\tao" /I "..\..\..\.." /D NDEBUG /D WIN32 /D _CONSOLE /FD /c
+# SUBTRACT CPP /YX
+# ADD RSC /l 0x409 /d NDEBUG /i "..\..\..\tao\RTScheduling" /i "..\..\..\tao\RTCORBA" /i "..\..\..\..\Kokyu" /i "..\..\..\examples\Kokyu_dsrt_schedulers" /i "..\..\.." /i "..\..\..\tao" /i "..\..\..\.."
+BSC32=bscmake.exe
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD LINK32 advapi32.lib user32.lib /INCREMENTAL:NO TAO_RTScheduler.lib Kokyu.lib Kokyu_DSRT_Schedulers.lib TAO_RTCORBA.lib TAO.lib ACE.lib /libpath:"..\..\..\examples\Kokyu_dsrt_schedulers" /libpath:"..\..\..\tao\RTScheduling" /libpath:"..\..\..\tao\RTCORBA" /libpath:"..\..\..\..\Kokyu" /libpath:"..\..\..\tao" /libpath:"..\..\..\..\ace" /libpath:"..\..\..\..\lib" /nologo /version:1.3.1 /subsystem:console /pdb:"Release\client.pdb" /machine:I386 /out:"Release\client.exe"
+
+!ELSEIF "$(CFG)" == "mif_client - Win32 Debug"
+
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "."
+# PROP Intermediate_Dir "Debug\mif_client"
+# PROP Target_Dir ""
+# ADD CPP /nologo /Ob0 /W3 /Gm /GX /Zi /MDd /GR /Gy /I "..\..\..\tao\RTScheduling" /I "..\..\..\tao\RTCORBA" /I "..\..\..\..\Kokyu" /I "..\..\..\examples\Kokyu_dsrt_schedulers" /I "..\..\.." /I "..\..\..\tao" /I "..\..\..\.." /D _DEBUG /D WIN32 /D _CONSOLE /FD /c
+# SUBTRACT CPP /YX
+# ADD RSC /l 0x409 /d _DEBUG /i "..\..\..\tao\RTScheduling" /i "..\..\..\tao\RTCORBA" /i "..\..\..\..\Kokyu" /i "..\..\..\examples\Kokyu_dsrt_schedulers" /i "..\..\.." /i "..\..\..\tao" /i "..\..\..\.."
+BSC32=bscmake.exe
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD LINK32 advapi32.lib user32.lib /INCREMENTAL:NO TAO_RTSchedulerd.lib Kokyud.lib Kokyu_DSRT_Schedulersd.lib TAO_RTCORBAd.lib TAOd.lib ACEd.lib /libpath:"..\..\..\examples\Kokyu_dsrt_schedulers" /libpath:"..\..\..\tao\RTScheduling" /libpath:"..\..\..\tao\RTCORBA" /libpath:"..\..\..\..\Kokyu" /libpath:"..\..\..\tao" /libpath:"..\..\..\..\ace" /libpath:"..\..\..\..\lib" /nologo /version:1.3.1 /subsystem:console /pdb:".\client.pdb" /debug /machine:I386 /out:".\client.exe"
+
+!ENDIF
+
+# Begin Target
+
+# Name "mif_client - Win32 Release"
+# Name "mif_client - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;cxx;c"
+# Begin Source File
+
+SOURCE=".\client.cpp"
+# End Source File
+# Begin Source File
+
+SOURCE=".\testC.cpp"
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hh"
+# Begin Source File
+
+SOURCE=".\testC.h"
+# End Source File
+# Begin Source File
+
+SOURCE=".\testS_T.h"
+# End Source File
+# End Group
+# Begin Group "Inline Files"
+
+# PROP Default_Filter "i;inl"
+# Begin Source File
+
+SOURCE=".\testC.i"
+# End Source File
+# Begin Source File
+
+SOURCE=".\testS_T.i"
+# End Source File
+# End Group
+# Begin Group "Template Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=".\testS_T.cpp"
+# PROP Exclude_From_Build 1
+# End Source File
+# End Group
+# Begin Group "Documentation"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=".\README"
+# End Source File
+# Begin Source File
+
+SOURCE=".\timeline.txt"
+# End Source File
+# End Group
+# Begin Group "IDL Files"
+
+# PROP Default_Filter "idl"
+# Begin Source File
+
+SOURCE=".\test.idl"
+
+!IF "$(CFG)" == "mif_client - Win32 Release"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking IDL Compiler on $(InputPath)
+InputPath=.\test.idl
+InputName=test
+InputDir=.
+
+BuildCmds= \
+ PATH=%PATH%;..\..\..\..\lib \
+ ..\..\..\..\bin\tao_idl -o . -Ge 1 -Sc -Wb,pre_include=ace\pre.h -Wb,post_include=ace\post.h $(InputPath)
+
+".\$(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)
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "mif_client - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking IDL Compiler on $(InputPath)
+InputPath=.\test.idl
+InputName=test
+InputDir=.
+
+BuildCmds= \
+ PATH=%PATH%;..\..\..\..\lib \
+ ..\..\..\..\bin\tao_idl -o . -Ge 1 -Sc -Wb,pre_include=ace\pre.h -Wb,post_include=ace\post.h $(InputPath)
+
+".\$(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)
+
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/examples/Kokyu_dsrt_schedulers/mif_example/mif_example.dsw b/TAO/examples/Kokyu_dsrt_schedulers/mif_example/mif_example.dsw new file mode 100644 index 00000000000..09e61747422 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/mif_example/mif_example.dsw @@ -0,0 +1,41 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "mif_server"=mif_server.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "mif_client"=mif_client.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/TAO/examples/Kokyu_dsrt_schedulers/mif_example/mif_example.mpc b/TAO/examples/Kokyu_dsrt_schedulers/mif_example/mif_example.mpc new file mode 100644 index 00000000000..5b29a98e63d --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/mif_example/mif_example.mpc @@ -0,0 +1,46 @@ +project(mif_server): taoserver { + + includes +=$(TAO_ROOT) \ + $(TAO_ROOT)/tao/RTScheduling \ + $(TAO_ROOT)/tao/RTCORBA \ + $(ACE_ROOT)/Kokyu \ + $(TAO_ROOT)/examples/Kokyu_dsrt_schedulers + + libs += TAO_RTScheduler Kokyu Kokyu_DSRT_Schedulers TAO_RTCORBA + libpaths += $(TAO_ROOT)/examples/Kokyu_dsrt_schedulers \ + $(TAO_ROOT)/tao/RTScheduling \ + $(TAO_ROOT)/tao/RTCORBA \ + $(TAO_ROOT)/tao/PortableServer \ + $(TAO_ROOT)/tao/IORInterceptor \ + $(TAO_ROOT)/tao/Valuetype \ + $(TAO_ROOT)/tao/ObjRefTemplate \ + $(ACE_ROOT)/Kokyu \ + $(TAO_ROOT)/tao \ + $(ACE_ROOT)/ace + + Source_Files { + test_i.cpp + server.cpp + } +} + +project(mif_client): taoclient { + + includes += $(TAO_ROOT)/tao/RTScheduling \ + $(TAO_ROOT)/tao/RTCORBA \ + $(ACE_ROOT)/Kokyu \ + $(TAO_ROOT)/examples/Kokyu_dsrt_schedulers + libs += TAO_RTScheduler Kokyu Kokyu_DSRT_Schedulers TAO_RTCORBA + libpaths += $(TAO_ROOT)/examples/Kokyu_dsrt_schedulers \ + $(TAO_ROOT)/tao/RTScheduling \ + $(TAO_ROOT)/tao/RTCORBA \ + $(ACE_ROOT)/Kokyu \ + $(TAO_ROOT)/tao \ + $(ACE_ROOT)/ace + + Source_Files { + testC.cpp + client.cpp + } +} + diff --git a/TAO/examples/Kokyu_dsrt_schedulers/mif_example/mif_server.dsp b/TAO/examples/Kokyu_dsrt_schedulers/mif_example/mif_server.dsp new file mode 100644 index 00000000000..2b459ee0bf9 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/mif_example/mif_server.dsp @@ -0,0 +1,225 @@ +# Microsoft Developer Studio Project File - Name="mif_server" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=mif_server - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE run the tool that generated this project file and specify the
+!MESSAGE nmake output type. You can then use the following command:
+!MESSAGE
+!MESSAGE NMAKE /f "mif_server.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "mif_server.mak" CFG="mif_server - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "mif_server - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "mif_server - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "mif_server - Win32 Release"
+
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release\mif_server"
+# PROP Target_Dir ""
+# ADD CPP /nologo /O2 /W3 /GX /MD /GR /I "..\..\..\tao\RTScheduling" /I "..\..\..\tao\RTCORBA" /I "..\..\..\..\Kokyu" /I "..\..\..\examples\Kokyu_dsrt_schedulers" /I "..\..\.." /I "..\..\..\tao" /I "..\..\..\.." /D NDEBUG /D WIN32 /D _CONSOLE /FD /c
+# SUBTRACT CPP /YX
+# ADD RSC /l 0x409 /d NDEBUG /i "..\..\..\tao\RTScheduling" /i "..\..\..\tao\RTCORBA" /i "..\..\..\..\Kokyu" /i "..\..\..\examples\Kokyu_dsrt_schedulers" /i "..\..\.." /i "..\..\..\tao" /i "..\..\..\.."
+BSC32=bscmake.exe
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD LINK32 advapi32.lib user32.lib /INCREMENTAL:NO TAO_RTScheduler.lib Kokyu.lib Kokyu_DSRT_Schedulers.lib TAO_RTCORBA.lib TAO_PortableServer.lib TAO_IORInterceptor.lib TAO_Valuetype.lib TAO_ObjRefTemplate.lib TAO.lib ACE.lib /libpath:"..\..\..\examples\Kokyu_dsrt_schedulers" /libpath:"..\..\..\tao\RTScheduling" /libpath:"..\..\..\tao\RTCORBA" /libpath:"..\..\..\tao\PortableServer" /libpath:"..\..\..\tao\IORInterceptor" /libpath:"..\..\..\tao\Valuetype" /libpath:"..\..\..\tao\ObjRefTemplate" /libpath:"..\..\..\..\Kokyu" /libpath:"..\..\..\tao" /libpath:"..\..\..\..\ace" /libpath:"..\..\..\..\lib" /nologo /version:1.3.1 /subsystem:console /pdb:"Release\server.pdb" /machine:I386 /out:"Release\server.exe"
+
+!ELSEIF "$(CFG)" == "mif_server - Win32 Debug"
+
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "."
+# PROP Intermediate_Dir "Debug\mif_server"
+# PROP Target_Dir ""
+# ADD CPP /nologo /Ob0 /W3 /Gm /GX /Zi /MDd /GR /Gy /I "..\..\..\tao\RTScheduling" /I "..\..\..\tao\RTCORBA" /I "..\..\..\..\Kokyu" /I "..\..\..\examples\Kokyu_dsrt_schedulers" /I "..\..\.." /I "..\..\..\tao" /I "..\..\..\.." /D _DEBUG /D WIN32 /D _CONSOLE /FD /c
+# SUBTRACT CPP /YX
+# ADD RSC /l 0x409 /d _DEBUG /i "..\..\..\tao\RTScheduling" /i "..\..\..\tao\RTCORBA" /i "..\..\..\..\Kokyu" /i "..\..\..\examples\Kokyu_dsrt_schedulers" /i "..\..\.." /i "..\..\..\tao" /i "..\..\..\.."
+BSC32=bscmake.exe
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD LINK32 advapi32.lib user32.lib /INCREMENTAL:NO TAO_RTSchedulerd.lib Kokyud.lib Kokyu_DSRT_Schedulersd.lib TAO_RTCORBAd.lib TAO_PortableServerd.lib TAO_IORInterceptord.lib TAO_Valuetyped.lib TAO_ObjRefTemplated.lib TAOd.lib ACEd.lib /libpath:"..\..\..\examples\Kokyu_dsrt_schedulers" /libpath:"..\..\..\tao\RTScheduling" /libpath:"..\..\..\tao\RTCORBA" /libpath:"..\..\..\tao\PortableServer" /libpath:"..\..\..\tao\IORInterceptor" /libpath:"..\..\..\tao\Valuetype" /libpath:"..\..\..\tao\ObjRefTemplate" /libpath:"..\..\..\..\Kokyu" /libpath:"..\..\..\tao" /libpath:"..\..\..\..\ace" /libpath:"..\..\..\..\lib" /nologo /version:1.3.1 /subsystem:console /pdb:".\server.pdb" /debug /machine:I386 /out:".\server.exe"
+
+!ENDIF
+
+# Begin Target
+
+# Name "mif_server - Win32 Release"
+# Name "mif_server - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;cxx;c"
+# Begin Source File
+
+SOURCE=".\server.cpp"
+# End Source File
+# Begin Source File
+
+SOURCE=".\test_i.cpp"
+# End Source File
+# Begin Source File
+
+SOURCE=".\testC.cpp"
+# End Source File
+# Begin Source File
+
+SOURCE=".\testS.cpp"
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hh"
+# Begin Source File
+
+SOURCE=".\test_i.h"
+# End Source File
+# Begin Source File
+
+SOURCE=".\testC.h"
+# End Source File
+# Begin Source File
+
+SOURCE=".\testS.h"
+# End Source File
+# Begin Source File
+
+SOURCE=".\testS_T.h"
+# End Source File
+# End Group
+# Begin Group "Inline Files"
+
+# PROP Default_Filter "i;inl"
+# Begin Source File
+
+SOURCE=".\test_i.i"
+# End Source File
+# Begin Source File
+
+SOURCE=".\testC.i"
+# End Source File
+# Begin Source File
+
+SOURCE=".\testS.i"
+# End Source File
+# Begin Source File
+
+SOURCE=".\testS_T.i"
+# End Source File
+# End Group
+# Begin Group "Template Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=".\testS_T.cpp"
+# PROP Exclude_From_Build 1
+# End Source File
+# End Group
+# Begin Group "Documentation"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=".\README"
+# End Source File
+# Begin Source File
+
+SOURCE=".\timeline.txt"
+# End Source File
+# End Group
+# Begin Group "IDL Files"
+
+# PROP Default_Filter "idl"
+# Begin Source File
+
+SOURCE=".\test.idl"
+
+!IF "$(CFG)" == "mif_server - Win32 Release"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking IDL Compiler on $(InputPath)
+InputPath=.\test.idl
+InputName=test
+InputDir=.
+
+BuildCmds= \
+ PATH=%PATH%;..\..\..\..\lib \
+ ..\..\..\..\bin\tao_idl -o . -Gv -Ge 1 -Sc -Wb,pre_include=ace\pre.h -Wb,post_include=ace\post.h $(InputPath)
+
+".\$(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)
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "mif_server - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking IDL Compiler on $(InputPath)
+InputPath=.\test.idl
+InputName=test
+InputDir=.
+
+BuildCmds= \
+ PATH=%PATH%;..\..\..\..\lib \
+ ..\..\..\..\bin\tao_idl -o . -Gv -Ge 1 -Sc -Wb,pre_include=ace\pre.h -Wb,post_include=ace\post.h $(InputPath)
+
+".\$(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)
+
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/examples/Kokyu_dsrt_schedulers/mif_example/server.cpp b/TAO/examples/Kokyu_dsrt_schedulers/mif_example/server.cpp new file mode 100644 index 00000000000..a137b5d45f8 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/mif_example/server.cpp @@ -0,0 +1,261 @@ +// $Id$ + +#include "test_i.h" +#include "ace/Get_Opt.h" +#include "ace/Task.h" +#include "ace/High_Res_Timer.h" +#include "tao/RTScheduling/RTScheduler_Manager.h" +#include "MIF_Scheduler.h" +#include "Task_Stats.h" + +ACE_RCSID(MT_Server, server, "$Id$") + +const char *ior_output_file = "test.ior"; + +int nthreads = 2; +int enable_dynamic_scheduling = 0; +const CORBA::Short max_importance = 100; +int enable_yield = 1; + +int +parse_args (int argc, char *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, "o:n:ds"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + + case 'n': + nthreads = ACE_OS::atoi (get_opts.opt_arg ()); + break; + + case 'd': + enable_dynamic_scheduling = 1; + break; + + case 's': + enable_yield = 0; + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-o <iorfile>" + "-d (enable dynamic scheduling)" + "-s (disable yield)" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +class Worker : public ACE_Task_Base +{ + // = TITLE + // Run a server thread + // + // = DESCRIPTION + // Use the ACE_Task_Base class to run server threads + // +public: + Worker (CORBA::ORB_ptr orb); + // ctor + + virtual int svc (void); + // The thread entry point. + +private: + CORBA::ORB_var orb_; + // The orb +}; + +Task_Stats task_stats; + +int +main (int argc, char *argv[]) +{ + MIF_Scheduler* scheduler=0; + RTScheduling::Current_var current; + long flags; + int sched_policy = ACE_SCHED_RR; + int sched_scope = ACE_SCOPE_THREAD; + + if (sched_policy == ACE_SCHED_RR) + flags = THR_NEW_LWP | THR_BOUND | THR_JOINABLE | THR_SCHED_RR; + else + flags = THR_NEW_LWP | THR_BOUND | THR_JOINABLE | THR_SCHED_FIFO; + + task_stats.init (100000); + + ACE_TRY_NEW_ENV + { + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + CORBA::Object_var poa_object = + orb->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (poa_object.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Unable to initialize the POA.\n"), + 1); + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (parse_args (argc, argv) != 0) + return 1; + + if (enable_dynamic_scheduling) + { + 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_TRY_CHECK; + + Kokyu::DSRT_Dispatcher_Impl_t disp_impl_type; + if (enable_yield) + { + disp_impl_type = Kokyu::DSRT_CV_BASED; + } + else + { + disp_impl_type = Kokyu::DSRT_OS_BASED; + } + + ACE_NEW_RETURN (scheduler, + MIF_Scheduler (orb.in (), + disp_impl_type, + sched_policy, + sched_scope), -1); + + manager->rtscheduler (scheduler); + + CORBA::Object_var object = + orb->resolve_initial_references ("RTScheduler_Current" + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + current = + RTScheduling::Current::_narrow (object.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + + Simple_Server_i server_impl (orb.in (), + current.in (), + task_stats, + enable_yield); + + Simple_Server_var server = + server_impl._this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + CORBA::String_var ior = + orb->object_to_string (server.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_DEBUG ((LM_DEBUG, "Activated as <%s>\n", ior.in ())); + + // If the ior_output_file exists, output the ior to it + if (ior_output_file != 0) + { + FILE *output_file= ACE_OS::fopen (ior_output_file, "w"); + if (output_file == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Cannot open output file for writing IOR: %s", + ior_output_file), + 1); + ACE_OS::fprintf (output_file, "%s", ior.in ()); + ACE_OS::fclose (output_file); + } + + poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + Worker worker (orb.in ()); + if (worker.activate (flags, + nthreads, + 0, + ACE_Sched_Params::priority_max(sched_policy, + sched_scope)) != 0) + { + ACE_ERROR ((LM_ERROR, + "Cannot activate threads in RT class.", + "Trying to activate in non-RT class\n")); + + flags = THR_NEW_LWP | THR_JOINABLE | THR_BOUND; + if (worker.activate (flags, nthreads) != 0) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Cannot activate server threads\n"), + 1); + } + } + + worker.wait (); + + ACE_DEBUG ((LM_DEBUG, "event loop finished\n")); + + ACE_DEBUG ((LM_DEBUG, "shutting down scheduler\n")); + scheduler->shutdown (); + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Exception caught:"); + return 1; + } + ACE_ENDTRY; + + ACE_DEBUG ((LM_DEBUG, "Exiting main...\n")); + task_stats.dump_samples ("timeline.txt", + "Time\t\tGUID", + ACE_High_Res_Timer::global_scale_factor ()); + return 0; +} + +// **************************************************************** + +Worker::Worker (CORBA::ORB_ptr orb) + : orb_ (CORBA::ORB::_duplicate (orb)) +{ +} + +int +Worker::svc (void) +{ + ACE_DECLARE_NEW_CORBA_ENV; + ACE_Time_Value tv(120); + + ACE_TRY + { + this->orb_->run (tv ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + } + ACE_ENDTRY; + ACE_DEBUG ((LM_DEBUG, "(%t|%T): Worker thread exiting...\n")); + return 0; +} diff --git a/TAO/examples/Kokyu_dsrt_schedulers/mif_example/test.idl b/TAO/examples/Kokyu_dsrt_schedulers/mif_example/test.idl new file mode 100644 index 00000000000..deed5409437 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/mif_example/test.idl @@ -0,0 +1,10 @@ +// +// $Id$ +// + +interface Simple_Server +{ + long test_method (in long x); + + void shutdown (); +}; diff --git a/TAO/examples/Kokyu_dsrt_schedulers/mif_example/test_i.cpp b/TAO/examples/Kokyu_dsrt_schedulers/mif_example/test_i.cpp new file mode 100644 index 00000000000..704cb646f3f --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/mif_example/test_i.cpp @@ -0,0 +1,129 @@ +// $Id$ + +#include "test_i.h" +#include "ace/High_Res_Timer.h" +#include "ace/Task.h" +#include "ace/ACE.h" +#include "tao/debug.h" + +#if !defined(__ACE_INLINE__) +#include "test_i.i" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(MT_Server, test_i, "$Id$") + +CORBA::Long +Simple_Server_i::test_method (CORBA::Long exec_duration ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_hthread_t thr_handle; + ACE_Thread::self (thr_handle); + int prio; + int guid; + + ACE_OS:: + memcpy (&guid, + this->current_->id (ACE_ENV_SINGLE_ARG_PARAMETER)->get_buffer (), + sizeof (this->current_->id (ACE_ENV_SINGLE_ARG_PARAMETER)->length ())); + + ACE_High_Res_Timer timer; + ACE_Time_Value elapsed_time; + + ACE_DEBUG ((LM_DEBUG, "Request in thread %t\n")); + + if (ACE_Thread::getprio (thr_handle, prio) == -1) + { + if (errno == ENOTSUP) + { + ACE_DEBUG((LM_DEBUG, + ACE_TEXT ("getprio not supported on this platform\n") + )); + return 0; + } + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("getprio failed")), + -1); + } + + ACE_DEBUG ((LM_DEBUG, + "Request in thread %t, prio = %d," + "exec duration = %u\n", prio, exec_duration)); + + static CORBA::ULong prime_number = 9619899; + + ACE_Time_Value compute_count_down_time (exec_duration, 0); + ACE_Countdown_Time compute_count_down (&compute_count_down_time); + + //Applicable only for CV based implementations + //yield every 1 sec + ACE_Time_Value yield_interval (1,0); + + ACE_Time_Value yield_count_down_time (yield_interval); + ACE_Countdown_Time yield_count_down (&yield_count_down_time); + + timer.start (); + int j=0; + while (compute_count_down_time > ACE_Time_Value::zero) + { + ACE::is_prime (prime_number, + 2, + prime_number / 2); + + ++j; + +#ifdef KOKYU_DSRT_LOGGING + if (j%1000 == 0) + { + ACE_DEBUG ((LM_DEBUG, + "(%t|%T) loop # = %d, load = %usec\n", j, exec_duration)); + } +#endif + if (j%1000 == 0) + { + ACE_Time_Value run_time = ACE_OS::gettimeofday (); + task_stats_.sample (ACE_UINT64 (run_time.msec ()), guid); + } + + compute_count_down.update (); + + if (enable_yield_) + { + yield_count_down.update (); + if (yield_count_down_time <= ACE_Time_Value::zero) + { + CORBA::Policy_var sched_param_policy = + CORBA::Policy::_duplicate (current_-> + scheduling_parameter(ACE_ENV_SINGLE_ARG_PARAMETER)); + + const char * name = 0; + + CORBA::Policy_ptr implicit_sched_param = 0; + current_->update_scheduling_segment (name, + sched_param_policy.in (), + implicit_sched_param + ACE_ENV_ARG_PARAMETER); + yield_count_down_time = yield_interval; + yield_count_down.start (); + } + } + } + + timer.stop (); + timer.elapsed_time (elapsed_time); + + ACE_DEBUG ((LM_DEBUG, + "Request processing in thread %t done, " + "prio = %d, load = %d, elapsed time = %umsec\n", + prio, exec_duration, elapsed_time.msec () )); + + return exec_duration; +} + +void +Simple_Server_i::shutdown (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_DEBUG ((LM_DEBUG, "shutdown request from client\n")); + this->orb_->shutdown (0 ACE_ENV_ARG_PARAMETER); +} diff --git a/TAO/examples/Kokyu_dsrt_schedulers/mif_example/test_i.h b/TAO/examples/Kokyu_dsrt_schedulers/mif_example/test_i.h new file mode 100644 index 00000000000..76a77f98c35 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/mif_example/test_i.h @@ -0,0 +1,57 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO/tests/MT_Server +// +// = FILENAME +// test_i.h +// +// = AUTHOR +// Carlos O'Ryan +// +// ============================================================================ + +#ifndef TAO_MT_SERVER_TEST_I_H +#define TAO_MT_SERVER_TEST_I_H + +#include "testS.h" +#include "tao/RTScheduling/RTScheduler_Manager.h" +#include "Task_Stats.h" + +class Simple_Server_i : public POA_Simple_Server +{ + // = TITLE + // Simpler Server implementation + // + // = DESCRIPTION + // Implements the Simple_Server interface in test.idl + // +public: + Simple_Server_i (CORBA::ORB_ptr orb, + RTScheduling::Current_ptr current, + Task_Stats&, + int); + // ctor + + // = The Simple_Server methods. + CORBA::Long test_method (CORBA::Long x ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void shutdown (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)); + +private: + CORBA::ORB_var orb_; + RTScheduling::Current_var current_; + Task_Stats& task_stats_; + int enable_yield_; + // The ORB +}; + +#if defined(__ACE_INLINE__) +#include "test_i.i" +#endif /* __ACE_INLINE__ */ + +#endif /* TAO_MT_SERVER_TEST_I_H */ diff --git a/TAO/examples/Kokyu_dsrt_schedulers/mif_example/test_i.i b/TAO/examples/Kokyu_dsrt_schedulers/mif_example/test_i.i new file mode 100644 index 00000000000..5ce482af7aa --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/mif_example/test_i.i @@ -0,0 +1,13 @@ +// $Id$ + +ACE_INLINE +Simple_Server_i::Simple_Server_i (CORBA::ORB_ptr orb, + RTScheduling::Current_ptr current, + Task_Stats& task_stats, + int enable_yield) + : orb_ (CORBA::ORB::_duplicate (orb)), + current_ (RTScheduling::Current::_duplicate (current)), + task_stats_ (task_stats), + enable_yield_ (enable_yield) +{ +} diff --git a/TAO/examples/Kokyu_dsrt_schedulers/muf_example/Makefile b/TAO/examples/Kokyu_dsrt_schedulers/muf_example/Makefile new file mode 100644 index 00000000000..507c1dd256d --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/muf_example/Makefile @@ -0,0 +1,57 @@ +#---------------------------------------------------------------------------- +# GNU ACE Workspace +# +# @file Makefile +# +# $Id$ +# +# This file was automatically generated by MPC. Any changes made directly to +# this file will be lost the next time it is generated. +# +#---------------------------------------------------------------------------- + + +MAKE_OPTIONS=$(shell echo $(MAKEFLAGS) | sed 's/--unix *//; s/ .*//') +ifeq ($(findstring k,$(MAKE_OPTIONS)),k) + KEEP_GOING = 1 +else + KEEP_GOING = 0 +endif + +%.tgt0: +ifeq ($(KEEP_GOING),1) + -@$(MAKE) -f Makefile.muf_server -C . $(*); +else + @$(MAKE) -f Makefile.muf_server -C . $(*); +endif +%.tgt1: +ifeq ($(KEEP_GOING),1) + -@$(MAKE) -f Makefile.muf_client -C . $(*); +else + @$(MAKE) -f Makefile.muf_client -C . $(*); +endif + + +all: all.tgt0 all.tgt1 + +debug: debug.tgt0 debug.tgt1 + +profile: profile.tgt0 profile.tgt1 + +optimize: optimize.tgt0 optimize.tgt1 + +install: install.tgt0 install.tgt1 + +deinstall: deinstall.tgt0 deinstall.tgt1 + +clean: clean.tgt0 clean.tgt1 + +realclean: realclean.tgt0 realclean.tgt1 + +clobber: clobber.tgt0 clobber.tgt1 + +depend: depend.tgt0 depend.tgt1 + +rcs_info: rcs_info.tgt0 rcs_info.tgt1 + +idl_stubs: idl_stubs.tgt0 idl_stubs.tgt1 diff --git a/TAO/examples/Kokyu_dsrt_schedulers/muf_example/Makefile.muf_client b/TAO/examples/Kokyu_dsrt_schedulers/muf_example/Makefile.muf_client new file mode 100644 index 00000000000..061b740c685 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/muf_example/Makefile.muf_client @@ -0,0 +1,108 @@ +#---------------------------------------------------------------------------- +# GNU Makefile +# +# @file Makefile.muf_client +# +# $Id$ +# +# This file was automatically generated by MPC. Any changes made directly to +# this file will be lost the next time it is generated. +# +#---------------------------------------------------------------------------- +MAKEFILE = Makefile.muf_client +DEPENDENCY_FILE = .depend.Makefile.muf_client +BIN_UNCHECKED = client + +ifndef TAO_ROOT + TAO_ROOT = $(ACE_ROOT)/TAO +endif +ifndef CIAO_ROOT + CIAO_ROOT = $(TAO_ROOT)/CIAO +endif + +TAO_IDL = ../../../../bin/tao_idl +IDL_FILES = test +IDL_SRC = $(foreach ext, C.cpp S.cpp, $(foreach file, $(IDL_FILES), $(file)$(ext))) + +FILES = \ + testC \ + client + +#---------------------------------------------------------------------------- +# Include macros and targets +#---------------------------------------------------------------------------- +LDLIBS = -lTAO_RTScheduler -lKokyu -lKokyu_DSRT_Schedulers -lTAO_RTCORBA -lTAO_Svc_Utils -lTAO -lACE +include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU +## We don't need the ACELIB setting from wrapper_macros.GNU +ACELIB = +include $(TAO_ROOT)/rules.tao.GNU + +# To build multiple executables in the same directory on AIX, it works +# best to have a template directory per project. +# The compiler/linker isn't too smart about instantiating templates... +ifdef TEMPINCDIR +TEMPINCDIR := $(TEMPINCDIR)/muf_client + +all: $(TEMPINCDIR) + +$(TEMPINCDIR): + @-test -d $(TEMPINCDIR) || mkdir -p $(TEMPINCDIR) $(ACE_NUL_STDERR) + +endif + +BIN = $(BIN_UNCHECKED) + +OBJS = $(addsuffix .o, $(notdir $(FILES))) +SRC = $(addsuffix .cpp, $(FILES)) + +ifneq ($(BIN),) +all: idl_stubs + +# This rule forces make to run the idl_stubs +# target before building any of the source files. +testC.cpp client.cpp: idl_stubs +endif + +include $(ACE_ROOT)/include/makeinclude/macros.GNU +include $(ACE_ROOT)/include/makeinclude/rules.common.GNU +include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU + +include $(ACE_ROOT)/include/makeinclude/rules.local.GNU +include $(TAO_ROOT)/taoconfig.mk + +CPPFLAGS += -I../../../tao/RTScheduling -I../../../tao/RTCORBA -I../../../../Kokyu -I../../../examples/Kokyu_dsrt_schedulers -I../../../orbsvcs -I../../.. -I../../../tao -I../../../.. +ifeq ($(static_libs),1) + ifneq ($(LIB),) + CPPFLAGS += -DTAO_AS_STATIC_LIBS -DACE_AS_STATIC_LIBS + endif +endif + + +LDFLAGS += -L../../../examples/Kokyu_dsrt_schedulers -L../../../tao/RTScheduling -L../../../tao/RTCORBA -L../../../orbsvcs/orbsvcs -L../../../../Kokyu -L../../../tao -L../../../../ace -L../../../../lib + +TAO_IDLFLAGS += -Ge 1 -Sc -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h +#---------------------------------------------------------------------------- +# Local targets +#---------------------------------------------------------------------------- +.: + -@mkdir -p "." + + +ADDITIONAL_IDL_TARGETS = +# IDL File Directory: . + +ifneq ($(ADDITIONAL_IDL_TARGETS),) +idl_stubs: $(ADDITIONAL_IDL_TARGETS) +endif + +.PRECIOUS: $(foreach ext, $(IDL_EXT), $(foreach file, $(IDL_FILES), $(file)$(ext))) + +$(BIN): $(addprefix $(VDIR), $(OBJS)) + $(LINK.cc) $(LDFLAGS) $(CC_OUTPUT_FLAG) $@ $^ $(VLDLIBS) $(POSTLINK) + +realclean: clean + -$(RM) $(foreach ext, $(IDL_EXT), $(foreach file, $(IDL_FILES), $(file)$(ext))) +ifneq ($(GENERATED_DIRTY),) + -$(RM) -r $(GENERATED_DIRTY) +endif + diff --git a/TAO/examples/Kokyu_dsrt_schedulers/muf_example/Makefile.muf_server b/TAO/examples/Kokyu_dsrt_schedulers/muf_example/Makefile.muf_server new file mode 100644 index 00000000000..711990d0483 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/muf_example/Makefile.muf_server @@ -0,0 +1,110 @@ +#---------------------------------------------------------------------------- +# GNU Makefile +# +# @file Makefile.muf_server +# +# $Id$ +# +# This file was automatically generated by MPC. Any changes made directly to +# this file will be lost the next time it is generated. +# +#---------------------------------------------------------------------------- +MAKEFILE = Makefile.muf_server +DEPENDENCY_FILE = .depend.Makefile.muf_server +BIN_UNCHECKED = server + +ifndef TAO_ROOT + TAO_ROOT = $(ACE_ROOT)/TAO +endif +ifndef CIAO_ROOT + CIAO_ROOT = $(TAO_ROOT)/CIAO +endif + +TAO_IDL = ../../../../bin/tao_idl +IDL_FILES = test +IDL_SRC = $(foreach ext, C.cpp S.cpp, $(foreach file, $(IDL_FILES), $(file)$(ext))) + +FILES = \ + testC \ + testS \ + test_i \ + server + +#---------------------------------------------------------------------------- +# Include macros and targets +#---------------------------------------------------------------------------- +LDLIBS = -lTAO_RTScheduler -lKokyu -lKokyu_DSRT_Schedulers -lTAO_RTCORBA -lTAO_PortableServer -lTAO_IORInterceptor -lTAO_Valuetype -lTAO_ObjRefTemplate -lTAO -lACE +include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU +## We don't need the ACELIB setting from wrapper_macros.GNU +ACELIB = +include $(TAO_ROOT)/rules.tao.GNU + +# To build multiple executables in the same directory on AIX, it works +# best to have a template directory per project. +# The compiler/linker isn't too smart about instantiating templates... +ifdef TEMPINCDIR +TEMPINCDIR := $(TEMPINCDIR)/muf_server + +all: $(TEMPINCDIR) + +$(TEMPINCDIR): + @-test -d $(TEMPINCDIR) || mkdir -p $(TEMPINCDIR) $(ACE_NUL_STDERR) + +endif + +BIN = $(BIN_UNCHECKED) + +OBJS = $(addsuffix .o, $(notdir $(FILES))) +SRC = $(addsuffix .cpp, $(FILES)) + +ifneq ($(BIN),) +all: idl_stubs + +# This rule forces make to run the idl_stubs +# target before building any of the source files. +testC.cpp testS.cpp test_i.cpp server.cpp: idl_stubs +endif + +include $(ACE_ROOT)/include/makeinclude/macros.GNU +include $(ACE_ROOT)/include/makeinclude/rules.common.GNU +include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU + +include $(ACE_ROOT)/include/makeinclude/rules.local.GNU +include $(TAO_ROOT)/taoconfig.mk + +CPPFLAGS += -I../../../tao/RTScheduling -I../../../tao/RTCORBA -I../../../../Kokyu -I../../../orbsvcs -I../../../examples/Kokyu_dsrt_schedulers -I../../.. -I../../../tao -I../../../.. +ifeq ($(static_libs),1) + ifneq ($(LIB),) + CPPFLAGS += -DTAO_AS_STATIC_LIBS -DTAO_AS_STATIC_LIBS -DACE_AS_STATIC_LIBS + endif +endif + + +LDFLAGS += -L../../../examples/Kokyu_dsrt_schedulers -L../../../tao/RTScheduling -L../../../tao/RTCORBA -L../../../tao/PortableServer -L../../../tao/IORInterceptor -L../../../tao/Valuetype -L../../../tao/ObjRefTemplate -L../../../../Kokyu -L../../../tao -L../../../../ace -L../../../../lib + +TAO_IDLFLAGS += -Gv -Ge 1 -Sc -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h +#---------------------------------------------------------------------------- +# Local targets +#---------------------------------------------------------------------------- +../../../../lib: + -@mkdir -p "../../../../lib" + + +ADDITIONAL_IDL_TARGETS = +# IDL File Directory: . + +ifneq ($(ADDITIONAL_IDL_TARGETS),) +idl_stubs: $(ADDITIONAL_IDL_TARGETS) +endif + +.PRECIOUS: $(foreach ext, $(IDL_EXT), $(foreach file, $(IDL_FILES), $(file)$(ext))) + +$(BIN): $(addprefix $(VDIR), $(OBJS)) + $(LINK.cc) $(LDFLAGS) $(CC_OUTPUT_FLAG) $@ $^ $(VLDLIBS) $(POSTLINK) + +realclean: clean + -$(RM) $(foreach ext, $(IDL_EXT), $(foreach file, $(IDL_FILES), $(file)$(ext))) +ifneq ($(GENERATED_DIRTY),) + -$(RM) -r $(GENERATED_DIRTY) +endif + diff --git a/TAO/examples/Kokyu_dsrt_schedulers/muf_example/client.cpp b/TAO/examples/Kokyu_dsrt_schedulers/muf_example/client.cpp new file mode 100644 index 00000000000..68cfb4814b0 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/muf_example/client.cpp @@ -0,0 +1,428 @@ +// $Id$ + +#include "ace/Get_Opt.h" +#include "ace/Task.h" +#include "ace/High_Res_Timer.h" +#include "tao/RTScheduling/RTScheduler_Manager.h" +#include "testC.h" +#include "MUF_Scheduler.h" +#include "orbsvcs/orbsvcs/Time_Utilities.h" + +ACE_RCSID(MT_Server, client, "$Id$") + +const char *ior = "file://test.ior"; +int niterations = 5; +int do_shutdown = 0; +int enable_dynamic_scheduling = 0; +int enable_yield = 1; + +class Worker : public ACE_Task_Base +{ + // = TITLE + // Run a server thread + // + // = DESCRIPTION + // Use the ACE_Task_Base class to run server threads + // +public: + Worker (CORBA::ORB_ptr orb, + Simple_Server_ptr server_ptr, + RTScheduling::Current_ptr current, + MUF_Scheduler* scheduler, + TimeBase::TimeT deadline, + TimeBase::TimeT estimated_initial_execution_time, + long criticality, + CORBA::Long server_load); + // int sleep_time); + // ctor + + virtual int svc (void); + // The thread entry point. + +private: + CORBA::ORB_var orb_; + // The orb + + Simple_Server_var server_; + RTScheduling::Current_var scheduler_current_; + MUF_Scheduler* scheduler_; + TimeBase::TimeT deadline_; + TimeBase::TimeT estimated_initial_execution_time_; + long criticality_; + CORBA::Long server_load_; + int sleep_time_; +}; + +int +parse_args (int argc, char *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, "xk:i:ds"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'x': + do_shutdown = 1; + break; + + case 'k': + ior = get_opts.opt_arg (); + break; + + case 'i': + niterations = ACE_OS::atoi (get_opts.opt_arg ()); + break; + + case 'd': + enable_dynamic_scheduling = 1; + break; + + case 's': + enable_yield = 0; + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-k <ior> " + "-i <niterations> " + "-d (enable dynamic scheduling)" + "-s (disable yield)" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int +main (int argc, char *argv[]) +{ + MUF_Scheduler* scheduler=0; + RTScheduling::Current_var current; + int prio; + int max_prio; + ACE_Sched_Params::Policy sched_policy = ACE_SCHED_RR; + int sched_scope = ACE_SCOPE_THREAD; + long flags; + + if (sched_policy == ACE_SCHED_RR) + flags = THR_NEW_LWP | THR_BOUND | THR_JOINABLE | THR_SCHED_RR; + else + flags = THR_NEW_LWP | THR_BOUND | THR_JOINABLE | THR_SCHED_FIFO; + + ACE_hthread_t main_thr_handle; + ACE_Thread::self (main_thr_handle); + + max_prio = ACE_Sched_Params::priority_max (sched_policy, + sched_scope); + + ACE_Sched_Params sched_params (sched_policy, max_prio); + + ACE_OS::sched_params (sched_params); + + if (ACE_Thread::getprio (main_thr_handle, prio) == -1) + { + if (errno == ENOTSUP) + { + ACE_ERROR((LM_ERROR, + ACE_TEXT ("getprio not supported\n") + )); + } + else + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n") + ACE_TEXT ("thr_getprio failed"))); + } + } + + ACE_DEBUG ((LM_DEBUG, "(%t): main thread prio is %d\n", prio)); + + ACE_TRY_NEW_ENV + { + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (parse_args (argc, argv) != 0) + return 1; + + CORBA::Object_var object = + orb->string_to_object (ior ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + Simple_Server_var server = + Simple_Server::_narrow (object.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (server.in ())) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Object reference <%s> is nil\n", + ior), + 1); + } + + if (enable_dynamic_scheduling) + { + ACE_DEBUG ((LM_DEBUG, "Dyn Sched enabled\n")); + CORBA::Object_ptr manager_obj = + orb->resolve_initial_references ("RTSchedulerManager" + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + TAO_RTScheduler_Manager_var manager = + TAO_RTScheduler_Manager::_narrow (manager_obj + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + Kokyu::DSRT_Dispatcher_Impl_t disp_impl_type; + if (enable_yield) + { + disp_impl_type = Kokyu::DSRT_CV_BASED; + } + else + { + disp_impl_type = Kokyu::DSRT_OS_BASED; + } + + ACE_NEW_RETURN (scheduler, + MUF_Scheduler (orb.in (), + disp_impl_type, + sched_policy, + sched_scope), -1); + + manager->rtscheduler (scheduler); + + CORBA::Object_var object = + orb->resolve_initial_references ("RTScheduler_Current" + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + current = + RTScheduling::Current::_narrow (object.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + } + + TimeBase::TimeT deadline; + TimeBase::TimeT exec_time; + int criticality=0; + + ORBSVCS_Time::Time_Value_to_TimeT (deadline, + ACE_OS::gettimeofday () + + ACE_Time_Value (50,0) ); + + ORBSVCS_Time::Time_Value_to_TimeT (exec_time, + ACE_OS::gettimeofday () + + ACE_Time_Value (10,0) ); + + Worker worker1 (orb.in (), + server.in (), + current.in (), + scheduler, + deadline, + exec_time, + criticality, + 30); + + if (worker1.activate (flags, 1, 0, max_prio) != 0) + { + ACE_ERROR ((LM_ERROR, + "(%t|%T) cannot activate worker thread.\n")); + } + + ACE_OS::sleep(2); + + ORBSVCS_Time::Time_Value_to_TimeT (deadline, + ACE_OS::gettimeofday () + + ACE_Time_Value (30,0) ); + + ORBSVCS_Time::Time_Value_to_TimeT (exec_time, + ACE_OS::gettimeofday () + + ACE_Time_Value (10,0) ); + + criticality = 0; + Worker worker2 (orb.in (), + server.in (), + current.in (), + scheduler, + deadline, + exec_time, + criticality, + 10); + + if (worker2.activate (flags, 1, 0, max_prio) != 0) + { + ACE_ERROR ((LM_ERROR, + "(%t|%T) cannot activate scheduler thread in RT mode.\n")); + } + + ORBSVCS_Time::Time_Value_to_TimeT (deadline, + ACE_OS::gettimeofday () + + ACE_Time_Value (100,0) ); + + ORBSVCS_Time::Time_Value_to_TimeT (exec_time, + ACE_OS::gettimeofday () + + ACE_Time_Value (10,0) ); + criticality = 1; + + Worker worker3 (orb.in (), + server.in (), + current.in (), + scheduler, + deadline, + exec_time, + criticality, + 5); + if (worker3.activate (flags, 1, 0, max_prio) != 0) + { + ACE_ERROR ((LM_ERROR, + "(%t|%T) cannot activate scheduler thread in RT mode.\n")); + } + + worker1.wait (); + worker2.wait (); + worker3.wait (); + + ACE_DEBUG ((LM_DEBUG, + "(%t): wait for worker threads done in main thread\n")); + + if (do_shutdown) + { + if (enable_dynamic_scheduling) + { + MUF_Scheduling::SchedulingParameter sched_param; + sched_param.criticality = 0; + sched_param.deadline = 0; + sched_param.estimated_initial_execution_time = 0; + CORBA::Policy_var sched_param_policy = + scheduler->create_scheduling_parameter (sched_param); + CORBA::Policy_ptr implicit_sched_param = 0; + current->begin_scheduling_segment (0, + sched_param_policy.in (), + implicit_sched_param + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + + ACE_DEBUG ((LM_DEBUG, "(%t): about to call server shutdown\n")); + server->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_DEBUG ((LM_DEBUG, "after shutdown call in main thread\n")); + + + if (enable_dynamic_scheduling) + { + current->end_scheduling_segment (0 ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + } + + scheduler->shutdown (); + ACE_DEBUG ((LM_DEBUG, "scheduler shutdown done\n")); + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Exception caught:"); + return 1; + } + ACE_ENDTRY; + + return 0; +} + +// **************************************************************** + +Worker::Worker (CORBA::ORB_ptr orb, + Simple_Server_ptr server_ptr, + RTScheduling::Current_ptr current, + MUF_Scheduler* scheduler, + TimeBase::TimeT deadline, + TimeBase::TimeT estimated_initial_execution_time, + long criticality, + CORBA::Long server_load) + // int sleep_time) + : orb_ (CORBA::ORB::_duplicate (orb)), + server_ (Simple_Server::_duplicate (server_ptr)), + scheduler_current_ (RTScheduling::Current::_duplicate (current)), + scheduler_ (scheduler), + deadline_ (deadline), + estimated_initial_execution_time_ ( estimated_initial_execution_time), + criticality_ (criticality), + server_load_ (server_load) + // sleep_time_ (sleep_time) +{ +} + +int +Worker::svc (void) +{ + ACE_DECLARE_NEW_CORBA_ENV; + const char * name = 0; + /* + ACE_DEBUG ((LM_DEBUG, "(%t|%T):about to sleep for %d sec\n", sleep_time_)); + ACE_OS::sleep (sleep_time_); + ACE_DEBUG ((LM_DEBUG, "(%t|%T):woke up from sleep for %d sec\n", sleep_time_)); + */ + ACE_hthread_t thr_handle; + ACE_Thread::self (thr_handle); + int prio; + + if (ACE_Thread::getprio (thr_handle, prio) == -1) + { + if (errno == ENOTSUP) + { + ACE_ERROR((LM_ERROR, + ACE_TEXT ("getprio not supported\n") + )); + } + else + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n") + ACE_TEXT ("thr_getprio failed"))); + } + } + + ACE_DEBUG ((LM_DEBUG, "(%t|%T) worker activated with prio %d\n", prio)); + + if (enable_dynamic_scheduling) + { + MUF_Scheduling::SchedulingParameter sched_param; + CORBA::Policy_var sched_param_policy; + sched_param.criticality = criticality_; + sched_param.deadline = deadline_; + sched_param.estimated_initial_execution_time = 0; + sched_param_policy = scheduler_->create_scheduling_parameter (sched_param); + CORBA::Policy_ptr implicit_sched_param = 0; + ACE_DEBUG ((LM_DEBUG, "(%t|%T):before begin_sched_segment\n")); + scheduler_current_->begin_scheduling_segment (name, + sched_param_policy.in (), + implicit_sched_param + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + ACE_DEBUG ((LM_DEBUG, "(%t|%T):after begin_sched_segment\n")); + } + + ACE_DEBUG ((LM_DEBUG, "(%t|%T):about to make two way call\n")); + server_->test_method (server_load_ ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + ACE_DEBUG ((LM_DEBUG, "(%t|%T):two way call done\n")); + + if (enable_dynamic_scheduling) + { + scheduler_current_->end_scheduling_segment (name); + ACE_CHECK_RETURN (-1); + } + + ACE_DEBUG ((LM_DEBUG, "client worker thread (%t) done\n")); + + return 0; +} diff --git a/TAO/examples/Kokyu_dsrt_schedulers/muf_example/muf_client.dsp b/TAO/examples/Kokyu_dsrt_schedulers/muf_example/muf_client.dsp new file mode 100644 index 00000000000..1215689a1f5 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/muf_example/muf_client.dsp @@ -0,0 +1,172 @@ +# Microsoft Developer Studio Project File - Name="muf_client" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=muf_client - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE run the tool that generated this project file and specify the
+!MESSAGE nmake output type. You can then use the following command:
+!MESSAGE
+!MESSAGE NMAKE /f "muf_client.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "muf_client.mak" CFG="muf_client - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "muf_client - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "muf_client - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "muf_client - Win32 Release"
+
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release\muf_client"
+# PROP Target_Dir ""
+# ADD CPP /nologo /O2 /W3 /GX /MD /GR /I "..\..\..\tao\RTScheduling" /I "..\..\..\tao\RTCORBA" /I "..\..\..\..\Kokyu" /I "..\..\..\examples\Kokyu_dsrt_schedulers" /I "..\..\..\orbsvcs" /I "..\..\.." /I "..\..\..\tao" /I "..\..\..\.." /D NDEBUG /D WIN32 /D _CONSOLE /FD /c
+# SUBTRACT CPP /YX
+# ADD RSC /l 0x409 /d NDEBUG /i "..\..\..\tao\RTScheduling" /i "..\..\..\tao\RTCORBA" /i "..\..\..\..\Kokyu" /i "..\..\..\examples\Kokyu_dsrt_schedulers" /i "..\..\..\orbsvcs" /i "..\..\.." /i "..\..\..\tao" /i "..\..\..\.."
+BSC32=bscmake.exe
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD LINK32 advapi32.lib user32.lib /INCREMENTAL:NO TAO_RTScheduler.lib Kokyu.lib Kokyu_DSRT_Schedulers.lib TAO_RTCORBA.lib TAO_Svc_Utils.lib TAO.lib ACE.lib /libpath:"..\..\..\examples\Kokyu_dsrt_schedulers" /libpath:"..\..\..\tao\RTScheduling" /libpath:"..\..\..\tao\RTCORBA" /libpath:"..\..\..\orbsvcs\orbsvcs" /libpath:"..\..\..\..\Kokyu" /libpath:"..\..\..\tao" /libpath:"..\..\..\..\ace" /libpath:"..\..\..\..\lib" /nologo /version:1.3.4 /subsystem:console /pdb:"Release\client.pdb" /machine:I386 /out:"Release\client.exe"
+
+!ELSEIF "$(CFG)" == "muf_client - Win32 Debug"
+
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "."
+# PROP Intermediate_Dir "Debug\muf_client"
+# PROP Target_Dir ""
+# ADD CPP /nologo /Ob0 /W3 /Gm /GX /Zi /MDd /GR /Gy /I "..\..\..\tao\RTScheduling" /I "..\..\..\tao\RTCORBA" /I "..\..\..\..\Kokyu" /I "..\..\..\examples\Kokyu_dsrt_schedulers" /I "..\..\..\orbsvcs" /I "..\..\.." /I "..\..\..\tao" /I "..\..\..\.." /D _DEBUG /D WIN32 /D _CONSOLE /FD /c
+# SUBTRACT CPP /YX
+# ADD RSC /l 0x409 /d _DEBUG /i "..\..\..\tao\RTScheduling" /i "..\..\..\tao\RTCORBA" /i "..\..\..\..\Kokyu" /i "..\..\..\examples\Kokyu_dsrt_schedulers" /i "..\..\..\orbsvcs" /i "..\..\.." /i "..\..\..\tao" /i "..\..\..\.."
+BSC32=bscmake.exe
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD LINK32 advapi32.lib user32.lib /INCREMENTAL:NO TAO_RTSchedulerd.lib Kokyud.lib Kokyu_DSRT_Schedulersd.lib TAO_RTCORBAd.lib TAO_Svc_Utilsd.lib TAOd.lib ACEd.lib /libpath:"..\..\..\examples\Kokyu_dsrt_schedulers" /libpath:"..\..\..\tao\RTScheduling" /libpath:"..\..\..\tao\RTCORBA" /libpath:"..\..\..\orbsvcs\orbsvcs" /libpath:"..\..\..\..\Kokyu" /libpath:"..\..\..\tao" /libpath:"..\..\..\..\ace" /libpath:"..\..\..\..\lib" /nologo /version:1.3.4 /subsystem:console /pdb:".\client.pdb" /debug /machine:I386 /out:".\client.exe"
+
+!ENDIF
+
+# Begin Target
+
+# Name "muf_client - Win32 Release"
+# Name "muf_client - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;cxx;c"
+# Begin Source File
+
+SOURCE=".\client.cpp"
+# End Source File
+# Begin Source File
+
+SOURCE=".\testC.cpp"
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hh"
+# Begin Source File
+
+SOURCE=".\testC.h"
+# End Source File
+# End Group
+# Begin Group "Inline Files"
+
+# PROP Default_Filter "i;inl"
+# Begin Source File
+
+SOURCE=".\testC.i"
+# End Source File
+# End Group
+# Begin Group "IDL Files"
+
+# PROP Default_Filter "idl"
+# Begin Source File
+
+SOURCE=".\test.idl"
+
+!IF "$(CFG)" == "muf_client - Win32 Release"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking IDL Compiler on $(InputPath)
+InputPath=.\test.idl
+InputName=test
+InputDir=.
+
+BuildCmds= \
+ PATH=%PATH%;..\..\..\..\lib \
+ ..\..\..\..\bin\tao_idl -o . -Ge 1 -Sc -Wb,pre_include=ace\pre.h -Wb,post_include=ace\post.h $(InputPath)
+
+".\$(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)
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "muf_client - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking IDL Compiler on $(InputPath)
+InputPath=.\test.idl
+InputName=test
+InputDir=.
+
+BuildCmds= \
+ PATH=%PATH%;..\..\..\..\lib \
+ ..\..\..\..\bin\tao_idl -o . -Ge 1 -Sc -Wb,pre_include=ace\pre.h -Wb,post_include=ace\post.h $(InputPath)
+
+".\$(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)
+
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/examples/Kokyu_dsrt_schedulers/muf_example/muf_example.dsw b/TAO/examples/Kokyu_dsrt_schedulers/muf_example/muf_example.dsw new file mode 100644 index 00000000000..1cad6d20a0b --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/muf_example/muf_example.dsw @@ -0,0 +1,41 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "muf_server"=muf_server.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "muf_client"=muf_client.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/TAO/examples/Kokyu_dsrt_schedulers/muf_example/muf_example.mpc b/TAO/examples/Kokyu_dsrt_schedulers/muf_example/muf_example.mpc new file mode 100644 index 00000000000..d950a394762 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/muf_example/muf_example.mpc @@ -0,0 +1,50 @@ +project(muf_server): taoserver { + + includes += $(TAO_ROOT) \ + $(TAO_ROOT)/tao/RTScheduling \ + $(TAO_ROOT)/tao/RTCORBA \ + $(ACE_ROOT)/Kokyu \ + $(TAO_ROOT)/orbsvcs \ + $(TAO_ROOT)/examples/Kokyu_dsrt_schedulers + + libs += TAO_RTScheduler Kokyu Kokyu_DSRT_Schedulers TAO_RTCORBA + libpaths += $(TAO_ROOT)/examples/Kokyu_dsrt_schedulers \ + $(TAO_ROOT)/tao/RTScheduling \ + $(TAO_ROOT)/tao/RTCORBA \ + $(TAO_ROOT)/tao/PortableServer \ + $(TAO_ROOT)/tao/IORInterceptor \ + $(TAO_ROOT)/tao/Valuetype \ + $(TAO_ROOT)/tao/ObjRefTemplate \ + $(ACE_ROOT)/Kokyu \ + $(TAO_ROOT)/tao \ + $(ACE_ROOT)/ace + + Source_Files { + test_i.cpp + server.cpp + } +} + +project(muf_client): taoclient { + + includes += $(TAO_ROOT)/tao/RTScheduling \ + $(TAO_ROOT)/tao/RTCORBA \ + $(ACE_ROOT)/Kokyu \ + $(TAO_ROOT)/examples/Kokyu_dsrt_schedulers \ + $(TAO_ROOT)/orbsvcs + + libs += TAO_RTScheduler Kokyu Kokyu_DSRT_Schedulers TAO_RTCORBA TAO_Svc_Utils + libpaths += $(TAO_ROOT)/examples/Kokyu_dsrt_schedulers \ + $(TAO_ROOT)/tao/RTScheduling \ + $(TAO_ROOT)/tao/RTCORBA \ + $(TAO_ROOT)/orbsvcs/orbsvcs \ + $(ACE_ROOT)/Kokyu \ + $(TAO_ROOT)/tao \ + $(ACE_ROOT)/ace + + Source_Files { + testC.cpp + client.cpp + } +} + diff --git a/TAO/examples/Kokyu_dsrt_schedulers/muf_example/muf_server.dsp b/TAO/examples/Kokyu_dsrt_schedulers/muf_example/muf_server.dsp new file mode 100644 index 00000000000..5bffdbc1e00 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/muf_example/muf_server.dsp @@ -0,0 +1,196 @@ +# Microsoft Developer Studio Project File - Name="muf_server" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=muf_server - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE run the tool that generated this project file and specify the
+!MESSAGE nmake output type. You can then use the following command:
+!MESSAGE
+!MESSAGE NMAKE /f "muf_server.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "muf_server.mak" CFG="muf_server - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "muf_server - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "muf_server - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "muf_server - Win32 Release"
+
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release\muf_server"
+# PROP Target_Dir ""
+# ADD CPP /nologo /O2 /W3 /GX /MD /GR /I "..\..\..\tao\RTScheduling" /I "..\..\..\tao\RTCORBA" /I "..\..\..\..\Kokyu" /I "..\..\..\orbsvcs" /I "..\..\..\examples\Kokyu_dsrt_schedulers" /I "..\..\.." /I "..\..\..\tao" /I "..\..\..\.." /D NDEBUG /D WIN32 /D _CONSOLE /FD /c
+# SUBTRACT CPP /YX
+# ADD RSC /l 0x409 /d NDEBUG /i "..\..\..\tao\RTScheduling" /i "..\..\..\tao\RTCORBA" /i "..\..\..\..\Kokyu" /i "..\..\..\orbsvcs" /i "..\..\..\examples\Kokyu_dsrt_schedulers" /i "..\..\.." /i "..\..\..\tao" /i "..\..\..\.."
+BSC32=bscmake.exe
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD LINK32 advapi32.lib user32.lib /INCREMENTAL:NO TAO_RTScheduler.lib Kokyu.lib Kokyu_DSRT_Schedulers.lib TAO_RTCORBA.lib TAO_PortableServer.lib TAO_IORInterceptor.lib TAO_Valuetype.lib TAO_ObjRefTemplate.lib TAO.lib ACE.lib /libpath:"..\..\..\examples\Kokyu_dsrt_schedulers" /libpath:"..\..\..\tao\RTScheduling" /libpath:"..\..\..\tao\RTCORBA" /libpath:"..\..\..\tao\PortableServer" /libpath:"..\..\..\tao\IORInterceptor" /libpath:"..\..\..\tao\Valuetype" /libpath:"..\..\..\tao\ObjRefTemplate" /libpath:"..\..\..\..\Kokyu" /libpath:"..\..\..\tao" /libpath:"..\..\..\..\ace" /libpath:"..\..\..\..\lib" /nologo /version:1.3.4 /subsystem:console /pdb:"Release\server.pdb" /machine:I386 /out:"Release\server.exe"
+
+!ELSEIF "$(CFG)" == "muf_server - Win32 Debug"
+
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "."
+# PROP Intermediate_Dir "Debug\muf_server"
+# PROP Target_Dir ""
+# ADD CPP /nologo /Ob0 /W3 /Gm /GX /Zi /MDd /GR /Gy /I "..\..\..\tao\RTScheduling" /I "..\..\..\tao\RTCORBA" /I "..\..\..\..\Kokyu" /I "..\..\..\orbsvcs" /I "..\..\..\examples\Kokyu_dsrt_schedulers" /I "..\..\.." /I "..\..\..\tao" /I "..\..\..\.." /D _DEBUG /D WIN32 /D _CONSOLE /FD /c
+# SUBTRACT CPP /YX
+# ADD RSC /l 0x409 /d _DEBUG /i "..\..\..\tao\RTScheduling" /i "..\..\..\tao\RTCORBA" /i "..\..\..\..\Kokyu" /i "..\..\..\orbsvcs" /i "..\..\..\examples\Kokyu_dsrt_schedulers" /i "..\..\.." /i "..\..\..\tao" /i "..\..\..\.."
+BSC32=bscmake.exe
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD LINK32 advapi32.lib user32.lib /INCREMENTAL:NO TAO_RTSchedulerd.lib Kokyud.lib Kokyu_DSRT_Schedulersd.lib TAO_RTCORBAd.lib TAO_PortableServerd.lib TAO_IORInterceptord.lib TAO_Valuetyped.lib TAO_ObjRefTemplated.lib TAOd.lib ACEd.lib /libpath:"..\..\..\examples\Kokyu_dsrt_schedulers" /libpath:"..\..\..\tao\RTScheduling" /libpath:"..\..\..\tao\RTCORBA" /libpath:"..\..\..\tao\PortableServer" /libpath:"..\..\..\tao\IORInterceptor" /libpath:"..\..\..\tao\Valuetype" /libpath:"..\..\..\tao\ObjRefTemplate" /libpath:"..\..\..\..\Kokyu" /libpath:"..\..\..\tao" /libpath:"..\..\..\..\ace" /libpath:"..\..\..\..\lib" /nologo /version:1.3.4 /subsystem:console /pdb:".\server.pdb" /debug /machine:I386 /out:".\server.exe"
+
+!ENDIF
+
+# Begin Target
+
+# Name "muf_server - Win32 Release"
+# Name "muf_server - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;cxx;c"
+# Begin Source File
+
+SOURCE=".\server.cpp"
+# End Source File
+# Begin Source File
+
+SOURCE=".\test_i.cpp"
+# End Source File
+# Begin Source File
+
+SOURCE=".\testC.cpp"
+# End Source File
+# Begin Source File
+
+SOURCE=".\testS.cpp"
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hh"
+# Begin Source File
+
+SOURCE=".\test_i.h"
+# End Source File
+# Begin Source File
+
+SOURCE=".\testC.h"
+# End Source File
+# Begin Source File
+
+SOURCE=".\testS.h"
+# End Source File
+# End Group
+# Begin Group "Inline Files"
+
+# PROP Default_Filter "i;inl"
+# Begin Source File
+
+SOURCE=".\test_i.i"
+# End Source File
+# Begin Source File
+
+SOURCE=".\testC.i"
+# End Source File
+# Begin Source File
+
+SOURCE=".\testS.i"
+# End Source File
+# End Group
+# Begin Group "IDL Files"
+
+# PROP Default_Filter "idl"
+# Begin Source File
+
+SOURCE=".\test.idl"
+
+!IF "$(CFG)" == "muf_server - Win32 Release"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking IDL Compiler on $(InputPath)
+InputPath=.\test.idl
+InputName=test
+InputDir=.
+
+BuildCmds= \
+ PATH=%PATH%;..\..\..\..\lib \
+ ..\..\..\..\bin\tao_idl -o . -Gv -Ge 1 -Sc -Wb,pre_include=ace\pre.h -Wb,post_include=ace\post.h $(InputPath)
+
+".\$(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)
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "muf_server - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking IDL Compiler on $(InputPath)
+InputPath=.\test.idl
+InputName=test
+InputDir=.
+
+BuildCmds= \
+ PATH=%PATH%;..\..\..\..\lib \
+ ..\..\..\..\bin\tao_idl -o . -Gv -Ge 1 -Sc -Wb,pre_include=ace\pre.h -Wb,post_include=ace\post.h $(InputPath)
+
+".\$(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)
+
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/examples/Kokyu_dsrt_schedulers/muf_example/server.cpp b/TAO/examples/Kokyu_dsrt_schedulers/muf_example/server.cpp new file mode 100644 index 00000000000..7758d797ab0 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/muf_example/server.cpp @@ -0,0 +1,261 @@ +// $Id$ + +#include "test_i.h" +#include "ace/Get_Opt.h" +#include "ace/Task.h" +#include "ace/High_Res_Timer.h" +#include "tao/RTScheduling/RTScheduler_Manager.h" +#include "MUF_Scheduler.h" +#include "Task_Stats.h" + +ACE_RCSID(MT_Server, server, "$Id$") + +const char *ior_output_file = "test.ior"; + +int nthreads = 3; +int enable_dynamic_scheduling = 0; +const CORBA::Short max_importance = 100; +int enable_yield = 1; + +int +parse_args (int argc, char *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, "o:n:ds"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + + case 'n': + nthreads = ACE_OS::atoi (get_opts.opt_arg ()); + break; + + case 'd': + enable_dynamic_scheduling = 1; + break; + + case 's': + enable_yield = 0; + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-o <iorfile>" + "-d (enable dynamic scheduling)" + "-s (disable yield)" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +class Worker : public ACE_Task_Base +{ + // = TITLE + // Run a server thread + // + // = DESCRIPTION + // Use the ACE_Task_Base class to run server threads + // +public: + Worker (CORBA::ORB_ptr orb); + // ctor + + virtual int svc (void); + // The thread entry point. + +private: + CORBA::ORB_var orb_; + // The orb +}; + +Task_Stats task_stats; + +int +main (int argc, char *argv[]) +{ + MUF_Scheduler* scheduler; + RTScheduling::Current_var current; + long flags; + int sched_policy = ACE_SCHED_RR; + int sched_scope = ACE_SCOPE_THREAD; + + if (sched_policy == ACE_SCHED_RR) + flags = THR_NEW_LWP | THR_BOUND | THR_JOINABLE | THR_SCHED_RR; + else + flags = THR_NEW_LWP | THR_BOUND | THR_JOINABLE | THR_SCHED_FIFO; + + task_stats.init (100000); + + ACE_TRY_NEW_ENV + { + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + CORBA::Object_var poa_object = + orb->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (poa_object.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Unable to initialize the POA.\n"), + 1); + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (parse_args (argc, argv) != 0) + return 1; + + if (enable_dynamic_scheduling) + { + CORBA::Object_ptr manager_obj = + orb->resolve_initial_references ("RTSchedulerManager" + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + TAO_RTScheduler_Manager_var manager = + TAO_RTScheduler_Manager::_narrow (manager_obj + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + Kokyu::DSRT_Dispatcher_Impl_t disp_impl_type; + if (enable_yield) + { + disp_impl_type = Kokyu::DSRT_CV_BASED; + } + else + { + disp_impl_type = Kokyu::DSRT_OS_BASED; + } + + ACE_NEW_RETURN (scheduler, + MUF_Scheduler (orb.in (), + disp_impl_type, + sched_policy, + sched_scope), -1); + + manager->rtscheduler (scheduler); + + CORBA::Object_var object = + orb->resolve_initial_references ("RTScheduler_Current" + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + current = + RTScheduling::Current::_narrow (object.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + + Simple_Server_i server_impl (orb.in (), + current.in (), + task_stats, + enable_yield); + + Simple_Server_var server = + server_impl._this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + CORBA::String_var ior = + orb->object_to_string (server.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_DEBUG ((LM_DEBUG, "Activated as <%s>\n", ior.in ())); + + // If the ior_output_file exists, output the ior to it + if (ior_output_file != 0) + { + FILE *output_file= ACE_OS::fopen (ior_output_file, "w"); + if (output_file == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Cannot open output file for writing IOR: %s", + ior_output_file), + 1); + ACE_OS::fprintf (output_file, "%s", ior.in ()); + ACE_OS::fclose (output_file); + } + + poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + Worker worker (orb.in ()); + if (worker.activate (flags, + nthreads, + 0, + ACE_Sched_Params::priority_max(sched_policy, + sched_scope)) != 0) + { + ACE_ERROR ((LM_ERROR, + "Cannot activate threads in RT class.", + "Trying to activate in non-RT class\n")); + + flags = THR_NEW_LWP | THR_JOINABLE | THR_BOUND; + if (worker.activate (flags, nthreads) != 0) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Cannot activate server threads\n"), + 1); + } + } + + worker.wait (); + + ACE_DEBUG ((LM_DEBUG, "event loop finished\n")); + + ACE_DEBUG ((LM_DEBUG, "shutting down scheduler\n")); + scheduler->shutdown (); + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Exception caught:"); + return 1; + } + ACE_ENDTRY; + + ACE_DEBUG ((LM_DEBUG, "Exiting main...\n")); + task_stats.dump_samples ("timeline.txt", + "Time\t\tGUID", + ACE_High_Res_Timer::global_scale_factor ()); + return 0; +} + +// **************************************************************** + +Worker::Worker (CORBA::ORB_ptr orb) + : orb_ (CORBA::ORB::_duplicate (orb)) +{ +} + +int +Worker::svc (void) +{ + ACE_DECLARE_NEW_CORBA_ENV; + ACE_Time_Value tv(120); + + ACE_TRY + { + this->orb_->run (tv ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + } + ACE_ENDTRY; + ACE_DEBUG ((LM_DEBUG, "(%t|%T): Worker thread exiting...\n")); + return 0; +} diff --git a/TAO/examples/Kokyu_dsrt_schedulers/muf_example/test.idl b/TAO/examples/Kokyu_dsrt_schedulers/muf_example/test.idl new file mode 100644 index 00000000000..deed5409437 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/muf_example/test.idl @@ -0,0 +1,10 @@ +// +// $Id$ +// + +interface Simple_Server +{ + long test_method (in long x); + + void shutdown (); +}; diff --git a/TAO/examples/Kokyu_dsrt_schedulers/muf_example/test_i.cpp b/TAO/examples/Kokyu_dsrt_schedulers/muf_example/test_i.cpp new file mode 100644 index 00000000000..704cb646f3f --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/muf_example/test_i.cpp @@ -0,0 +1,129 @@ +// $Id$ + +#include "test_i.h" +#include "ace/High_Res_Timer.h" +#include "ace/Task.h" +#include "ace/ACE.h" +#include "tao/debug.h" + +#if !defined(__ACE_INLINE__) +#include "test_i.i" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(MT_Server, test_i, "$Id$") + +CORBA::Long +Simple_Server_i::test_method (CORBA::Long exec_duration ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_hthread_t thr_handle; + ACE_Thread::self (thr_handle); + int prio; + int guid; + + ACE_OS:: + memcpy (&guid, + this->current_->id (ACE_ENV_SINGLE_ARG_PARAMETER)->get_buffer (), + sizeof (this->current_->id (ACE_ENV_SINGLE_ARG_PARAMETER)->length ())); + + ACE_High_Res_Timer timer; + ACE_Time_Value elapsed_time; + + ACE_DEBUG ((LM_DEBUG, "Request in thread %t\n")); + + if (ACE_Thread::getprio (thr_handle, prio) == -1) + { + if (errno == ENOTSUP) + { + ACE_DEBUG((LM_DEBUG, + ACE_TEXT ("getprio not supported on this platform\n") + )); + return 0; + } + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("getprio failed")), + -1); + } + + ACE_DEBUG ((LM_DEBUG, + "Request in thread %t, prio = %d," + "exec duration = %u\n", prio, exec_duration)); + + static CORBA::ULong prime_number = 9619899; + + ACE_Time_Value compute_count_down_time (exec_duration, 0); + ACE_Countdown_Time compute_count_down (&compute_count_down_time); + + //Applicable only for CV based implementations + //yield every 1 sec + ACE_Time_Value yield_interval (1,0); + + ACE_Time_Value yield_count_down_time (yield_interval); + ACE_Countdown_Time yield_count_down (&yield_count_down_time); + + timer.start (); + int j=0; + while (compute_count_down_time > ACE_Time_Value::zero) + { + ACE::is_prime (prime_number, + 2, + prime_number / 2); + + ++j; + +#ifdef KOKYU_DSRT_LOGGING + if (j%1000 == 0) + { + ACE_DEBUG ((LM_DEBUG, + "(%t|%T) loop # = %d, load = %usec\n", j, exec_duration)); + } +#endif + if (j%1000 == 0) + { + ACE_Time_Value run_time = ACE_OS::gettimeofday (); + task_stats_.sample (ACE_UINT64 (run_time.msec ()), guid); + } + + compute_count_down.update (); + + if (enable_yield_) + { + yield_count_down.update (); + if (yield_count_down_time <= ACE_Time_Value::zero) + { + CORBA::Policy_var sched_param_policy = + CORBA::Policy::_duplicate (current_-> + scheduling_parameter(ACE_ENV_SINGLE_ARG_PARAMETER)); + + const char * name = 0; + + CORBA::Policy_ptr implicit_sched_param = 0; + current_->update_scheduling_segment (name, + sched_param_policy.in (), + implicit_sched_param + ACE_ENV_ARG_PARAMETER); + yield_count_down_time = yield_interval; + yield_count_down.start (); + } + } + } + + timer.stop (); + timer.elapsed_time (elapsed_time); + + ACE_DEBUG ((LM_DEBUG, + "Request processing in thread %t done, " + "prio = %d, load = %d, elapsed time = %umsec\n", + prio, exec_duration, elapsed_time.msec () )); + + return exec_duration; +} + +void +Simple_Server_i::shutdown (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_DEBUG ((LM_DEBUG, "shutdown request from client\n")); + this->orb_->shutdown (0 ACE_ENV_ARG_PARAMETER); +} diff --git a/TAO/examples/Kokyu_dsrt_schedulers/muf_example/test_i.h b/TAO/examples/Kokyu_dsrt_schedulers/muf_example/test_i.h new file mode 100644 index 00000000000..76a77f98c35 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/muf_example/test_i.h @@ -0,0 +1,57 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO/tests/MT_Server +// +// = FILENAME +// test_i.h +// +// = AUTHOR +// Carlos O'Ryan +// +// ============================================================================ + +#ifndef TAO_MT_SERVER_TEST_I_H +#define TAO_MT_SERVER_TEST_I_H + +#include "testS.h" +#include "tao/RTScheduling/RTScheduler_Manager.h" +#include "Task_Stats.h" + +class Simple_Server_i : public POA_Simple_Server +{ + // = TITLE + // Simpler Server implementation + // + // = DESCRIPTION + // Implements the Simple_Server interface in test.idl + // +public: + Simple_Server_i (CORBA::ORB_ptr orb, + RTScheduling::Current_ptr current, + Task_Stats&, + int); + // ctor + + // = The Simple_Server methods. + CORBA::Long test_method (CORBA::Long x ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void shutdown (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)); + +private: + CORBA::ORB_var orb_; + RTScheduling::Current_var current_; + Task_Stats& task_stats_; + int enable_yield_; + // The ORB +}; + +#if defined(__ACE_INLINE__) +#include "test_i.i" +#endif /* __ACE_INLINE__ */ + +#endif /* TAO_MT_SERVER_TEST_I_H */ diff --git a/TAO/examples/Kokyu_dsrt_schedulers/muf_example/test_i.i b/TAO/examples/Kokyu_dsrt_schedulers/muf_example/test_i.i new file mode 100644 index 00000000000..5ce482af7aa --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/muf_example/test_i.i @@ -0,0 +1,13 @@ +// $Id$ + +ACE_INLINE +Simple_Server_i::Simple_Server_i (CORBA::ORB_ptr orb, + RTScheduling::Current_ptr current, + Task_Stats& task_stats, + int enable_yield) + : orb_ (CORBA::ORB::_duplicate (orb)), + current_ (RTScheduling::Current::_duplicate (current)), + task_stats_ (task_stats), + enable_yield_ (enable_yield) +{ +} diff --git a/TAO/examples/Kokyu_dsrt_schedulers/utils.cpp b/TAO/examples/Kokyu_dsrt_schedulers/utils.cpp new file mode 100644 index 00000000000..882708ea513 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/utils.cpp @@ -0,0 +1,29 @@ +//$Id$ + +#include "utils.h" +#include "Kokyu.h" +#include "ace/Lock_Adapter_T.h" + +void guid_copy( Kokyu::GuidType& lhs, const RTScheduling::Current::IdType& rhs) +{ + lhs.length(rhs.length ()); + ACE_OS::memcpy(lhs.get_buffer (), + rhs.get_buffer (), + rhs.length ()); +} + +void guid_copy( RTScheduling::Current::IdType& lhs, const Kokyu::GuidType& rhs) +{ + lhs.length(rhs.length ()); + ACE_OS::memcpy(lhs.get_buffer (), + rhs.get_buffer (), + rhs.length ()); +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) +template class ACE_Lock_Adapter<ACE_Thread_Mutex>; +template class ACE_Array_Iterator<Kokyu::ConfigInfo>; +#elif defined(ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Lock_Adapter<ACE_Thread_Mutex> +#pragma instantiate ACE_Array_Iterator<Kokyu::ConfigInfo> +#endif diff --git a/TAO/examples/Kokyu_dsrt_schedulers/utils.h b/TAO/examples/Kokyu_dsrt_schedulers/utils.h new file mode 100644 index 00000000000..ea29a7cb754 --- /dev/null +++ b/TAO/examples/Kokyu_dsrt_schedulers/utils.h @@ -0,0 +1,8 @@ +//$Id$ + +#include "ace/OS.h" +#include "Kokyu_qosC.h" +#include "RTScheduler.h" + +void guid_copy( Kokyu::GuidType& lhs, const RTScheduling::Current::IdType& rhs); +void guid_copy( RTScheduling::Current::IdType& lhs, const Kokyu::GuidType& rhs); |