- New callbacks:
- s4u::onPlatformCreated: right before the simulation starts
- s4u::onSimulationEnd: right after the main simulation loop
+ - s4u::onTimeAdvance: right after a clock change (time is discrete)
- s4u::Host::onSpeedChange: when the pstate is changed, or when an
event from the availability_file changes the avail speed.
- Links are now usable from s4u
static s4u::Engine *instance_;
};
-/** Callback called when the platform is created (ie, the xml file parsed),
- * right before the actual simulation starts.
- */
+/** Callback fired when the platform is created (ie, the xml file parsed),
+ * right before the actual simulation starts. */
extern XBT_PRIVATE xbt::signal<void()> onPlatformCreated;
-/** Callback called when the main simulation loop ends, just before MSG_run (or similar) ends */
+/** Callback fired when the main simulation loop ends, just before MSG_run (or similar) ends */
extern XBT_PRIVATE xbt::signal<void()> onSimulationEnd;
+
+/** Callback fired when the time jumps into the future */
+extern XBT_PRIVATE xbt::signal<void(double)> onTimeAdvance;
}} // namespace simgrid::s4u
#endif /* SIMGRID_S4U_ENGINE_HPP */
namespace s4u {
xbt::signal<void()> onPlatformCreated;
xbt::signal<void()> onSimulationEnd;
+xbt::signal<void(double)> onTimeAdvance;
Engine *Engine::instance_ = nullptr; /* That singleton is awful, but I don't see no other solution right now. */
/* 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. */
+#include "simgrid/s4u/engine.hpp"
#include "src/instr/instr_private.h"
#include "src/plugins/vm/VirtualMachineImpl.hpp"
/* FIXME: Moved this test to here to avoid stopping simulation if there are actions running on cpus and all cpus are with availability = 0.
* This may cause an infinite loop if one cpu has a trace with periodicity = 0 and the other a trace with periodicity > 0.
* The options are: all traces with same periodicity(0 or >0) or we need to change the way how the events are managed */
- if (time_delta == -1.0) {
+ if (time_delta < 0) {
XBT_DEBUG("No next event at all. Bail out now.");
return -1.0;
}
for (auto model : *all_existing_models) {
model->updateActionsState(NOW, time_delta);
}
+ simgrid::s4u::onTimeAdvance(time_delta);
TRACE_paje_dump_buffer (0);