Commit b3650ede authored by Jonathan Jenkins's avatar Jonathan Jenkins

scheduler - sched loop is callback-driven now (loggp only)

- previously, packet issues were done without any consideration for device
  availability - within epsilon, preventing any meaningful scheduling
- enabled for loggp only, other networks will be incorporated shortly
parent 697f5d17
......@@ -45,6 +45,16 @@ tw_event * model_net_method_event_new(
void **msg_data,
void **extra_data);
// Issue an event from the underlying model (e.g., simplenet, loggp) to tell the
// scheduler when next to issue a packet event. As different models update their
// notion of "idleness" separately, this is necessary. DANGER: Failure to call
// this function appropriately will cause the scheduler to hang or cause other
// weird behavior.
//
// This function is expected to be called within each specific model-net
// method - strange and disturbing things will happen otherwise
void model_net_method_idle_event(tw_stime offset_ts, tw_lp * lp);
// Get a ptr to past the message struct area, where the self/remote events
// are located, given the type of network.
// NOTE: this should ONLY be called on model-net implementations, nowhere else
......
......@@ -437,6 +437,8 @@ static void handle_msg_start_rev_event(
ns->net_send_next_idle = m->net_send_next_idle_saved;
codes_local_latency_reverse(lp);
if(m->local_event_size_bytes > 0)
{
codes_local_latency_reverse(lp);
......@@ -545,6 +547,11 @@ static void handle_msg_start_event(
tw_event_send(e_new);
// now that message is sent, issue an "idle" event to tell the scheduler
// when I'm next available
model_net_method_idle_event(codes_local_latency(lp) +
ns->net_send_next_idle - tw_now(lp), lp);
/* if there is a local event to handle, then create an event for it as
* well
*/
......
......@@ -455,7 +455,10 @@ void handle_sched_next(
b->c0 = 1;
ns->in_sched_loop = 0;
}
else {
// currently, loggp is the only network implementing the
// callback-based scheduling loop, all others schedule the next packet
// immediately
else if (ns->net_id != LOGGP){
tw_event *e = codes_event_new(lp->gid,
poffset+codes_local_latency(lp), lp);
model_net_wrap_msg *m = tw_event_data(e);
......@@ -476,7 +479,7 @@ void handle_sched_next_rc(
if (b->c0){
ns->in_sched_loop = 1;
}
else{
else if (ns->net_id != LOGGP){
codes_local_latency_reverse(lp);
}
}
......@@ -502,6 +505,14 @@ tw_event * model_net_method_event_new(
return e;
}
void model_net_method_idle_event(tw_stime offset_ts, tw_lp * lp){
tw_event *e = tw_event_new(lp->gid, offset_ts, lp);
model_net_wrap_msg *m_wrap = tw_event_data(e);
m_wrap->event_type = MN_BASE_SCHED_NEXT;
m_wrap->magic = model_net_base_magic;
tw_event_send(e);
}
void * model_net_method_get_edata(int net_id, void *msg){
return (char*)msg + sizeof(model_net_wrap_msg) - msg_offsets[net_id];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment