diff options
Diffstat (limited to 'simulator.cc')
| -rw-r--r-- | simulator.cc | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/simulator.cc b/simulator.cc deleted file mode 100644 index 508a31a..0000000 --- a/simulator.cc +++ /dev/null @@ -1,67 +0,0 @@ -#include "simgrid/s4u.hpp" -#include <simgrid/s4u/Mailbox.hpp> -#include <string> -#include <sstream> -#include "inputs.hpp" -#include "xbt/log.h" - -XBT_LOG_NEW_DEFAULT_CATEGORY(simulator, "[DAO]"); - -typedef unsigned int u32; -u32 max_attempts=0; - -/// @brief Observation unit code -static void obs_unit(std::vector<std::string> args); - - -int main(int argc, char **argv) { - - // Build engine - simgrid::s4u::Engine engine(&argc, argv); - engine.load_platform("platform.xml"); - - // Parse arguments - max_attempts=std::stoi(argv[1]); - - XBT_INFO("-------------------------------------------------"); - XBT_INFO("Sarting loosely coupled data dissemination experiments"); - XBT_INFO("Number of wake attempts per OU is %d",max_attempts); - XBT_INFO("-------------------------------------------------"); - - u32 nObsUnit=simgrid::s4u::Engine::get_instance()->get_host_count(); - for(u32 i=0;i<nObsUnit;i++){ - std::vector<std::string> args; - std::ostringstream ss; - ss<< "ou" <<i; - simgrid::s4u::Actor::create("Sender", simgrid::s4u::Host::by_name(ss.str()), obs_unit, args); - } - - // Setup/Run simulation - engine.run(); - - XBT_INFO("Simulation took %fs", simgrid::s4u::Engine::get_clock()); - - return (0); -} - - -static void obs_unit(std::vector<std::string> args) { - std::string selfName = simgrid::s4u::this_actor::get_host()->get_name(); - Inputs i(selfName); - simgrid::s4u::Mailbox *m = simgrid::s4u::Mailbox::by_name("medium"); - XBT_INFO("Deploying %s",selfName.c_str()); - - std::string msg("aloha"); - double wake_interval=i.wake_interval; - for(u32 i=0;i<max_attempts;i++){ - try - { - simgrid::s4u::this_actor::sleep_for(wake_interval); - } - catch (...) - { - XBT_INFO("Not send"); - } - } - -}
\ No newline at end of file |
