#include "network.hpp"
#include "cpu.hpp"
#include "workstation.hpp"
+#include "vm_workstation.hpp"
#include "simix/smx_host_private.h"
#include "surf_routing.hpp"
#include "simgrid/sg_config.h"
xbt_dynar_free(&hosts);
}*/
+/* model_list_invoke contains only surf_workstation and surf_vm_workstation.
+ * The callback functions of cpu_model and network_model will be called from
+ * those of these workstation models. */
+xbt_dynar_t model_list = NULL; /* for destroying all models correctly */
+xbt_dynar_t model_list_invoke = NULL; /* for invoking callbacks */
-xbt_dynar_t model_list = NULL;
tmgr_history_t history = NULL;
lmm_system_t maxmin_system = NULL;
xbt_dynar_t surf_path = NULL;
{NULL, NULL, NULL} /* this array must be NULL terminated */
};
+s_surf_model_description_t surf_vm_workstation_model_description[] = {
+ {"default",
+ "Default vm workstation model.)",
+ surf_vm_workstation_model_init_current_default},
+ {NULL, NULL, NULL} /* this array must be NULL terminated */
+};
+
s_surf_model_description_t surf_optimization_mode_description[] = {
{"Lazy",
"Lazy action management (partial invalidation in lmm + heap in action remaining).",
#endif
static double *surf_mins = NULL; /* return value of share_resources for each model */
-static int surf_min_index; /* current index in surf_mins */
-static double min; /* duration determined by surf_solve */
double NOW = 0;
xbt_init(argc, argv);
if (!model_list)
- model_list = xbt_dynar_new(sizeof(surf_model_private_t), NULL);
+ model_list = xbt_dynar_new(sizeof(ModelPtr), NULL);
+ if (!model_list_invoke)
+ model_list_invoke = xbt_dynar_new(sizeof(ModelPtr), NULL);
if (!history)
history = tmgr_history_new();
xbt_dynar_foreach(model_list, iter, model)
delete model;
xbt_dynar_free(&model_list);
+ xbt_dynar_free(&model_list_invoke);
routing_exit();
if (maxmin_system) {
*********/
Model::Model(string name)
- : m_name(name), m_resOnCB(0), m_resOffCB(0),
- m_actSuspendCB(0), m_actCancelCB(0), m_actResumeCB(0),
- p_maxminSystem(0)
+ : p_maxminSystem(0), m_name(name),
+ m_resOnCB(0), m_resOffCB(0),
+ m_actCancelCB(0), m_actSuspendCB(0), m_actResumeCB(0)
{
- ActionPtr action;
+ ActionPtr action = NULL;
p_readyActionSet = xbt_swag_new(xbt_swag_offset(*action, p_stateHookup));
p_runningActionSet = xbt_swag_new(xbt_swag_offset(*action, p_stateHookup));
p_failedActionSet = xbt_swag_new(xbt_swag_offset(*action, p_stateHookup));
return min;
}
-double Model::shareResourcesFull(double now) {
+double Model::shareResourcesFull(double /*now*/) {
THROW_UNIMPLEMENTED;
}
xbt_die("Invalid cpu update mechanism!");
}
-void Model::updateActionsStateLazy(double now, double delta)
+void Model::updateActionsStateLazy(double /*now*/, double /*delta*/)
{
}
-void Model::updateActionsStateFull(double now, double delta)
+void Model::updateActionsStateFull(double /*now*/, double /*delta*/)
{
}
************/
Resource::Resource(surf_model_t model, const char *name, xbt_dict_t props)
- : m_name(xbt_strdup(name)), m_running(true), p_model(model), m_properties(props)
+ : m_name(xbt_strdup(name)), m_properties(props), p_model(model), m_running(true)
{}
Resource::Resource(){
return p_stateCurrent;
}
+void Resource::setState(e_surf_resource_state_t state)
+{
+ p_stateCurrent = state;
+}
+
bool Resource::isOn()
{
return m_running;
Action::Action(){}
Action::Action(ModelPtr model, double cost, bool failed):
- m_cost(cost), p_model(model), m_failed(failed), m_remains(cost),
- m_refcount(1), m_priority(1.0), m_maxDuration(NO_MAX_DURATION),
- m_start(surf_get_clock()), m_finish(-1.0)
+ m_priority(1.0),
+ m_failed(failed),
+ m_start(surf_get_clock()), m_finish(-1.0),
+ m_remains(cost),
+ m_maxDuration(NO_MAX_DURATION),
+ m_cost(cost),
+ p_model(model),
+ m_refcount(1)
{
#ifdef HAVE_TRACING
p_category = NULL;
double_update(&m_remains, m_lastValue * delta);
#ifdef HAVE_TRACING
- if (p_model == static_cast<ModelPtr>(surf_cpu_model) && TRACE_is_enabled()) {
+ if (p_model == static_cast<ModelPtr>(surf_cpu_model_pm) && TRACE_is_enabled()) {
ResourcePtr cpu = static_cast<ResourcePtr>(lmm_constraint_id(lmm_get_cnst_from_var(p_model->p_maxminSystem, p_variable, 0)));
TRACE_surf_host_set_utilization(cpu->m_name, p_category, m_lastValue, m_lastUpdate, now - m_lastUpdate);
}