From: Paul Bédaride Date: Thu, 13 Feb 2014 15:31:22 +0000 (+0100) Subject: Clean surf cpu cas01 X-Git-Tag: v3_11_beta~29 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/93a112bc3b5933cdc80d562bd637223ba4c26f60 Clean surf cpu cas01 --- diff --git a/src/surf/cpu_cas01.cpp b/src/surf/cpu_cas01.cpp index ab90f351a6..abc038568b 100644 --- a/src/surf/cpu_cas01.cpp +++ b/src/surf/cpu_cas01.cpp @@ -171,7 +171,7 @@ void CpuCas01Model::addTraces() xbt_assert(host, "Host %s undefined", elm); xbt_assert(trace, "Trace %s undefined", trace_name); - host->p_stateEvent = tmgr_history_add_trace(history, trace, 0.0, 0, static_cast(host)); + host->setStateEvent(tmgr_history_add_trace(history, trace, 0.0, 0, static_cast(host))); } xbt_dict_foreach(trace_connect_list_power, cursor, trace_name, elm) { @@ -181,8 +181,7 @@ void CpuCas01Model::addTraces() xbt_assert(host, "Host %s undefined", elm); xbt_assert(trace, "Trace %s undefined", trace_name); - host->p_powerEvent = - tmgr_history_add_trace(history, trace, 0.0, 0, static_cast(host)); + host->setPowerEvent(tmgr_history_add_trace(history, trace, 0.0, 0, static_cast(host))); } } @@ -216,6 +215,25 @@ CpuCas01::~CpuCas01(){ xbt_dynar_free(&p_powerPeakList); } +void CpuCas01::setStateEvent(tmgr_trace_event_t stateEvent) +{ + p_stateEvent = stateEvent; +} + +void CpuCas01::setPowerEvent(tmgr_trace_event_t powerEvent) +{ + p_powerEvent = powerEvent; +} + +xbt_dynar_t CpuCas01::getPowerPeakList(){ + return p_powerPeakList; +} + +int CpuCas01::getPState() +{ + return m_pstate; +} + bool CpuCas01::isUsed() { return lmm_constraint_used(getModel()->getMaxminSystem(), getConstraint()); diff --git a/src/surf/cpu_cas01.hpp b/src/surf/cpu_cas01.hpp index 3f8ccb1483..685cd4cbc2 100644 --- a/src/surf/cpu_cas01.hpp +++ b/src/surf/cpu_cas01.hpp @@ -44,18 +44,8 @@ public: /************ * Resource * ************/ -/* - * Energy-related properties for the cpu_cas01 model - */ -typedef struct energy_cpu_cas01 { - xbt_dynar_t power_range_watts_list; /*< List of (min_power,max_power) pairs corresponding to each cpu pstate */ - double total_energy; /*< Total energy consumed by the host */ - double last_updated; /*< Timestamp of the last energy update event*/ -} s_energy_cpu_cas01_t, *energy_cpu_cas01_t; class CpuCas01 : public Cpu { -public://FIXME: - tmgr_trace_event_t p_stateEvent; public: CpuCas01(CpuCas01ModelPtr model, const char *name, xbt_dynar_t power_peak, int pstate, double powerScale, tmgr_trace_t powerTrace, int core, @@ -70,9 +60,15 @@ public: double getPowerPeakAt(int pstate_index); int getNbPstates(); void setPowerPeakAt(int pstate_index); - bool isUsed(); + void setStateEvent(tmgr_trace_event_t stateEvent); + void setPowerEvent(tmgr_trace_event_t stateEvent); + xbt_dynar_t getPowerPeakList(); + int getPState(); + +private: + tmgr_trace_event_t p_stateEvent; tmgr_trace_event_t p_powerEvent; xbt_dynar_t p_powerPeakList; /*< List of supported CPU capacities */ int m_pstate; /*< Current pstate (index in the power_peak_list)*/ diff --git a/src/surf/plugins/energy.cpp b/src/surf/plugins/energy.cpp index 40a87b573e..993ac0b7ed 100644 --- a/src/surf/plugins/energy.cpp +++ b/src/surf/plugins/energy.cpp @@ -112,7 +112,7 @@ double CpuEnergy::getCurrentWattsValue(double cpu_load) cpu->getName());*/ /* retrieve the power values associated with the current pstate */ - xbt_dynar_t current_power_values = xbt_dynar_get_as(power_range_list, static_cast(cpu)->m_pstate, xbt_dynar_t); + xbt_dynar_t current_power_values = xbt_dynar_get_as(power_range_list, static_cast(cpu)->getPState(), xbt_dynar_t); /* min_power corresponds to the idle power (cpu load = 0) */ /* max_power is the power consumed at 100% cpu load */ diff --git a/src/surf/vm_workstation_hl13.cpp b/src/surf/vm_workstation_hl13.cpp index 4bea656817..054e3498da 100644 --- a/src/surf/vm_workstation_hl13.cpp +++ b/src/surf/vm_workstation_hl13.cpp @@ -251,8 +251,8 @@ WorkstationVMHL13::WorkstationVMHL13(WorkstationVMModelPtr model, const char* na * Do xbt_lib_set(host_lib, name, SURF_CPU_LEVEL, cpu) if you get the resource. */ p_cpu = static_cast(surf_cpu_model_vm)->createResource(name, // name - sub_cpu->p_powerPeakList, // host->power_peak, - sub_cpu->m_pstate, + sub_cpu->getPowerPeakList(), // host->power_peak, + sub_cpu->getPState(), 1, // host->power_scale, NULL, // host->power_trace, 1, // host->core_amount,