diff options
| author | Loic Guegan <manzerbredes@mailbox.org> | 2021-05-20 07:20:34 +0200 |
|---|---|---|
| committer | Loic Guegan <manzerbredes@mailbox.org> | 2021-05-20 07:20:34 +0200 |
| commit | 390984c255760c8881a19e63a9a8b62b3384d8af (patch) | |
| tree | 3dcd84e7ecf33651bc736c70e09ec2be3079292e /src | |
| parent | f7c6f8ad56a645a09a5a22010f86ca7a81d85635 (diff) | |
Debug
Diffstat (limited to 'src')
| -rw-r--r-- | src/simulator.cc | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/simulator.cc b/src/simulator.cc index 76bb0fb..426c0e0 100644 --- a/src/simulator.cc +++ b/src/simulator.cc @@ -42,7 +42,7 @@ TRACK_UPTIME(m->put(hint_forward,0,TRY_FORWARD_DURING)); \ simgrid::s4u::Mailbox *m_ded= simgrid::s4u::Mailbox::by_name(hint_forward->DedicatedMailbox); \ MODE_TX(); \ - SEND(m_ded->put(hint_forward,0,uptime)); \ + SEND(m_ded->put(hint_forward,i.hint_size,uptime)); \ } \ catch(...){ \ XBT_INFO("%s fail to forward a hint",CNAME); \ @@ -97,7 +97,7 @@ int main(int argc, char **argv) { std::vector<std::string> args; std::ostringstream ss; ss<< "on" <<i; - simgrid::s4u::Actor::create("ON", simgrid::s4u::Host::by_name(ss.str()), obs_node, args); + simgrid::s4u::Actor::create("obs_node", simgrid::s4u::Host::by_name(ss.str()), obs_node, args); } // Launch the simulation @@ -140,7 +140,7 @@ static void obs_node(std::vector<std::string> args) { double upsince=simgrid::s4u::Engine::get_clock(); double upuntil=i.GetTS()+i.GetDuration(); bool forward_mode=false; - while(uptime>0) + while(uptime>0.00001) // Avoid dead lock with uptime since we handle it manually { if(i.is_sender){ Payload *p=new Payload(); @@ -183,11 +183,13 @@ static void obs_node(std::vector<std::string> args) { } } else if(!isObserver){ - // Here we try to forward hint for 1 sec and try to receive data for 5 secs - double try_for=forward_mode ? 1 : 1; - try_for=try_for>uptime ? uptime : try_for; // Ensure we do not exceed uptime + // Here we try to forward hint for 0.1 sec and try to receive data for 1 secs + double try_for=forward_mode ? 0.1 : 1; + // Then we ensure we do not exceed uptime + try_for=try_for>uptime ? uptime : try_for; + try_for=i.use_hint ? try_for : uptime; // Ensure use should use hint // Forward hint mode - if(forward_mode){ + if(i.use_hint && forward_mode){ if(hint_forward!=NULL && CLOCK < hint_forward->hint){ FORWARD_HINT(try_for); // Try forward for 5 seconds then switch to received mode } @@ -246,7 +248,7 @@ static void obs_node(std::vector<std::string> args) { else { XBT_INFO("%s is observing his environment...",CNAME); MODE_ON(); - if(hint_forward!=NULL && CLOCK < hint_forward->hint){ + if(i.use_hint && hint_forward!=NULL && CLOCK < hint_forward->hint){ FORWARD_HINT(uptime); } else{ |
