From: Paul Bédaride Date: Wed, 27 Nov 2013 17:29:41 +0000 (+0100) Subject: Fix network constant issues X-Git-Tag: v3_11_beta~219 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/b458e6e72708bd5aa00d9b5b6f1c46fa942b2894 Fix network constant issues --- diff --git a/src/simix/smx_host.c b/src/simix/smx_host.c index 5b4206233f..8205c7774f 100644 --- a/src/simix/smx_host.c +++ b/src/simix/smx_host.c @@ -35,7 +35,7 @@ smx_host_t SIMIX_host_create(const char *name, /* Update global variables */ xbt_lib_set(host_lib,name,SIMIX_HOST_LEVEL,smx_host); - return xbt_lib_get_or_null(host_lib, name, SIMIX_HOST_LEVEL); + return xbt_lib_get_elm_or_null(host_lib, name);//, SIMIX_HOST_LEVEL); } void SIMIX_pre_host_on(smx_simcall_t simcall, smx_host_t h) diff --git a/src/surf/cpu.cpp b/src/surf/cpu.cpp index 4632489e5c..77f06e325f 100644 --- a/src/surf/cpu.cpp +++ b/src/surf/cpu.cpp @@ -130,6 +130,33 @@ int Cpu::getCore() return m_core; } +CpuLmm::CpuLmm(CpuModelPtr model, const char* name, xbt_dict_t properties, int core, double powerPeak, double powerScale) +: ResourceLmm(), Cpu(model, name, properties, core, powerPeak, powerScale) { + /* At now, we assume that a VM does not have a multicore CPU. */ + if (core > 1) + xbt_assert(model == surf_cpu_model_pm); + + p_constraintCore = xbt_new(lmm_constraint_t, core); + + int i; + for (i = 0; i < core; i++) { + /* just for a unique id, never used as a string. */ + void *cnst_id = bprintf("%s:%i", name, i); + p_constraintCore[i] = lmm_constraint_new(p_model->p_maxminSystem, cnst_id, m_powerScale * m_powerPeak); + } +} + +CpuLmm::~CpuLmm(){ + if (p_constraintCore){ + for (int i = 0; i < m_core; i++) { + void *cnst_id = p_constraintCore[i]->id; + //FIXME:lmm_constraint_free(p_model->p_maxminSystem, p_constraintCore[i]); + xbt_free(cnst_id); + } + xbt_free(p_constraintCore); + } +} + /********** * Action * **********/ diff --git a/src/surf/cpu.hpp b/src/surf/cpu.hpp index c8b53167fd..e4a56467c6 100644 --- a/src/surf/cpu.hpp +++ b/src/surf/cpu.hpp @@ -1,4 +1,5 @@ #include "surf.hpp" +#include "maxmin_private.h" #ifndef SURF_MODEL_CPU_H_ #define SURF_MODEL_CPU_H_ @@ -40,7 +41,9 @@ public: class Cpu : virtual public Resource { public: Cpu(){}; - Cpu(CpuModelPtr model, const char* name, xbt_dict_t properties) : Resource(model, name, properties) {}; + Cpu(CpuModelPtr model, const char* name, xbt_dict_t properties, int core, double powerPeak, double powerScale) + : Resource(model, name, properties), m_core(core), m_powerPeak(powerPeak), m_powerScale(powerScale) + {}; virtual ActionPtr execute(double size)=0; virtual ActionPtr sleep(double duration)=0; virtual int getCore(); @@ -54,9 +57,9 @@ public: virtual double getConsumedEnergy()=0; void addTraces(void); + int m_core; double m_powerPeak; /*< CPU power peak */ double m_powerScale; /*< Percentage of CPU disponible */ - int m_core; protected: //virtual boost::shared_ptr execute(double size) = 0; @@ -65,8 +68,9 @@ protected: class CpuLmm : public ResourceLmm, public Cpu { public: - CpuLmm(){}; - CpuLmm(CpuModelPtr model, const char* name, xbt_dict_t properties) : ResourceLmm(), Cpu(model, name, properties) {}; + CpuLmm() : p_constraintCore(NULL) {}; + CpuLmm(CpuModelPtr model, const char* name, xbt_dict_t properties, int core, double powerPeak, double powerScale); + ~CpuLmm(); /* Note (hypervisor): */ lmm_constraint_t *p_constraintCore; }; diff --git a/src/surf/cpu_cas01.cpp b/src/surf/cpu_cas01.cpp index 8bc85458fb..540117fe15 100644 --- a/src/surf/cpu_cas01.cpp +++ b/src/surf/cpu_cas01.cpp @@ -133,7 +133,7 @@ void CpuCas01Model::parseInit(sg_platf_host_cbarg_t host) host->properties); } -CpuCas01LmmPtr CpuCas01Model::createResource(const char *name, xbt_dynar_t power_peak, +CpuPtr CpuCas01Model::createResource(const char *name, xbt_dynar_t power_peak, int pstate, double power_scale, tmgr_trace_t power_trace, int core, e_surf_resource_state_t state_initial, @@ -150,7 +150,7 @@ CpuCas01LmmPtr CpuCas01Model::createResource(const char *name, xbt_dynar_t power cpu = new CpuCas01Lmm(this, name, power_peak, pstate, power_scale, power_trace, core, state_initial, state_trace, cpu_properties); xbt_lib_set(host_lib, name, SURF_CPU_LEVEL, static_cast(cpu)); - return (CpuCas01LmmPtr) xbt_lib_get_elm_or_null(host_lib, name); + return cpu; } double CpuCas01Model::shareResourcesFull(double /*now*/) @@ -198,10 +198,10 @@ void CpuCas01Model::addTraces() CpuCas01Lmm::CpuCas01Lmm(CpuCas01ModelPtr model, const char *name, xbt_dynar_t powerPeak, int pstate, double powerScale, tmgr_trace_t powerTrace, int core, e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace, - xbt_dict_t properties) : - Resource(model, name, properties), CpuLmm(model, name, properties) { + xbt_dict_t properties) +: Resource(model, name, properties) +, CpuLmm(model, name, properties, core, xbt_dynar_get_as(powerPeak, pstate, double), powerScale) { p_powerEvent = NULL; - m_powerPeak = xbt_dynar_get_as(powerPeak, pstate, double); p_powerPeakList = powerPeak; m_pstate = pstate; @@ -212,7 +212,6 @@ CpuCas01Lmm::CpuCas01Lmm(CpuCas01ModelPtr model, const char *name, xbt_dynar_t p XBT_DEBUG("CPU create: peak=%f, pstate=%d", m_powerPeak, m_pstate); - m_powerScale = powerScale; m_core = core; p_stateCurrent = stateInitial; if (powerTrace) @@ -245,6 +244,9 @@ void CpuCas01Lmm::updateState(tmgr_trace_event_t event_type, double value, doubl lmm_element_t elem = NULL; if (event_type == p_powerEvent) { + /* TODO (Hypervisor): do the same thing for constraint_core[i] */ + xbt_assert(m_core == 1, "FIXME: add power scaling code also for constraint_core[i]"); + m_powerScale = value; lmm_update_constraint_bound(surf_cpu_model_pm->p_maxminSystem, p_constraint, m_core * m_powerScale * @@ -265,6 +267,9 @@ void CpuCas01Lmm::updateState(tmgr_trace_event_t event_type, double value, doubl if (tmgr_trace_event_free(event_type)) p_powerEvent = NULL; } else if (event_type == p_stateEvent) { + /* TODO (Hypervisor): do the same thing for constraint_core[i] */ + xbt_assert(m_core == 1, "FIXME: add state change code also for constraint_core[i]"); + if (value > 0) { if(p_stateCurrent == SURF_RESOURCE_OFF) xbt_dynar_push_as(host_that_restart, char*, (char *)m_name); diff --git a/src/surf/cpu_cas01.hpp b/src/surf/cpu_cas01.hpp index a75fa9e820..8ed959fb76 100644 --- a/src/surf/cpu_cas01.hpp +++ b/src/surf/cpu_cas01.hpp @@ -24,7 +24,7 @@ public: void (CpuCas01Model::*updateActionsState)(double now, double delta); void parseInit(sg_platf_host_cbarg_t host); - CpuCas01LmmPtr createResource(const char *name, xbt_dynar_t power_peak, int pstate, + CpuPtr createResource(const char *name, xbt_dynar_t power_peak, int pstate, double power_scale, tmgr_trace_t power_trace, int core, e_surf_resource_state_t state_initial, @@ -84,6 +84,6 @@ class CpuCas01ActionLmm: public CpuActionLmm { public: CpuCas01ActionLmm() {}; CpuCas01ActionLmm(ModelPtr model, double cost, bool failed): Action(model, cost, failed), CpuActionLmm(model, cost, failed) {}; + ~CpuCas01ActionLmm() {}; void updateEnergy(); - }; diff --git a/src/surf/cpu_ti.cpp b/src/surf/cpu_ti.cpp index 2be282c2c8..8cf2280cc7 100644 --- a/src/surf/cpu_ti.cpp +++ b/src/surf/cpu_ti.cpp @@ -10,10 +10,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_cpu_ti, surf_cpu, "Logging specific to the SURF CPU TRACE INTEGRATION module"); } -static xbt_swag_t cpu_ti_running_action_set_that_does_not_need_being_checked; -static xbt_swag_t cpu_ti_modified_cpu; -static xbt_heap_t cpu_ti_action_heap; - static void cpu_ti_action_update_index_heap(void *action, int i); /********* @@ -400,26 +396,31 @@ static void cpu_ti_define_callbacks() void surf_cpu_model_init_ti() { xbt_assert(!surf_cpu_model_pm,"CPU model already initialized. This should not happen."); + xbt_assert(!surf_cpu_model_vm,"CPU model already initialized. This should not happen."); + surf_cpu_model_pm = new CpuTiModel(); + surf_cpu_model_vm = new CpuTiModel(); + cpu_ti_define_callbacks(); - ModelPtr model = static_cast(surf_cpu_model_pm); - xbt_dynar_push(model_list, &model); + ModelPtr model_pm = static_cast(surf_cpu_model_pm); + ModelPtr model_vm = static_cast(surf_cpu_model_vm); + xbt_dynar_push(model_list, &model_pm); + xbt_dynar_push(model_list, &model_vm); } CpuTiModel::CpuTiModel() : CpuModel("cpu_ti") { - xbt_assert(!surf_cpu_model_pm,"CPU model already initialized. This should not happen."); ActionPtr action = NULL; - CpuTi cpu; + CpuTiPtr cpu; - cpu_ti_running_action_set_that_does_not_need_being_checked = + p_runningActionSetThatDoesNotNeedBeingChecked = xbt_swag_new(xbt_swag_offset(*action, p_stateHookup)); - cpu_ti_modified_cpu = - xbt_swag_new(xbt_swag_offset(cpu, p_modifiedCpuHookup)); + p_modifiedCpu = + xbt_swag_new(xbt_swag_offset(*cpu, p_modifiedCpuHookup)); - cpu_ti_action_heap = xbt_heap_new(8, NULL); - xbt_heap_set_update_callback(cpu_ti_action_heap, + p_tiActionHeap = xbt_heap_new(8, NULL); + xbt_heap_set_update_callback(p_tiActionHeap, cpu_ti_action_update_index_heap); } @@ -431,11 +432,9 @@ CpuTiModel::~CpuTiModel() surf_cpu_model_pm = NULL; - xbt_swag_free - (cpu_ti_running_action_set_that_does_not_need_being_checked); - xbt_swag_free(cpu_ti_modified_cpu); - cpu_ti_running_action_set_that_does_not_need_being_checked = NULL; - xbt_heap_free(cpu_ti_action_heap); + xbt_swag_free(p_runningActionSetThatDoesNotNeedBeingChecked); + xbt_swag_free(p_modifiedCpu); + xbt_heap_free(p_tiActionHeap); } void CpuTiModel::parseInit(sg_platf_host_cbarg_t host) @@ -468,7 +467,7 @@ CpuTiPtr CpuTiModel::createResource(const char *name, CpuTiPtr cpu = new CpuTi(this, name, powerPeak, pstate, powerScale, powerTrace, core, stateInitial, stateTrace, cpuProperties); xbt_lib_set(host_lib, name, SURF_CPU_LEVEL, static_cast(cpu)); - return (CpuTiPtr) xbt_lib_get_elm_or_null(host_lib, name); + return cpu; } CpuTiActionPtr CpuTiModel::createAction(double /*cost*/, bool /*failed*/) @@ -482,12 +481,12 @@ double CpuTiModel::shareResources(double now) double min_action_duration = -1; /* iterates over modified cpus to update share resources */ - xbt_swag_foreach_safe(_cpu, _cpu_next, cpu_ti_modified_cpu) { + xbt_swag_foreach_safe(_cpu, _cpu_next, p_modifiedCpu) { static_cast(_cpu)->updateActionFinishDate(now); } /* get the min next event if heap not empty */ - if (xbt_heap_size(cpu_ti_action_heap) > 0) - min_action_duration = xbt_heap_maxkey(cpu_ti_action_heap) - now; + if (xbt_heap_size(p_tiActionHeap) > 0) + min_action_duration = xbt_heap_maxkey(p_tiActionHeap) - now; XBT_DEBUG("Share resources, min next event date: %f", min_action_duration); @@ -496,9 +495,9 @@ double CpuTiModel::shareResources(double now) void CpuTiModel::updateActionsState(double now, double /*delta*/) { - while ((xbt_heap_size(cpu_ti_action_heap) > 0) - && (xbt_heap_maxkey(cpu_ti_action_heap) <= now)) { - CpuTiActionPtr action = (CpuTiActionPtr) xbt_heap_pop(cpu_ti_action_heap); + while ((xbt_heap_size(p_tiActionHeap) > 0) + && (xbt_heap_maxkey(p_tiActionHeap) <= now)) { + CpuTiActionPtr action = (CpuTiActionPtr) xbt_heap_pop(p_tiActionHeap); XBT_DEBUG("Action %p: finish", action); action->m_finish = surf_get_clock(); /* set the remains to 0 due to precision problems when updating the remaining amount */ @@ -572,8 +571,9 @@ void CpuTiModel::addTraces() CpuTi::CpuTi(CpuTiModelPtr model, const char *name, xbt_dynar_t powerPeak, int pstate, double powerScale, tmgr_trace_t powerTrace, int core, e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace, - xbt_dict_t properties) : - Resource(model, name, properties), Cpu(model, name, properties) { + xbt_dict_t properties) +: Resource(model, name, properties) +, Cpu(model, name, properties, core, 0, powerScale) { p_powerEvent = NULL; p_stateCurrent = stateInitial; m_powerScale = powerScale; @@ -632,7 +632,7 @@ void CpuTi::updateState(tmgr_trace_event_t event_type, value, date); /* update remaining of actions and put in modified cpu swag */ updateRemainingAmount(date); - xbt_swag_insert(this, cpu_ti_modified_cpu); + xbt_swag_insert(this, reinterpret_cast(p_model)->p_modifiedCpu); power_trace = p_availTrace->p_powerTrace; xbt_dynar_get_cpy(power_trace->s_list.event_list, @@ -667,7 +667,7 @@ void CpuTi::updateState(tmgr_trace_event_t event_type, action->setState(SURF_ACTION_FAILED); if (action->m_indexHeap >= 0) { CpuTiActionPtr heap_act = (CpuTiActionPtr) - xbt_heap_remove(cpu_ti_action_heap, action->m_indexHeap); + xbt_heap_remove(reinterpret_cast(p_model)->p_tiActionHeap, action->m_indexHeap); if (heap_act != action) DIE_IMPOSSIBLE; } @@ -745,12 +745,12 @@ updateRemainingAmount(now); XBT_DEBUG("action(%p) index %d", action, action->m_indexHeap); if (action->m_indexHeap >= 0) { CpuTiActionPtr heap_act = (CpuTiActionPtr) - xbt_heap_remove(cpu_ti_action_heap, action->m_indexHeap); + xbt_heap_remove(reinterpret_cast(p_model)->p_tiActionHeap, action->m_indexHeap); if (heap_act != action) DIE_IMPOSSIBLE; } if (min_finish != NO_MAX_DURATION) - xbt_heap_push(cpu_ti_action_heap, action, min_finish); + xbt_heap_push(reinterpret_cast(p_model)->p_tiActionHeap, action, min_finish); XBT_DEBUG ("Update finish time: Cpu(%s) Action: %p, Start Time: %f Finish Time: %f Max duration %f", @@ -759,7 +759,7 @@ updateRemainingAmount(now); action->m_maxDuration); } /* remove from modified cpu */ - xbt_swag_remove(this, cpu_ti_modified_cpu); + xbt_swag_remove(this, reinterpret_cast(p_model)->p_modifiedCpu); } bool CpuTi::isUsed() @@ -842,7 +842,7 @@ CpuTiActionPtr CpuTi::_execute(double size) action->p_cpu = this; action->m_indexHeap = -1; - xbt_swag_insert(this, cpu_ti_modified_cpu); + xbt_swag_insert(this, reinterpret_cast(p_model)->p_modifiedCpu); xbt_swag_insert(action, p_actionSet); @@ -867,7 +867,7 @@ CpuActionPtr CpuTi::sleep(double duration) /* Move to the *end* of the corresponding action set. This convention is used to speed up update_resource_state */ xbt_swag_remove(static_cast(action), action->p_stateSet); - action->p_stateSet = cpu_ti_running_action_set_that_does_not_need_being_checked; + action->p_stateSet = reinterpret_cast(p_model)->p_runningActionSetThatDoesNotNeedBeingChecked; xbt_swag_insert(static_cast(action), action->p_stateSet); } XBT_OUT(); @@ -894,7 +894,7 @@ void CpuTiAction::updateIndexHeap(int i) void CpuTiAction::setState(e_surf_action_state_t state) { Action::setState(state); - xbt_swag_insert(p_cpu, cpu_ti_modified_cpu); + xbt_swag_insert(p_cpu, reinterpret_cast(p_model)->p_modifiedCpu); } int CpuTiAction::unref() @@ -905,8 +905,8 @@ int CpuTiAction::unref() /* remove from action_set */ xbt_swag_remove(this, p_cpu->p_actionSet); /* remove from heap */ - xbt_heap_remove(cpu_ti_action_heap, this->m_indexHeap); - xbt_swag_insert(p_cpu, cpu_ti_modified_cpu); + xbt_heap_remove(reinterpret_cast(p_model)->p_tiActionHeap, this->m_indexHeap); + xbt_swag_insert(p_cpu, reinterpret_cast(p_model)->p_modifiedCpu); delete this; return 1; } @@ -916,8 +916,8 @@ int CpuTiAction::unref() void CpuTiAction::cancel() { this->setState(SURF_ACTION_FAILED); - xbt_heap_remove(cpu_ti_action_heap, this->m_indexHeap); - xbt_swag_insert(p_cpu, cpu_ti_modified_cpu); + xbt_heap_remove(p_model->p_actionHeap, this->m_indexHeap); + xbt_swag_insert(p_cpu, reinterpret_cast(p_model)->p_modifiedCpu); return; } @@ -931,8 +931,8 @@ void CpuTiAction::suspend() XBT_IN("(%p)", this); if (m_suspended != 2) { m_suspended = 1; - xbt_heap_remove(cpu_ti_action_heap, m_indexHeap); - xbt_swag_insert(p_cpu, cpu_ti_modified_cpu); + xbt_heap_remove(p_model->p_actionHeap, m_indexHeap); + xbt_swag_insert(p_cpu, reinterpret_cast(p_model)->p_modifiedCpu); } XBT_OUT(); } @@ -942,7 +942,7 @@ void CpuTiAction::resume() XBT_IN("(%p)", this); if (m_suspended != 2) { m_suspended = 0; - xbt_swag_insert(p_cpu, cpu_ti_modified_cpu); + xbt_swag_insert(p_cpu, reinterpret_cast(p_model)->p_modifiedCpu); } XBT_OUT(); } @@ -969,11 +969,11 @@ void CpuTiAction::setMaxDuration(double duration) /* add in action heap */ if (m_indexHeap >= 0) { CpuTiActionPtr heap_act = (CpuTiActionPtr) - xbt_heap_remove(cpu_ti_action_heap, m_indexHeap); + xbt_heap_remove(p_model->p_actionHeap, m_indexHeap); if (heap_act != this) DIE_IMPOSSIBLE; } - xbt_heap_push(cpu_ti_action_heap, this, min_finish); + xbt_heap_push(p_model->p_actionHeap, this, min_finish); XBT_OUT(); } @@ -982,7 +982,7 @@ void CpuTiAction::setPriority(double priority) { XBT_IN("(%p,%g)", this, priority); m_priority = priority; - xbt_swag_insert(p_cpu, cpu_ti_modified_cpu); + xbt_swag_insert(p_cpu, reinterpret_cast(p_model)->p_modifiedCpu); XBT_OUT(); } diff --git a/src/surf/cpu_ti.hpp b/src/surf/cpu_ti.hpp index eb31b86fca..edf240efa7 100644 --- a/src/surf/cpu_ti.hpp +++ b/src/surf/cpu_ti.hpp @@ -92,6 +92,10 @@ public: void updateActionsState(double now, double delta); void addTraces(); + xbt_swag_t p_runningActionSetThatDoesNotNeedBeingChecked; + xbt_swag_t p_modifiedCpu; + xbt_heap_t p_tiActionHeap; + protected: void NotifyResourceTurnedOn(ResourcePtr){}; void NotifyResourceTurnedOff(ResourcePtr){}; diff --git a/src/surf/network_constant.cpp b/src/surf/network_constant.cpp index 97deb3df36..55e6e3c46c 100644 --- a/src/surf/network_constant.cpp +++ b/src/surf/network_constant.cpp @@ -80,7 +80,7 @@ ActionPtr NetworkConstantModel::communicate(RoutingEdgePtr src, RoutingEdgePtr d char *dst_name = dst->p_name; XBT_IN("(%s,%s,%g,%g)", src_name, dst_name, size, rate); - NetworkConstantActionLmmPtr action = new NetworkConstantActionLmm(this, sg_latency_factor); + NetworkConstantActionLmmPtr action = new NetworkConstantActionLmm(this, size, sg_latency_factor); XBT_OUT(); return action; diff --git a/src/surf/network_constant.hpp b/src/surf/network_constant.hpp index c9c140d8f7..dc1c41606b 100644 --- a/src/surf/network_constant.hpp +++ b/src/surf/network_constant.hpp @@ -48,8 +48,8 @@ public: **********/ class NetworkConstantActionLmm : public NetworkCm02ActionLmm { public: - NetworkConstantActionLmm(NetworkConstantModelPtr model, double latency): - Action(model, 0, false), NetworkCm02ActionLmm(model, 0, false), m_latInit(latency) { + NetworkConstantActionLmm(NetworkConstantModelPtr model, double size, double latency): + Action(model, size, false), NetworkCm02ActionLmm(model, 0, false), m_latInit(latency) { m_latency = latency; if (m_latency <= 0.0) { p_stateSet = p_model->p_doneActionSet; diff --git a/src/surf/surf.cpp b/src/surf/surf.cpp index ee63af42ff..b8f653ee23 100644 --- a/src/surf/surf.cpp +++ b/src/surf/surf.cpp @@ -757,7 +757,8 @@ Action::Action(ModelPtr model, double cost, bool failed): m_maxDuration(NO_MAX_DURATION), m_cost(cost), p_model(model), - m_refcount(1) + m_refcount(1), + p_data(NULL) { #ifdef HAVE_TRACING p_category = NULL; diff --git a/src/surf/surf.hpp b/src/surf/surf.hpp index 770c293689..7a6b91bbd4 100644 --- a/src/surf/surf.hpp +++ b/src/surf/surf.hpp @@ -205,7 +205,9 @@ private: class ResourceLmm: virtual public Resource { public: - ResourceLmm() { p_power.event = NULL; }; + ResourceLmm() : p_constraint(NULL) { + p_power.event = NULL; + }; ResourceLmm(surf_model_t model, const char *name, xbt_dict_t props, lmm_system_t system, double constraint_value, @@ -214,7 +216,8 @@ public: tmgr_trace_t state_trace, double metric_peak, tmgr_trace_t metric_trace); - ~ResourceLmm() {}; + ~ResourceLmm() { + }; lmm_constraint_t p_constraint; tmgr_trace_event_t p_stateEvent; s_surf_metric_t p_power; @@ -276,7 +279,7 @@ protected: int m_refcount; #ifdef HAVE_TRACING #endif - e_UM_t p_updateMechanism; + //FIXME:removee_UM_t p_updateMechanism; private: int resourceUsed(void *resource_id); diff --git a/src/surf/vm_workstation.cpp b/src/surf/vm_workstation.cpp index 4f2dbc6997..6f868cc283 100644 --- a/src/surf/vm_workstation.cpp +++ b/src/surf/vm_workstation.cpp @@ -6,7 +6,6 @@ */ #include "vm_workstation.hpp" #include "cpu_cas01.hpp" -#include "maxmin_private.h" extern "C" { XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_vm_workstation, surf, @@ -40,7 +39,7 @@ void WorkstationVMModel::createResource(const char *name, void *ind_phys_worksta { WorkstationVM2013LmmPtr ws = new WorkstationVM2013Lmm(this, name, NULL, static_cast(ind_phys_workstation)); - xbt_lib_set(host_lib, name, SURF_WKS_LEVEL, ws); + xbt_lib_set(host_lib, name, SURF_WKS_LEVEL, static_cast(ws)); /* TODO: * - check how network requests are scheduled between distinct processes competing for the same card. @@ -180,7 +179,6 @@ double WorkstationVMModel::shareResources(double now) /************ * Resource * ************/ - WorkstationVM2013Lmm::WorkstationVM2013Lmm(WorkstationVMModelPtr model, const char* name, xbt_dict_t props, surf_resource_t ind_phys_workstation) : Resource(model, name, props), @@ -215,7 +213,7 @@ WorkstationVM2013Lmm::WorkstationVM2013Lmm(WorkstationVMModelPtr model, const ch /* We can assume one core and cas01 cpu for the first step. * Do xbt_lib_set(host_lib, name, SURF_CPU_LEVEL, cpu) if you get the resource. */ - static_cast(surf_cpu_model_vm)->createResource(name, // name + p_cpu = static_cast(surf_cpu_model_vm)->createResource(name, // name sub_cpu->p_powerPeakList, // host->power_peak, sub_cpu->m_pstate, 1, // host->power_scale, @@ -272,17 +270,7 @@ WorkstationVM2013Lmm::~WorkstationVM2013Lmm() int ret = p_action->unref(); xbt_assert(ret == 1, "Bug: some resource still remains"); - /* Free the cpu resource of the VM. If using power_trace, we will have to - * free other objects than lmm_constraint. */ - lmm_constraint_free(cpu->p_model->p_maxminSystem, cpu->p_constraint); - for (int i = 0; i < cpu->m_core; i++) { - void *cnst_id = cpu->p_constraintCore[i]->id; - lmm_constraint_free(cpu->p_model->p_maxminSystem, cpu->p_constraintCore[i]); - xbt_free(cnst_id); - } - - xbt_free(cpu->p_constraintCore); - + /* Free the cpu resource of the VM. If using power_trace, we will have to */ delete cpu; /* Free the network resource of the VM. */ diff --git a/src/surf/workstation_ptask_L07.cpp b/src/surf/workstation_ptask_L07.cpp index d4d810a133..383ff7785b 100644 --- a/src/surf/workstation_ptask_L07.cpp +++ b/src/surf/workstation_ptask_L07.cpp @@ -470,7 +470,7 @@ double WorkstationL07::getConsumedEnergy() } CpuL07::CpuL07(CpuL07ModelPtr model, const char* name, xbt_dict_t props) - : Resource(model, name, props), CpuLmm(model, name, props) { + : Resource(model, name, props), CpuLmm() { }