-/* Copyright (c) 2007-2020. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2007-2021. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Messages specific for this s4u example");
-int timer_start; // set as 1 in the master process
+int timer_start; // set as 1 in the master actor
#define NTASKS 1500
double start_time;
XBT_DEBUG("Master started");
/* data size */
- double task_comm_size = std::stod(argv[1]);
- int id = std::stoi(argv[3]); // unique id to control statistics
+ double msg_size = std::stod(argv[1]);
+ int id = std::stoi(argv[3]); // unique id to control statistics
/* worker name */
workernames[id] = xbt_strdup(argv[2]);
masternames[id] = simgrid::s4u::Host::current()->get_cname();
- double* payload = new double();
- *payload = task_comm_size;
+ auto* payload = new double(msg_size);
count_finished++;
timer_start = 1;
/* time measurement */
start_time = simgrid::s4u::Engine::get_clock();
- mbox->put(payload, task_comm_size);
+ mbox->put(payload, msg_size);
XBT_DEBUG("Finished");
}
XBT_DEBUG("Worker started");
- const double* payload = static_cast<double*>(mbox->get());
+ auto payload = mbox->get_unique<double>();
count_finished--;
if (count_finished == 0) {
XBT_INFO("FLOW[%d] : Receive %.0f bytes from %s to %s", id, *payload, masternames[id], workernames[id]);
XBT_DEBUG("FLOW[%d] : transferred in %f seconds", id, elapsed_time);
- delete payload;
XBT_DEBUG("Finished");
}