This commit is contained in:
Loic Guegan 2021-05-20 07:20:34 +02:00
parent f7c6f8ad56
commit 390984c255
7 changed files with 9528 additions and 28712 deletions

View file

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