void EDF_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*/) { Kokyu::Svc_Ctxt_DSRT_QoS* sc_qos_ptr; RTScheduling::Current::IdType guid; int int_guid; DSUI_EVENT_LOG (EDF_SCHED_FAM, ENTER_SERVER_SCHED_TIME, 0, 0, 0); #ifdef KOKYU_DSRT_LOGGING ACE_DEBUG ((LM_DEBUG, "(%t|%T):entered EDF_Scheduler::receive_request\n")); #endif CORBA::String_var operation = ri->operation (); #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::strcmp ("_is_a", operation.in ()) == 0) return; IOP::ServiceContext_var sc = ri->get_request_service_context (Server_Interceptor::SchedulingInfo); CORBA::Long importance; TimeBase::TimeT deadline; TimeBase::TimeT period; CORBA::Long task_id=-1; if (sc.ptr () == 0) { //Since send_request will add an QoS for any request, why can this case happen? //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 importance = 0; period = 0; // task_id = ID_BEGIN ++; } 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; CORBA::Any_var scqostmp = codec_->decode (oc_seq); sc_qos_as_any = scqostmp.in (); //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; importance = sc_qos_ptr->importance; period = sc_qos_ptr->period; task_id = sc_qos_ptr->task_id; 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; ACE_OS::memcpy (&int_guid, guid.get_buffer (), guid.length ()); #ifdef KOKYU_DSRT_LOGGING ACE_DEBUG ((LM_DEBUG, "(%t|%T): Importance = %d, guid = %d " "in recvd service context\n", importance, int_guid)); #endif EDF_Scheduling::SchedulingParameter sched_param; sched_param.importance = importance; sched_param.deadline = deadline; sched_param.period = period; sched_param.task_id = task_id; sched_param_out = this->create_scheduling_parameter (sched_param); } EDF_Scheduler_Traits::QoSDescriptor_t qos; qos.importance_ = importance; qos.deadline_ = deadline; qos.period_ = period; qos.task_id_ = task_id; DSUI_EVENT_LOG (EDF_SCHED_FAM, ENTER_SERVER_DISPATCH_SCHEDULE, int_guid, 0, 0); /*DTTIME: record the entering dispatcher time on the server side. Tenth Time. */ #ifdef KOKYU_HAS_RELEASE_GUARD this->kokyu_dispatcher_->release_guard (guid, qos); #else this->kokyu_dispatcher_->schedule (guid, qos); #endif /*DTTIME: record the leaving dispatcher time on the server side. Eleventh Time. */ DSUI_EVENT_LOG (EDF_SCHED_FAM, LEAVE_SERVER_DISPATCH_SCHEDULE, int_guid, 0, 0); #ifdef KOKYU_DSRT_LOGGING ACE_DEBUG ((LM_DEBUG, "(%t|%T): receive_request interceptor done\n")); #endif DSUI_EVENT_LOG (EDF_SCHED_FAM, LEAVE_SERVER_SCHED_TIME, 0, 0, 0); }
void EDF_Scheduler::receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri) { int int_guid; DSUI_EVENT_LOG (EDF_SCHED_FAM, ENTER_RECEIVE_REPLY, 0, 0, 0); RTScheduling::Current::IdType guid; CORBA::String_var operation = ri->operation (); CORBA::Object_var target = ri->target (); 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); CORBA::Long importance; TimeBase::TimeT deadline; 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 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; CORBA::Any_var scqostmp = codec_->decode (oc_seq); sc_qos_as_any = scqostmp.in (); sc_qos_as_any >>= sc_qos_ptr; deadline = sc_qos_ptr->deadline; importance = sc_qos_ptr->importance; guid.length (sc_qos_ptr->guid.length ()); guid_copy (guid, sc_qos_ptr->guid); ACE_DEBUG ((LM_DEBUG, "(%t|%T):Importance = %d in recvd service context\n", importance)); } ACE_OS::memcpy (&int_guid, guid.get_buffer (), guid.length ()); EDF_Scheduler_Traits::QoSDescriptor_t qos; qos.deadline_ = qos.importance_ = importance; qos.deadline_ = deadline; this->kokyu_dispatcher_->schedule (guid, qos); DSUI_EVENT_LOG (EDF_SCHED_FAM, EXIT_RECEIVE_REPLY, int_guid, 0, 0); }
void MIF_Scheduler::end_scheduling_segment (const RTScheduling::Current::IdType &guid, const char *) { size_t count = 0; ACE_OS::memcpy (&count, guid.get_buffer (), guid.length ()); ACE_DEBUG ((LM_DEBUG, "MIF_Scheduler::end_scheduling_segment %d\n", count)); if (ready_que_.message_count () > 0) { DT* run_dt = 0; ACE_Message_Block* msg = 0; ready_que_.dequeue_head (msg); run_dt = dynamic_cast<DT*> (msg); lock_.acquire (); run_dt->resume (); lock_.release (); free_que_.enqueue_prio (run_dt); } }
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_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 EDF_Scheduler::update_scheduling_segment (const RTScheduling::Current::IdType& guid, const char* name, CORBA::Policy_ptr sched_policy, CORBA::Policy_ptr implicit_sched_param) { ACE_UNUSED_ARG ((name)); ACE_UNUSED_ARG ((implicit_sched_param)); int int_guid ; ACE_OS::memcpy (&int_guid, guid.get_buffer (), guid.length ()); DSUI_EVENT_LOG (EDF_SCHED_FAM, BEGIN_UPDATE_SCHED_SEGMENT, int_guid, 0, 0); #ifdef KOKYU_DSRT_LOGGING ACE_DEBUG ((LM_DEBUG, "(%t|%T): update_sched_seg::guid is %d\n", int_guid)); #endif EDF_Scheduling::SchedulingParameterPolicy_var sched_param_policy = EDF_Scheduling::SchedulingParameterPolicy::_narrow (sched_policy); EDF_Scheduling::SchedulingParameter_var sched_param = sched_param_policy->value (); EDF_Scheduler_Traits::QoSDescriptor_t qos; qos.deadline_ = sched_param->deadline; qos.importance_ = sched_param->importance; kokyu_dispatcher_->update_schedule (guid, qos); DSUI_EVENT_LOG (EDF_SCHED_FAM, END_UPDATE_SCHED_SEGMENT, int_guid, 0, 0); }
void MIF_Scheduler::begin_new_scheduling_segment (const RTScheduling::Current::IdType& guid, const char *, CORBA::Policy_ptr sched_policy, CORBA::Policy_ptr) { #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::receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri) { RTScheduling::Current::IdType guid; CORBA::Short importance=0; CORBA::String_var operation = ri->operation (); CORBA::Object_var target = ri->target (); 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); 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; CORBA::Any_var scqostmp = codec_->decode (oc_seq); sc_qos_as_any = scqostmp.in (); 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 EDF_Scheduler::end_nested_scheduling_segment (const RTScheduling::Current::IdType & guid, const char *, CORBA::Policy_ptr) { int int_guid; ACE_OS::memcpy (&int_guid, guid.get_buffer (), guid.length ()); DSUI_EVENT_LOG (EDF_SCHED_FAM, END_NESTED_SCHED_SEGMENT, int_guid, 0, 0); }
void MIF_Scheduler::end_scheduling_segment ( const RTScheduling::Current::IdType &guid, const char *) { #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 EDF_Scheduler::end_scheduling_segment (const RTScheduling::Current::IdType &guid, const char *) { int int_guid; ACE_OS::memcpy (&int_guid, guid.get_buffer (), guid.length ()); #ifdef KOKYU_DSRT_LOGGING ACE_DEBUG ((LM_DEBUG, "(%t|%T) call to end_sched_segment for guid %d\n", int_guid)); #endif DSUI_EVENT_LOG (EDF_SCHED_FAM, END_SCHED_SEGMENT, int_guid, 0, 0); kokyu_dispatcher_->cancel_schedule (guid); }
void EDF_Scheduler::begin_nested_scheduling_segment (const RTScheduling::Current::IdType &guid, const char *name, CORBA::Policy_ptr sched_param, CORBA::Policy_ptr implicit_sched_param) { int int_guid; ACE_OS::memcpy (&int_guid, guid.get_buffer (), guid.length ()); DSUI_EVENT_LOG (EDF_SCHED_FAM, BEGIN_NESTED_SCHED_SEGMENT, int_guid, 0, 0); this->begin_new_scheduling_segment (guid, name, sched_param, implicit_sched_param); }
void TAO_Scheduler::receive_request (PortableInterceptor::ServerRequestInfo_ptr request_info, RTScheduling::Current::IdType_out guid_out, CORBA::String_out /*name*/, CORBA::Policy_out /*sched_param*/, CORBA::Policy_out /*implicit_sched_param*/) { IOP::ServiceContext_var serv_cxt; try { serv_cxt = request_info->get_request_service_context (Server_Interceptor::SchedulingInfo); size_t gu_id; ACE_OS::memcpy (&gu_id, serv_cxt->context_data.get_buffer (), serv_cxt->context_data.length ()); ACE_DEBUG ((LM_DEBUG, "The Guid is %d\n", gu_id)); RTScheduling::Current::IdType* guid; ACE_NEW (guid, RTScheduling::Current::IdType); guid->length (sizeof (size_t)); ACE_OS::memcpy (guid->get_buffer (), serv_cxt->context_data.get_buffer (), sizeof (size_t)); guid_out = guid; } catch (const CORBA::Exception&) { ACE_DEBUG ((LM_DEBUG, "Invalid Service Context\n")); } }
void EDF_Scheduler::begin_new_scheduling_segment (const RTScheduling::Current::IdType &guid, const char *, CORBA::Policy_ptr sched_policy, CORBA::Policy_ptr) { #ifdef KOKYU_DSRT_LOGGING ACE_DEBUG ((LM_DEBUG, "(%t|%T):EDF_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 DSUI_EVENT_LOG (EDF_SCHED_FAM, BEGIN_SCHED_SEGMENT_START, int_guid, 0, 0); EDF_Scheduler_Traits::QoSDescriptor_t qos; EDF_Scheduling::SchedulingParameterPolicy_var sched_param_policy = EDF_Scheduling::SchedulingParameterPolicy::_narrow (sched_policy); EDF_Scheduling::SchedulingParameter_var sched_param = sched_param_policy->value (); qos.deadline_ = sched_param->deadline; qos.importance_ = sched_param->importance; kokyu_dispatcher_->schedule (guid, qos); DSUI_EVENT_LOG (EDF_SCHED_FAM, BEGIN_SCHED_SEGMENT_END, int_guid, 0, 0); #ifdef KOKYU_DSRT_LOGGING ACE_DEBUG ((LM_DEBUG, "(%t|%T):EDF_Scheduler::begin_new_scheduling_segment exit\n")); #endif }
void MIF_Scheduler::receive_request (PortableInterceptor::ServerRequestInfo_ptr request_info, RTScheduling::Current::IdType_out guid_out, CORBA::String_out, CORBA::Policy_out sched_param_out, CORBA::Policy_out /*implicit_sched_param*/) { if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "MIF_Scheduler::receive_request\n")); IOP::ServiceContext_var serv_cxt = request_info->get_request_service_context (Server_Interceptor::SchedulingInfo); if (serv_cxt != 0) { ACE_DEBUG ((LM_DEBUG, "Got scheduling info\n")); RTScheduling::Current::IdType* guid; ACE_NEW (guid, RTScheduling::Current::IdType); guid->length (sizeof(size_t)); ACE_OS::memcpy (guid->get_buffer (), serv_cxt->context_data.get_buffer (), sizeof (size_t)); size_t gu_id; ACE_OS::memcpy (&gu_id, guid->get_buffer (), guid->length ()); ACE_DEBUG ((LM_DEBUG, "MIF_Scheduler::receive_request %d\n", gu_id)); CORBA::OctetSeq int_buf (sizeof (long)); int_buf.length (int_buf.maximum ()); int i = sizeof (long); for (unsigned int j = 0;j < sizeof (int);j++) { int_buf [j] = serv_cxt->context_data [i++]; } int importance = 0; ACE_OS::memcpy (&importance, int_buf.get_buffer (), sizeof (importance)); guid_out = guid; sched_param_out = DT_TEST::instance ()->scheduler ()->create_segment_scheduling_parameter (importance); if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "%t The Guid is %d Importance is %d\n", gu_id, importance)); DT* new_dt; ACE_NEW (new_dt, DT (this->lock_, gu_id)); new_dt->msg_priority (importance); lock_.acquire (); ready_que_.enqueue_prio (new_dt); new_dt->suspend (); lock_.release (); } }
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*/) { 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 (); #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::strcmp ("_is_a", operation.in ()) == 0) return; IOP::ServiceContext_var sc = ri->get_request_service_context (Server_Interceptor::SchedulingInfo); 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; CORBA::Any_var scqostmp = codec_->decode (oc_seq); sc_qos_as_any = scqostmp.in (); //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 }