- explicit sender(std::vector<std::string> args)
-{
- xbt_assert(args.size() == 4, "The sender function expects 3 arguments from the XML deployment file");
- messages_count = std::stol(args[1]);
- msg_size = std::stod(args[2]);
- receivers_count = std::stol(args[3]);
-}
-void operator()()
-{
- std::vector<simgrid::s4u::CommPtr>* pending_comms = new std::vector<simgrid::s4u::CommPtr>();
-
- /* Start dispatching all messages to receivers, in a round robin fashion */
- for (int i = 0; i < messages_count; i++) {
-
- std::string mbox_name = std::string("receiver-") + std::to_string(i % receivers_count);
- mbox = simgrid::s4u::Mailbox::byName(mbox_name);
-
- /* Create a communication representing the ongoing communication */
- std::string msgName = std::string("Message ") + std::to_string(i);
- char* payload = xbt_strdup(msgName.c_str()); // copy the data we send: 'msgName' is not a stable storage location
-
- simgrid::s4u::CommPtr comm = mbox->put_async((void*)payload, msg_size);
- XBT_INFO("Send to receiver-%ld Task_%d", i % receivers_count, i);
- pending_comms->push_back(comm);
+ explicit Sender(std::vector<std::string> args)
+ {
+ xbt_assert(args.size() == 4, "Expecting 3 parameters from the XML deployment file but got %zu", args.size());
+ messages_count = std::stol(args[1]);
+ msg_size = std::stod(args[2]);
+ receivers_count = std::stol(args[3]);