* under the terms of the license (GNU LGPL) which comes with this package. */
#include "surf_interface.hpp"
-#include "VirtualMachineImpl.hpp"
#include "cpu_interface.hpp"
#include "mc/mc.h"
#include "network_interface.hpp"
#include "simgrid/sg_config.h"
#include "src/instr/instr_private.h" // TRACE_is_enabled(). FIXME: remove by subscribing tracing to the surf signals
#include "src/internal_config.h"
+#include "src/kernel/routing/NetCard.hpp"
#include "src/simix/smx_host_private.h"
#include "src/surf/HostImpl.hpp"
#include "surf_private.h"
-#include "surf_routing.hpp"
#include <vector>
XBT_LOG_NEW_CATEGORY(surf, "All SURF categories");
{nullptr, nullptr, nullptr} /* this array must be nullptr terminated */
};
-s_surf_model_description_t surf_vm_model_description[] = {
- {"default", "Default vm model.", &surf_vm_model_init_HL13},
- {nullptr, nullptr, nullptr} /* this array must be nullptr terminated */
-};
-
s_surf_model_description_t surf_optimization_mode_description[] = {
{"Lazy", "Lazy action management (partial invalidation in lmm + heap in action remaining).", nullptr},
{"TI", "Trace integration. Highly optimized mode when using availability traces (only available for the Cas01 CPU model for now).", nullptr},
watched_hosts_lib = xbt_dict_new_homogeneous(nullptr);
XBT_DEBUG("Add routing levels");
- ROUTING_PROP_ASR_LEVEL = xbt_lib_add_level(as_router_lib, nullptr);
ROUTING_ASR_LEVEL = xbt_lib_add_level(as_router_lib, [](void* p) {
delete static_cast<simgrid::kernel::routing::NetCard*>(p);
});
delete model;
delete all_existing_models;
xbt_dynar_free(&model_list_invoke);
- routing_exit();
simgrid::surf::surfExitCallbacks();
namespace simgrid {
namespace surf {
-void Action::initialize(simgrid::surf::Model *model, double cost, bool failed,
- lmm_variable_t var)
+Action::Action(simgrid::surf::Model* model, double cost, bool failed) : Action(model, cost, failed, nullptr)
+{
+}
+
+Action::Action(simgrid::surf::Model* model, double cost, bool failed, lmm_variable_t var)
+ : remains_(cost), start_(surf_get_clock()), cost_(cost), model_(model), variable_(var)
{
- remains_ = cost;
- start_ = surf_get_clock();
- cost_ = cost;
- model_ = model;
- variable_ = var;
if (failed)
stateSet_ = getModel()->getFailedActionSet();
else
stateSet_->push_back(*this);
}
-Action::Action(simgrid::surf::Model *model, double cost, bool failed)
-{
- initialize(model, cost, failed);
-}
-
-Action::Action(simgrid::surf::Model *model, double cost, bool failed, lmm_variable_t var)
-{
- initialize(model, cost, failed, var);
-}
-
Action::~Action() {
xbt_free(category_);
}
void Action::setCategory(const char *category)
{
- XBT_IN("(%p,%s)", this, category);
category_ = xbt_strdup(category);
- XBT_OUT();
}
void Action::ref(){
void Action::setMaxDuration(double duration)
{
- XBT_IN("(%p,%g)", this, duration);
maxDuration_ = duration;
if (getModel()->getUpdateMechanism() == UM_LAZY) // remove action from the heap
heapRemove(getModel()->getActionHeap());
- XBT_OUT();
}
void Action::gapRemove() {}
XBT_IN("(%p)", this);
if (suspended_ != 2) {
lmm_update_variable_weight(getModel()->getMaxminSystem(), getVariable(), 0.0);
- suspended_ = 1;
- if (getModel()->getUpdateMechanism() == UM_LAZY)
+ if (getModel()->getUpdateMechanism() == UM_LAZY){
heapRemove(getModel()->getActionHeap());
+ if (getModel()->getUpdateMechanism() == UM_LAZY && stateSet_ == getModel()->getRunningActionSet() && priority_ > 0){
+ //If we have a lazy model, we need to update the remaining value accordingly
+ updateRemainingLazy(surf_get_clock());
+ }
+ }
+ suspended_ = 1;
}
XBT_OUT();
}