This commit is contained in:
Loic Guegan 2021-06-10 17:31:41 +02:00
parent dbdcb14449
commit 82b5b6a076
29 changed files with 42136 additions and 580 deletions

View file

@ -29,7 +29,7 @@ int main(int argc, char **argv){
int seed=atoi(argv[1]);
double simtime=stod(argv[2]);
unsigned int wakeupevery=atoi(argv[3]);
double wakeupfor=stod(argv[4]);
unsigned int wakeupfor=stoi(argv[4]);
unsigned int n_nodes=atoi(argv[5]);
bool extended=!strcmp("true",argv[6]);
bool hint=!strcmp("true",argv[7]);
@ -74,7 +74,7 @@ int main(int argc, char **argv){
Value ts(kArrayType);
Value duration(kArrayType);
for(unsigned int i=0;i<simtime;i+=wakeupevery){
ts.PushBack(Value().SetDouble(RAND(i,i+wakeupevery)),d.GetAllocator());
ts.PushBack(Value().SetDouble(RAND(i,i+wakeupevery-wakeupfor)),d.GetAllocator());
duration.PushBack(Value().SetDouble(wakeupfor),d.GetAllocator());
}
node.AddMember("wake_ts",ts,d.GetAllocator());

View file

@ -8,6 +8,7 @@
#include <sstream>
#include "Inputs.hpp"
#include "simgrid/s4u/Actor.hpp"
#define PLATFORM_FILE "platform.xml"
@ -25,10 +26,8 @@
}
#define TRACK_UPTIME(instruction) \
{ \
double uptimeTrack=CLOCK; \
instruction; \
uptimeTrack=CLOCK-uptimeTrack; \
uptime-=uptimeTrack; \
uptime=upuntil-CLOCK; \
uptime=uptime > 0 ? uptime : 0; \
}
/// @brief Note that we need to simulate latency our self since we need to send instantaneous messages
@ -54,6 +53,7 @@
catch(...){ \
XBT_INFO("%s fail to forward a hint",CNAME); \
MODE_ON(); \
uptime=upuntil-CLOCK; \
TRACK_UPTIME(simgrid::s4u::this_actor::sleep_for(FOR(TRY_FORWARD_DURING))); \
} \
} \
@ -156,7 +156,7 @@ static void obs_node(std::vector<std::string> args) {
bool forward_mode=false; // Turned on and off every x seconds by the receiver (to switch between forward hint mode and receiving data mode)
bool forward_only=false; // When observer receive a hint it switch to forward only up to the next wake up time
bool sendhint_mode=false; // Turned on and off every x seconds by the sender (to switch between send hint and send data)
while(uptime>0)
while(CLOCK < upuntil)
{
// ---------- SENDER ----------
if(is_sender){
@ -273,8 +273,9 @@ static void obs_node(std::vector<std::string> args) {
if(i.extended){
p=m_ded->get<Payload>(); // Fetch data until sended
}
else
p=m_ded->get<Payload>(uptime); // Fetch data until sended or uptime expire
else{
TRACK_UPTIME(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",CNAME);
timeDataRcv=CLOCK;
@ -335,10 +336,11 @@ static void obs_node(std::vector<std::string> args) {
forward_mode=!forward_mode;
}
else {
simgrid::s4u::this_actor::sleep_for(uptime);
simgrid::s4u::this_actor::sleep_until(upuntil);
}
}
uptime=upuntil-CLOCK; // Note that uptime can be < 0 in extended mode
uptime=uptime > 0 ? uptime : 0; // Just in case
}
// Load next event
i.GotoNextEvent();