#include "simgrid/s4u/Engine.hpp"
#include "src/instr/instr_private.hpp"
#include "src/plugins/vm/VirtualMachineImpl.hpp"
+#include <algorithm>
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_kernel);
double next_event_date = -1.0;
tmgr_trace_event_t event = nullptr;
double value = -1.0;
- simgrid::surf::Resource *resource = nullptr;
+ simgrid::kernel::model::Resource* resource = nullptr;
XBT_DEBUG ("Consume all trace events occurring before the starting time.");
while ((next_event_date = future_evt_set->next_date()) != -1.0) {
double time_delta = -1.0; /* duration */
double model_next_action_end = -1.0;
double value = -1.0;
- simgrid::surf::Resource *resource = nullptr;
+ simgrid::kernel::model::Resource* resource = nullptr;
tmgr_trace_event_t event = nullptr;
if (max_date > 0.0) {
time_delta = next_event_virt;
}
+ for (auto const& model : *all_existing_models) {
+ if (model != surf_host_model && model != surf_vm_model && model != surf_network_model &&
+ model != surf_storage_model) {
+ double next_event_model = model->nextOccuringEvent(NOW);
+ if ((time_delta < 0.0 || next_event_model < time_delta) && next_event_model >= 0.0)
+ time_delta = next_event_model;
+ }
+ }
+
XBT_DEBUG("Min for resources (remember that NS3 don't update that value): %f", time_delta);
XBT_DEBUG("Looking for next trace event");
if (not surf_network_model->nextOccuringEventIsIdempotent()) { // NS3, I see you
if (next_event_date != -1.0) {
- time_delta = MIN(next_event_date - NOW, time_delta);
+ time_delta = std::min(next_event_date - NOW, time_delta);
} else {
- time_delta = MAX(next_event_date - NOW, time_delta); // Get the positive component
+ time_delta = std::max(next_event_date - NOW, time_delta); // Get the positive component
}
XBT_DEBUG("Run the NS3 network at most %fs", time_delta);