aboutsummaryrefslogtreecommitdiff
path: root/src/simulator.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/simulator.cc')
-rw-r--r--src/simulator.cc21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/simulator.cc b/src/simulator.cc
index 95e36f9..78d83d0 100644
--- a/src/simulator.cc
+++ b/src/simulator.cc
@@ -47,6 +47,8 @@
} \
catch(...){ \
XBT_INFO("%s fail to forward a hint",CNAME); \
+ MODE_ON(); \
+ TRACK_UPTIME(simgrid::s4u::this_actor::sleep_for(FOR(TRY_FORWARD_DURING))); \
} \
} \
}
@@ -117,7 +119,7 @@ static void obs_node(std::vector<std::string> args) {
// Init various variables
std::string selfName = simgrid::s4u::this_actor::get_host()->get_name();
simgrid::s4u::this_actor::get_host()->turn_on();
- Inputs i(selfName); // Load node input parameters from the json file
+ Inputs i=(selfName); // Load node input parameters from the json file
simgrid::s4u::Mailbox *m = simgrid::s4u::Mailbox::by_name("medium");
XBT_INFO("Deploying observation node %s",CNAME);
@@ -134,7 +136,7 @@ static void obs_node(std::vector<std::string> args) {
bool isObserver=false;
while(i.ShouldContinue()){
// Start by sleeping
- XBT_INFO("%s is spleeping",CNAME);
+ XBT_INFO("%s is sleeping",CNAME);
MODE_OFF();
simgrid::s4u::this_actor::sleep_until(i.GetTS());
MODE_ON();
@@ -214,7 +216,7 @@ static void obs_node(std::vector<std::string> args) {
if(forward_mode){
if(i.use_hint && hint_forward!=NULL && CLOCK < hint_forward->hint){
try {
- FORWARD_HINT(FOR(0.3)); // Try forward for 5 seconds then switch to received mode
+ FORWARD_HINT(FOR(0.3)); // Try forward for 0.3 seconds then switch to received mode
}
catch(...){}
}
@@ -226,7 +228,7 @@ static void obs_node(std::vector<std::string> args) {
do {
TRACK_UPTIME(p=m->get<Payload>(FOR(1)));
if(p->HisForward){
- if(hint_forward==NULL || (hint_forward !=NULL && p->hint!=hint_forward->hint)){
+ if(hint_forward==NULL || (hint_forward !=NULL && p->hint>hint_forward->hint)){
simgrid::s4u::Mailbox *m_ded=simgrid::s4u::Mailbox::by_name(p->DedicatedMailbox);
MODE_RX();
TRACK_UPTIME(p=m_ded->get<Payload>(uptime));
@@ -241,10 +243,6 @@ static void obs_node(std::vector<std::string> args) {
}
} while(p->HisForward);
simgrid::s4u::Mailbox *m_ded= simgrid::s4u::Mailbox::by_name(p->DedicatedMailbox);
- // Inform the sender that we do not want to abort
- Payload *ack=new Payload();
- ack->Abort=false;
- m_ded->put(ack,0); // Instantaneous msg
// Start receiving data
MODE_RX();
if(p->HasHint && !p->HasData){
@@ -258,6 +256,11 @@ static void obs_node(std::vector<std::string> args) {
}
}
else {
+ // Inform the sender that we do not want to abort
+ Payload *ack=new Payload();
+ ack->Abort=false;
+ m_ded->put(ack,0); // Instantaneous msg
+
if(i.extended){
p=m_ded->get<Payload>(); // Fetch data until sended
}
@@ -298,7 +301,6 @@ static void obs_node(std::vector<std::string> args) {
} while(p->HisForward); // Ignore forwarded hint
simgrid::s4u::Mailbox *m_ded= simgrid::s4u::Mailbox::by_name(p->DedicatedMailbox);
// Start receiving hint from sender
- MODE_RX();
if(p->HasData){
Payload *ack=new Payload();
ack->Abort=true;
@@ -306,6 +308,7 @@ static void obs_node(std::vector<std::string> args) {
simgrid::s4u::this_actor::sleep_for(FOR(1));
}
else if(p->HasHint){
+ MODE_RX();
TRACK_UPTIME(p=m_ded->get<Payload>(uptime));
XBT_INFO("%s received a hint successfully",CNAME);
hint_forward=new Payload(*p); // Enable hint forwarding