mirror of
https://gitlab.com/manzerbredes/loosely-coupled-dss-extended.git
synced 2025-06-26 23:37:41 +00:00
Cleaning
This commit is contained in:
parent
9535a039fe
commit
659ad990e8
6 changed files with 1848 additions and 1865 deletions
|
@ -43,7 +43,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,i.hint_size,uptime)); \
|
||||
SEND(m_ded->put(hint_forward,0,uptime)); \
|
||||
} \
|
||||
catch(...){ \
|
||||
XBT_INFO("%s fail to forward a hint",CNAME); \
|
||||
|
@ -57,8 +57,6 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(simulator, "[DAO] Loosely Coupled DSS");
|
|||
|
||||
/// @brief For convenience sake
|
||||
typedef unsigned int u32;
|
||||
u32 nON;
|
||||
bool *data_ready;
|
||||
|
||||
/**
|
||||
* Data that will be exchange between the nodes
|
||||
|
@ -80,13 +78,6 @@ public:
|
|||
/// @brief Observation node code
|
||||
static void obs_node(std::vector<std::string> args);
|
||||
|
||||
bool is_data_rcv_ready(){
|
||||
for(int i=0;i<nON;i++){
|
||||
if(data_ready[i])
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* No arguments are require (cf inputs.json)
|
||||
|
@ -105,15 +96,12 @@ int main(int argc, char **argv) {
|
|||
XBT_INFO("-------------------------------------------------");
|
||||
|
||||
// Init all nodes actors
|
||||
nON=simgrid::s4u::Engine::get_instance()->get_host_count();
|
||||
data_ready=(bool*)malloc(sizeof(bool)*nON);
|
||||
u32 nON=simgrid::s4u::Engine::get_instance()->get_host_count();
|
||||
for(u32 i=0;i<nON;i++){
|
||||
std::vector<std::string> args;
|
||||
std::ostringstream ss;
|
||||
ss<< "on" <<i;
|
||||
args.push_back(std::to_string(i));
|
||||
data_ready[i]=false;
|
||||
simgrid::s4u::Actor::create("obs_node", simgrid::s4u::Host::by_name(ss.str()), obs_node, args);
|
||||
simgrid::s4u::Actor::create("ON", simgrid::s4u::Host::by_name(ss.str()), obs_node, args);
|
||||
}
|
||||
|
||||
// Launch the simulation
|
||||
|
@ -129,7 +117,6 @@ int main(int argc, char **argv) {
|
|||
static void obs_node(std::vector<std::string> args) {
|
||||
// Init various variables
|
||||
std::string selfName = simgrid::s4u::this_actor::get_host()->get_name();
|
||||
int id=stoi(args[0]);
|
||||
simgrid::s4u::this_actor::get_host()->turn_on();
|
||||
Inputs i(selfName);
|
||||
simgrid::s4u::Mailbox *m = simgrid::s4u::Mailbox::by_name("medium");
|
||||
|
@ -294,7 +281,6 @@ static void obs_node(std::vector<std::string> args) {
|
|||
XBT_INFO("%s could not receive any data",CNAME);
|
||||
nRcvFail++;
|
||||
}
|
||||
data_ready[id]=false;
|
||||
}
|
||||
forward_mode=!forward_mode; // Toggle mode (go back and forth between receiving and forwarding)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue