diff options
| author | Loic Guegan <manzerbredes@mailbox.org> | 2021-05-12 10:22:34 +0200 |
|---|---|---|
| committer | Loic Guegan <manzerbredes@mailbox.org> | 2021-05-12 10:22:34 +0200 |
| commit | 95fc03c7e0bcc12f90d48e3756166df69ade0806 (patch) | |
| tree | d91ec3a7d240dea5c4a1b14b1eb7353cd065aa3e /src | |
| parent | 454d01dc8465f60ced35d018e7ceb32819f58e57 (diff) | |
Debug energy
Diffstat (limited to 'src')
| -rw-r--r-- | src/simulator.cc | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/simulator.cc b/src/simulator.cc index afc6f74..de22a6b 100644 --- a/src/simulator.cc +++ b/src/simulator.cc @@ -115,6 +115,7 @@ static void obs_node(std::vector<std::string> args) { if(i.is_sender){ Payload *p=new Payload(); p->DedicatedMailbox="dedicated"+selfName; + // Add hint informations to the payload if(i.use_hint && i.HasNext()){ p->HasHint=i.use_hint; p->duration=i.GetNextDuration(); @@ -122,19 +123,24 @@ static void obs_node(std::vector<std::string> args) { } MODE_ON(); try { - TRACK_UPTIME(m->put(p,0,uptime)); // Send instantaneous message + // First we send and instantaneous message + // This allow first to detect if their is a receiver + // (to not cause deadlock for the extended mode) and second + // to inform the receiver if he should get a hint first + TRACK_UPTIME(m->put(p,0,uptime)); simgrid::s4u::Mailbox *m_ded= simgrid::s4u::Mailbox::by_name(p->DedicatedMailbox); // First send hint if it is required + MODE_TX(); if(p->HasHint){ TRACK_UPTIME(m_ded->put(p,i.hint_size,uptime)); XBT_INFO("%s sent a hint successfully",selfName.c_str()); } // Then try sending the data - MODE_TX(); if(i.extended) m_ded->put(p,i.data_size); else m_ded->put(p,i.data_size,uptime); + // If we reach here, data has been sent successfully XBT_INFO("%s sent data successfully",selfName.c_str()); nSend++; i.is_sender=(nSend<(i.n_nodes-1)); @@ -151,18 +157,21 @@ static void obs_node(std::vector<std::string> args) { bool hintReceived=false; MODE_ON(); try { - TRACK_UPTIME(p=m->get<Payload>(uptime)); // Get the instantaneous message + // Get the instantaneous message + TRACK_UPTIME(p=m->get<Payload>(uptime)); simgrid::s4u::Mailbox *m_ded= simgrid::s4u::Mailbox::by_name(p->DedicatedMailbox); + // Start receiving data + MODE_RX(); if(p->HasHint){ TRACK_UPTIME(p=m_ded->get<Payload>(uptime)); XBT_INFO("%s received a hint successfully",selfName.c_str()); hintReceived=true; } - MODE_RX(); if(i.extended) - p=m_ded->get<Payload>(); // Fetch data + p=m_ded->get<Payload>(); // Fetch data until sended else - p=m_ded->get<Payload>(uptime); // Fetch data + p=m_ded->get<Payload>(uptime); // Fetch data until sended or uptime expire + // If we reach here, data has been received successfully XBT_INFO("%s received data successfully",selfName.c_str()); nDataRcv++; isObserver=true; |
