Debug energy

This commit is contained in:
Loic Guegan 2021-05-12 10:22:34 +02:00
parent 454d01dc84
commit 95fc03c7e0
7 changed files with 6329 additions and 6320 deletions

View file

@ -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;