From e8b0c2495697cb3be4ea22a4b356e92d118e5a82 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Fri, 4 Dec 2015 13:28:38 +0100 Subject: [PATCH] further rename power to speed in surf internals --- src/surf/cpu_cas01.cpp | 24 ++++----- src/surf/cpu_cas01.hpp | 12 ++--- src/surf/cpu_interface.cpp | 16 +++--- src/surf/cpu_interface.hpp | 32 ++++++------ src/surf/cpu_ti.cpp | 90 +++++++++++++++++----------------- src/surf/cpu_ti.hpp | 14 +++--- src/surf/host_ptask_L07.cpp | 18 +++---- src/surf/host_ptask_L07.hpp | 8 +-- src/surf/network_cm02.cpp | 24 ++++----- src/surf/network_interface.cpp | 2 +- src/surf/network_interface.hpp | 2 +- 11 files changed, 121 insertions(+), 121 deletions(-) diff --git a/src/surf/cpu_cas01.cpp b/src/surf/cpu_cas01.cpp index cd0b597e60..a260cd0653 100644 --- a/src/surf/cpu_cas01.cpp +++ b/src/surf/cpu_cas01.cpp @@ -162,14 +162,14 @@ CpuCas01::CpuCas01(CpuCas01Model *model, const char *name, xbt_dynar_t powerPeak lmm_constraint_new(model->getMaxminSystem(), this, core * powerScale * xbt_dynar_get_as(powerPeak, pstate, double)), core, xbt_dynar_get_as(powerPeak, pstate, double), powerScale, stateInitial) { - p_powerEvent = NULL; + p_speedEvent = NULL; // Copy the power peak array: - p_powerPeakList = xbt_dynar_new(sizeof(double), nullptr); + p_speedPeakList = xbt_dynar_new(sizeof(double), nullptr); unsigned long n = xbt_dynar_length(powerPeak); for (unsigned long i = 0; i != n; ++i) { double value = xbt_dynar_get_as(powerPeak, i, double); - xbt_dynar_push(p_powerPeakList, &value); + xbt_dynar_push(p_speedPeakList, &value); } m_pstate = pstate; @@ -178,7 +178,7 @@ CpuCas01::CpuCas01(CpuCas01Model *model, const char *name, xbt_dynar_t powerPeak m_core = core; if (powerTrace) - p_powerEvent = tmgr_history_add_trace(history, powerTrace, 0.0, 0, this); + p_speedEvent = tmgr_history_add_trace(history, powerTrace, 0.0, 0, this); if (stateTrace) p_stateEvent = tmgr_history_add_trace(history, stateTrace, 0.0, 0, this); @@ -186,7 +186,7 @@ CpuCas01::CpuCas01(CpuCas01Model *model, const char *name, xbt_dynar_t powerPeak CpuCas01::~CpuCas01(){ if (getModel() == surf_cpu_model_pm) - xbt_dynar_free(&p_powerPeakList); + xbt_dynar_free(&p_speedPeakList); } void CpuCas01::setStateEvent(tmgr_trace_event_t stateEvent) @@ -196,11 +196,11 @@ void CpuCas01::setStateEvent(tmgr_trace_event_t stateEvent) void CpuCas01::setPowerEvent(tmgr_trace_event_t powerEvent) { - p_powerEvent = powerEvent; + p_speedEvent = powerEvent; } xbt_dynar_t CpuCas01::getPowerPeakList(){ - return p_powerPeakList; + return p_speedPeakList; } int CpuCas01::getPState() @@ -218,7 +218,7 @@ void CpuCas01::updateState(tmgr_trace_event_t event_type, double value, double d lmm_variable_t var = NULL; lmm_element_t elem = NULL; - if (event_type == p_powerEvent) { + if (event_type == p_speedEvent) { /* 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]"); @@ -238,7 +238,7 @@ void CpuCas01::updateState(tmgr_trace_event_t event_type, double value, double d m_speedScale * m_speedPeak); } if (tmgr_trace_event_free(event_type)) - p_powerEvent = NULL; + p_speedEvent = 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]"); @@ -326,7 +326,7 @@ double CpuCas01::getCurrentPowerPeak() double CpuCas01::getPowerPeakAt(int pstate_index) { - xbt_dynar_t plist = p_powerPeakList; + xbt_dynar_t plist = p_speedPeakList; xbt_assert((pstate_index <= (int)xbt_dynar_length(plist)), "Invalid parameters (pstate index out of bounds)"); return xbt_dynar_get_as(plist, pstate_index, double); @@ -334,12 +334,12 @@ double CpuCas01::getPowerPeakAt(int pstate_index) int CpuCas01::getNbPstates() { - return xbt_dynar_length(p_powerPeakList); + return xbt_dynar_length(p_speedPeakList); } void CpuCas01::setPstate(int pstate_index) { - xbt_dynar_t plist = p_powerPeakList; + xbt_dynar_t plist = p_speedPeakList; xbt_assert((pstate_index <= (int)xbt_dynar_length(plist)), "Invalid parameters (pstate index out of bounds)"); double new_pstate = xbt_dynar_get_as(plist, pstate_index, double); diff --git a/src/surf/cpu_cas01.hpp b/src/surf/cpu_cas01.hpp index 316df92b94..e3f03b5c11 100644 --- a/src/surf/cpu_cas01.hpp +++ b/src/surf/cpu_cas01.hpp @@ -26,9 +26,9 @@ public: double (CpuCas01Model::*shareResources)(double now); void (CpuCas01Model::*updateActionsState)(double now, double delta); - Cpu *createCpu(const char *name, xbt_dynar_t power_peak, int pstate, - double power_scale, - tmgr_trace_t power_trace, int core, + Cpu *createCpu(const char *name, xbt_dynar_t speedPeak, int pstate, + double speedScale, + tmgr_trace_t speedTrace, int core, e_surf_resource_state_t state_initial, tmgr_trace_t state_trace, xbt_dict_t cpu_properties); @@ -66,9 +66,9 @@ public: 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)*/ + tmgr_trace_event_t p_speedEvent; + xbt_dynar_t p_speedPeakList; /*< List of supported CPU capacities (pstate related) */ + int m_pstate; /*< Current pstate (index in the speedPeakList)*/ }; /********** diff --git a/src/surf/cpu_interface.cpp b/src/surf/cpu_interface.cpp index 59bdfcd94e..39f1cb9cd9 100644 --- a/src/surf/cpu_interface.cpp +++ b/src/surf/cpu_interface.cpp @@ -147,12 +147,12 @@ Cpu::Cpu(Model *model, const char *name, xbt_dict_t props, } Cpu::Cpu(Model *model, const char *name, xbt_dict_t props, - lmm_constraint_t constraint, int core, double powerPeak, - double powerScale, e_surf_resource_state_t stateInitial) + lmm_constraint_t constraint, int core, double speedPeak, + double speedScale, e_surf_resource_state_t stateInitial) : Resource(model, name, props, constraint, stateInitial) , m_core(core) - , m_speedPeak(powerPeak) - , m_speedScale(powerScale) + , m_speedPeak(speedPeak) + , m_speedScale(speedScale) { /* At now, we assume that a VM does not have a multicore CPU. */ if (core > 1) @@ -174,13 +174,13 @@ Cpu::Cpu(Model *model, const char *name, xbt_dict_t props, } Cpu::Cpu(Model *model, const char *name, xbt_dict_t props, - lmm_constraint_t constraint, int core, double powerPeak, double powerScale) -: Cpu(model, name, props, constraint, core, powerPeak, powerScale, SURF_RESOURCE_ON) + lmm_constraint_t constraint, int core, double speedPeak, double speedScale) +: Cpu(model, name, props, constraint, core, speedPeak, speedScale, SURF_RESOURCE_ON) {} Cpu::Cpu(Model *model, const char *name, xbt_dict_t props, - int core, double powerPeak, double powerScale) -: Cpu(model, name, props, core, powerPeak, powerScale, SURF_RESOURCE_ON) + int core, double speedPeak, double speedScale) +: Cpu(model, name, props, core, speedPeak, speedScale, SURF_RESOURCE_ON) {} Cpu::~Cpu(){ diff --git a/src/surf/cpu_interface.hpp b/src/surf/cpu_interface.hpp index 5ccd0c3e52..385164f704 100644 --- a/src/surf/cpu_interface.hpp +++ b/src/surf/cpu_interface.hpp @@ -65,18 +65,18 @@ public: * @brief Create a Cpu * * @param name The name of the Cpu - * @param power_peak The power peak of this Cpu + * @param speedPeak The peak spead (max speed in Flops) * @param pstate [TODO] - * @param power_scale The power scale of this Cpu - * @param power_trace [TODO] + * @param speedScale The speed scale (in [O;1] available speed from peak) + * @param speedTrace Trace variations * @param core The number of core of this Cpu * @param state_initial [TODO] * @param state_trace [TODO] * @param cpu_properties Dictionary of properties associated to this Cpu */ - virtual Cpu *createCpu(const char *name, xbt_dynar_t power_peak, - int pstate, double power_scale, - tmgr_trace_t power_trace, int core, + virtual Cpu *createCpu(const char *name, xbt_dynar_t speedPeak, + int pstate, double speedScale, + tmgr_trace_t speedTrace, int core, e_surf_resource_state_t state_initial, tmgr_trace_t state_trace, xbt_dict_t cpu_properties)=0; @@ -106,11 +106,11 @@ public: * @param props Dictionary of properties associated to this Cpu * @param constraint The lmm constraint associated to this Cpu if it is part of a LMM component * @param core The number of core of this Cpu - * @param powerPeak The power peak of this Cpu - * @param powerScale The power scale of this Cpu + * @param speedPeak The speed peak of this Cpu + * @param speedScale The speed scale of this Cpu */ Cpu(Model *model, const char *name, xbt_dict_t props, - lmm_constraint_t constraint, int core, double powerPeak, double powerScale, + lmm_constraint_t constraint, int core, double speedPeak, double speedScale, e_surf_resource_state_t stateInitial); /** @@ -120,17 +120,17 @@ public: * @param name The name of the Cpu * @param props Dictionary of properties associated to this Cpu * @param core The number of core of this Cpu - * @param powerPeak The power peak of this Cpu in [TODO] - * @param powerScale The power scale of this Cpu in [TODO] + * @param speedPeak The speed peak of this Cpu in flops (max speed) + * @param speedScale The speed scale of this Cpu in [0;1] (available amount) */ Cpu(Model *model, const char *name, xbt_dict_t props, - int core, double powerPeak, double powerScale, + int core, double speedPeak, double speedScale, e_surf_resource_state_t stateInitial); Cpu(Model *model, const char *name, xbt_dict_t props, - lmm_constraint_t constraint, int core, double powerPeak, double powerScale); + lmm_constraint_t constraint, int core, double speedPeak, double speedScale); Cpu(Model *model, const char *name, xbt_dict_t props, - int core, double powerPeak, double powerScale); + int core, double speedPeak, double speedScale); ~Cpu(); @@ -150,10 +150,10 @@ public: */ virtual Action *sleep(double duration)=0; - /** @brief Get the number of cores of the current Cpu */ + /** @brief Get the amount of cores */ virtual int getCore(); - /** @brief Get the speed of the current Cpu */ + /** @brief Get the speed, accounting for the trace load and provided process load instead of the real current one */ virtual double getSpeed(double load); /** @brief Get the available speed of the current Cpu */ diff --git a/src/surf/cpu_ti.cpp b/src/surf/cpu_ti.cpp index 881cde6447..3e2d91be93 100644 --- a/src/surf/cpu_ti.cpp +++ b/src/surf/cpu_ti.cpp @@ -20,7 +20,7 @@ static void cpu_ti_action_update_index_heap(void *action, int i); * Trace * *********/ -CpuTiTrace::CpuTiTrace(tmgr_trace_t power_trace) +CpuTiTrace::CpuTiTrace(tmgr_trace_t speedTrace) { s_tmgr_event_t val; unsigned int cpt; @@ -28,11 +28,11 @@ CpuTiTrace::CpuTiTrace(tmgr_trace_t power_trace) double time = 0; int i = 0; p_timePoints = (double*) xbt_malloc0(sizeof(double) * - (xbt_dynar_length(power_trace->s_list.event_list) + 1)); + (xbt_dynar_length(speedTrace->s_list.event_list) + 1)); p_integral = (double*) xbt_malloc0(sizeof(double) * - (xbt_dynar_length(power_trace->s_list.event_list) + 1)); - m_nbPoints = xbt_dynar_length(power_trace->s_list.event_list) + 1; - xbt_dynar_foreach(power_trace->s_list.event_list, cpt, val) { + (xbt_dynar_length(speedTrace->s_list.event_list) + 1)); + m_nbPoints = xbt_dynar_length(speedTrace->s_list.event_list) + 1; + xbt_dynar_foreach(speedTrace->s_list.event_list, cpt, val) { p_timePoints[i] = time; p_integral[i] = integral; integral += val.delta * val.value; @@ -279,12 +279,12 @@ double CpuTiTrace::solveSimple(double a, double amount) } /** -* \brief Auxiliary function to update the CPU power scale. +* \brief Auxiliary function to update the CPU speed scale. * -* This function uses the trace structure to return the power scale at the determined time a. -* \param trace Trace structure to search the updated power scale +* This function uses the trace structure to return the speed scale at the determined time a. +* \param trace Trace structure to search the updated speed scale * \param a Time -* \return CPU power scale +* \return CPU speed scale */ double CpuTiTgmr::getPowerScale(double a) { @@ -295,19 +295,19 @@ double CpuTiTgmr::getPowerScale(double a) reduced_a = a - floor(a / m_lastTime) * m_lastTime; point = p_trace->binarySearch(p_trace->p_timePoints, reduced_a, 0, p_trace->m_nbPoints - 1); - xbt_dynar_get_cpy(p_powerTrace->s_list.event_list, point, &val); + xbt_dynar_get_cpy(p_speedTrace->s_list.event_list, point, &val); return val.value; } /** * \brief Creates a new integration trace from a tmgr_trace_t * -* \param power_trace CPU availability trace -* \param value Percentage of CPU power available (useful to fixed tracing) +* \param speedTrace CPU availability trace +* \param value Percentage of CPU speed available (useful to fixed tracing) * \param spacing Initial spacing * \return Integration trace structure */ -CpuTiTgmr::CpuTiTgmr(tmgr_trace_t power_trace, double value) +CpuTiTgmr::CpuTiTgmr(tmgr_trace_t speedTrace, double value) { double total_time = 0.0; s_tmgr_event_t val; @@ -315,7 +315,7 @@ CpuTiTgmr::CpuTiTgmr(tmgr_trace_t power_trace, double value) p_trace = 0; /* no availability file, fixed trace */ - if (!power_trace) { + if (!speedTrace) { m_type = TRACE_FIXED; m_value = value; XBT_DEBUG("No availability trace. Constant value = %f", value); @@ -323,21 +323,21 @@ CpuTiTgmr::CpuTiTgmr(tmgr_trace_t power_trace, double value) } /* only one point available, fixed trace */ - if (xbt_dynar_length(power_trace->s_list.event_list) == 1) { - xbt_dynar_get_cpy(power_trace->s_list.event_list, 0, &val); + if (xbt_dynar_length(speedTrace->s_list.event_list) == 1) { + xbt_dynar_get_cpy(speedTrace->s_list.event_list, 0, &val); m_type = TRACE_FIXED; m_value = val.value; return; } m_type = TRACE_DYNAMIC; - p_powerTrace = power_trace; + p_speedTrace = speedTrace; /* count the total time of trace file */ - xbt_dynar_foreach(power_trace->s_list.event_list, cpt, val) { + xbt_dynar_foreach(speedTrace->s_list.event_list, cpt, val) { total_time += val.delta; } - p_trace = new CpuTiTrace(power_trace); + p_trace = new CpuTiTrace(speedTrace); m_lastTime = total_time; m_total = p_trace->integrateSimple(0, total_time); @@ -423,10 +423,10 @@ CpuTiModel::~CpuTiModel() } Cpu *CpuTiModel::createCpu(const char *name, - xbt_dynar_t powerPeak, + xbt_dynar_t speedPeak, int pstate, - double powerScale, - tmgr_trace_t powerTrace, + double speedScale, + tmgr_trace_t speedTrace, int core, e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace, @@ -434,9 +434,9 @@ Cpu *CpuTiModel::createCpu(const char *name, { xbt_assert(core==1,"Multi-core not handled with this model yet"); sg_host_t host = sg_host_by_name(name); - xbt_assert(xbt_dynar_getfirst_as(powerPeak, double) > 0.0, - "Power has to be >0.0. Did you forget to specify the mandatory power attribute?"); - CpuTi *cpu = new CpuTi(this, name, powerPeak, pstate, powerScale, powerTrace, + xbt_assert(xbt_dynar_getfirst_as(speedPeak, double) > 0.0, + "Speed has to be >0.0. Did you forget to specify the mandatory speed attribute?"); + CpuTi *cpu = new CpuTi(this, name, speedPeak, pstate, speedScale, speedTrace, core, stateInitial, stateTrace, cpuProperties); sg_host_surfcpu_register(host, cpu); return cpu; @@ -513,7 +513,7 @@ void CpuTiModel::addTraces() xbt_assert(cpu, "Host %s undefined", elm); xbt_assert(trace, "Trace %s undefined", trace_name); - XBT_DEBUG("Add power trace: %s to CPU(%s)", trace_name, elm); + XBT_DEBUG("Add speed trace: %s to CPU(%s)", trace_name, elm); if (cpu->p_availTrace) delete cpu->p_availTrace; @@ -527,7 +527,7 @@ void CpuTiModel::addTraces() if (val.delta == 0) { tmgr_trace_t empty_trace; empty_trace = tmgr_empty_trace_new(); - cpu->p_powerEvent = + cpu->p_speedEvent = tmgr_history_add_trace(history, empty_trace, cpu->p_availTrace->m_lastTime, 0, cpu); } @@ -538,37 +538,37 @@ void CpuTiModel::addTraces() /************ * Resource * ************/ -CpuTi::CpuTi(CpuTiModel *model, const char *name, xbt_dynar_t powerPeak, - int pstate, double powerScale, tmgr_trace_t powerTrace, int core, +CpuTi::CpuTi(CpuTiModel *model, const char *name, xbt_dynar_t speedPeak, + int pstate, double speedScale, tmgr_trace_t speedTrace, int core, e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace, xbt_dict_t properties) - : Cpu(model, name, properties, core, 0, powerScale, stateInitial) + : Cpu(model, name, properties, core, 0, speedScale, stateInitial) { - p_powerEvent = NULL; - m_speedScale = powerScale; + p_speedEvent = NULL; + m_speedScale = speedScale; m_core = core; tmgr_trace_t empty_trace; s_tmgr_event_t val; xbt_assert(core==1,"Multi-core not handled with this model yet"); - XBT_DEBUG("power scale %f", powerScale); - p_availTrace = new CpuTiTgmr(powerTrace, powerScale); + XBT_DEBUG("speed scale %f", speedScale); + p_availTrace = new CpuTiTgmr(speedTrace, speedScale); p_actionSet = new ActionTiList(); m_lastUpdate = 0; - xbt_dynar_get_cpy(powerPeak, 0, &m_speedPeak); + xbt_dynar_get_cpy(speedPeak, 0, &m_speedPeak); XBT_DEBUG("CPU create: peak=%f", m_speedPeak); if (stateTrace) p_stateEvent = tmgr_history_add_trace(history, stateTrace, 0.0, 0, this); - if (powerTrace && xbt_dynar_length(powerTrace->s_list.event_list) > 1) { + if (speedTrace && xbt_dynar_length(speedTrace->s_list.event_list) > 1) { // add a fake trace event if periodicity == 0 - xbt_dynar_get_cpy(powerTrace->s_list.event_list, - xbt_dynar_length(powerTrace->s_list.event_list) - 1, &val); + xbt_dynar_get_cpy(speedTrace->s_list.event_list, + xbt_dynar_length(speedTrace->s_list.event_list) - 1, &val); if (val.delta == 0) { empty_trace = tmgr_empty_trace_new(); - p_powerEvent = + p_speedEvent = tmgr_history_add_trace(history, empty_trace, p_availTrace->m_lastTime, 0, this); } @@ -586,8 +586,8 @@ void CpuTi::updateState(tmgr_trace_event_t event_type, { CpuTiAction *action; - if (event_type == p_powerEvent) { - tmgr_trace_t power_trace; + if (event_type == p_speedEvent) { + tmgr_trace_t speedTrace; CpuTiTgmr *trace; s_tmgr_event_t val; @@ -598,9 +598,9 @@ void CpuTi::updateState(tmgr_trace_event_t event_type, modified(true); - power_trace = p_availTrace->p_powerTrace; - xbt_dynar_get_cpy(power_trace->s_list.event_list, - xbt_dynar_length(power_trace->s_list.event_list) - 1, &val); + speedTrace = p_availTrace->p_speedTrace; + xbt_dynar_get_cpy(speedTrace->s_list.event_list, + xbt_dynar_length(speedTrace->s_list.event_list) - 1, &val); /* free old trace */ delete p_availTrace; m_speedScale = val.value; @@ -611,7 +611,7 @@ void CpuTi::updateState(tmgr_trace_event_t event_type, p_availTrace = trace; if (tmgr_trace_event_free(event_type)) - p_powerEvent = NULL; + p_speedEvent = NULL; } else if (event_type == p_stateEvent) { if (value > 0) { diff --git a/src/surf/cpu_ti.hpp b/src/surf/cpu_ti.hpp index cf4016b6e4..3c860f132c 100644 --- a/src/surf/cpu_ti.hpp +++ b/src/surf/cpu_ti.hpp @@ -69,7 +69,7 @@ public: double m_total; /*< Integral total between 0 and last_pointn */ CpuTiTrace *p_trace; - tmgr_trace_t p_powerTrace; + tmgr_trace_t p_speedTrace; }; /********** @@ -116,8 +116,8 @@ typedef boost::intrusive::list< class CpuTi : public Cpu { public: CpuTi() {}; - CpuTi(CpuTiModel *model, const char *name, xbt_dynar_t powerPeak, - int pstate, double powerScale, tmgr_trace_t powerTrace, int core, + CpuTi(CpuTiModel *model, const char *name, xbt_dynar_t speedPeak, + int pstate, double speedScale, tmgr_trace_t speedTrace, int core, e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace, xbt_dict_t properties) ; ~CpuTi(); @@ -139,7 +139,7 @@ public: CpuTiTgmr *p_availTrace; /*< Structure with data needed to integrate trace file */ tmgr_trace_event_t p_stateEvent; /*< trace file with states events (ON or OFF) */ - tmgr_trace_event_t p_powerEvent; /*< trace file with availability events */ + tmgr_trace_event_t p_speedEvent; /*< trace file with availability events */ ActionTiList *p_actionSet; /*< set with all actions running on cpu */ double m_sumPriority; /*< the sum of actions' priority that are running on cpu */ double m_lastUpdate; /*< last update of actions' remaining amount done */ @@ -162,9 +162,9 @@ class CpuTiModel : public CpuModel { public: CpuTiModel(); ~CpuTiModel(); - Cpu *createCpu(const char *name, xbt_dynar_t powerPeak, - int pstate, double power_scale, - tmgr_trace_t power_trace, int core, + Cpu *createCpu(const char *name, xbt_dynar_t speedPeak, + int pstate, double speedScale, + tmgr_trace_t speedTrace, int core, e_surf_resource_state_t state_initial, tmgr_trace_t state_trace, xbt_dict_t cpu_properties); diff --git a/src/surf/host_ptask_L07.cpp b/src/surf/host_ptask_L07.cpp index 10c4af5f93..ff196aa18d 100644 --- a/src/surf/host_ptask_L07.cpp +++ b/src/surf/host_ptask_L07.cpp @@ -364,7 +364,7 @@ void HostL07Model::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, host); + host->p_speedEvent = tmgr_history_add_trace(history, trace, 0.0, 0, host); } /* Connect traces relative to network */ @@ -409,17 +409,17 @@ HostL07::HostL07(HostModel *model, const char* name, xbt_dict_t props, RoutingEd } CpuL07::CpuL07(CpuL07Model *model, const char* name, xbt_dict_t props, - double power_initial, double power_scale, tmgr_trace_t power_trace, + double speedInitial, double speedScale, tmgr_trace_t speedTrace, int core, e_surf_resource_state_t state_initial, tmgr_trace_t state_trace) - : Cpu(model, name, props, lmm_constraint_new(ptask_maxmin_system, this, power_initial * power_scale), - core, power_initial, power_scale, state_initial) + : Cpu(model, name, props, lmm_constraint_new(ptask_maxmin_system, this, speedInitial * speedScale), + core, speedInitial, speedScale, state_initial) { xbt_assert(m_speedScale > 0, "Power has to be >0"); - if (power_trace) - p_powerEvent = tmgr_history_add_trace(history, power_trace, 0.0, 0, this); + if (speedTrace) + p_speedEvent = tmgr_history_add_trace(history, speedTrace, 0.0, 0, this); else - p_powerEvent = NULL; + p_speedEvent = NULL; if (state_trace) p_stateEvent = tmgr_history_add_trace(history, state_trace, 0.0, 0, this); @@ -488,11 +488,11 @@ bool LinkL07::isUsed(){ void CpuL07::updateState(tmgr_trace_event_t event_type, double value, double /*date*/){ XBT_DEBUG("Updating cpu %s (%p) with value %g", getName(), this, value); - if (event_type == p_powerEvent) { + if (event_type == p_speedEvent) { m_speedScale = value; lmm_update_constraint_bound(ptask_maxmin_system, getConstraint(), m_speedPeak * m_speedScale); if (tmgr_trace_event_free(event_type)) - p_powerEvent = NULL; + p_speedEvent = NULL; } else if (event_type == p_stateEvent) { if (value > 0) setState(SURF_RESOURCE_ON); diff --git a/src/surf/host_ptask_L07.hpp b/src/surf/host_ptask_L07.hpp index a401b12a32..40d0fa591c 100644 --- a/src/surf/host_ptask_L07.hpp +++ b/src/surf/host_ptask_L07.hpp @@ -52,9 +52,9 @@ class CpuL07Model : public CpuModel { public: CpuL07Model(HostL07Model *hmodel) : CpuModel() {p_hostModel = hmodel;}; ~CpuL07Model() {surf_cpu_model_pm = NULL;}; - Cpu *createCpu(const char *name, xbt_dynar_t powerPeak, - int pstate, double power_scale, - tmgr_trace_t power_trace, int core, + Cpu *createCpu(const char *name, xbt_dynar_t speedPeak, + int pstate, double speedScale, + tmgr_trace_t speedTrace, int core, e_surf_resource_state_t state_initial, tmgr_trace_t state_trace, xbt_dict_t cpu_properties); @@ -102,7 +102,7 @@ public: class CpuL07 : public Cpu { friend void HostL07Model::addTraces(); tmgr_trace_event_t p_stateEvent; - tmgr_trace_event_t p_powerEvent; + tmgr_trace_event_t p_speedEvent; public: CpuL07(CpuL07Model *model, const char* name, xbt_dict_t properties, double power_scale, double power_initial, tmgr_trace_t power_trace, diff --git a/src/surf/network_cm02.cpp b/src/surf/network_cm02.cpp index 1d5b5941a4..ff820b286c 100644 --- a/src/surf/network_cm02.cpp +++ b/src/surf/network_cm02.cpp @@ -404,7 +404,7 @@ Action *NetworkCm02Model::communicate(RoutingEdge *src, RoutingEdge *dst, } xbt_dynar_foreach(route, i, _link) { link = static_cast(_link); - double bb = bandwidthFactor(size) * link->getBandwidth(); //(link->p_power.peak * link->p_power.scale); + double bb = bandwidthFactor(size) * link->getBandwidth(); bandwidth_bound = (bandwidth_bound < 0.0) ? bb : min(bandwidth_bound, bb); } @@ -498,7 +498,7 @@ void NetworkCm02Model::addTraces(){ "Cannot connect trace %s to link %s: trace undefined", trace_name, elm); - link->p_power.event = tmgr_history_add_trace(history, trace, 0.0, 0, link); + link->p_speed.event = tmgr_history_add_trace(history, trace, 0.0, 0, link); } xbt_dict_foreach(trace_connect_list_latency, cursor, trace_name, elm) { @@ -533,12 +533,12 @@ NetworkCm02Link::NetworkCm02Link(NetworkCm02Model *model, const char *name, xbt_ { setState(state_init); - p_power.scale = 1.0; - p_power.peak = metric_peak; + p_speed.scale = 1.0; + p_speed.peak = metric_peak; if (metric_trace) - p_power.event = tmgr_history_add_trace(history, metric_trace, 0.0, 0, this); + p_speed.event = tmgr_history_add_trace(history, metric_trace, 0.0, 0, this); else - p_power.event = NULL; + p_speed.event = NULL; m_latCurrent = lat_initial; if (lat_trace) @@ -557,10 +557,10 @@ void NetworkCm02Link::updateState(tmgr_trace_event_t event_type, /* "%g" " for event %p\n", surf_get_clock(), nw_link->name, */ /* value, event_type); */ - if (event_type == p_power.event) { + if (event_type == p_speed.event) { updateBandwidth(value, date); if (tmgr_trace_event_free(event_type)) - p_power.event = NULL; + p_speed.event = NULL; } else if (event_type == p_latEvent) { updateLatency(value, date); if (tmgr_trace_event_free(event_type)) @@ -599,7 +599,7 @@ void NetworkCm02Link::updateState(tmgr_trace_event_t event_type, void NetworkCm02Link::updateBandwidth(double value, double date){ double delta = sg_weight_S_parameter / value - sg_weight_S_parameter / - (p_power.peak * p_power.scale); + (p_speed.peak * p_speed.scale); lmm_variable_t var = NULL; lmm_element_t elem = NULL; lmm_element_t nextelem = NULL; @@ -607,12 +607,12 @@ void NetworkCm02Link::updateBandwidth(double value, double date){ NetworkCm02Action *action = NULL; - p_power.peak = value; + p_speed.peak = value; lmm_update_constraint_bound(getModel()->getMaxminSystem(), getConstraint(), sg_bandwidth_factor * - (p_power.peak * p_power.scale)); - TRACE_surf_link_set_bandwidth(date, getName(), sg_bandwidth_factor * p_power.peak * p_power.scale); + (p_speed.peak * p_speed.scale)); + TRACE_surf_link_set_bandwidth(date, getName(), sg_bandwidth_factor * p_speed.peak * p_speed.scale); if (sg_weight_S_parameter > 0) { while ((var = lmm_get_var_from_cnst_safe(getModel()->getMaxminSystem(), getConstraint(), &elem, &nextelem, &numelem))) { action = (NetworkCm02Action*) lmm_variable_id(var); diff --git a/src/surf/network_interface.cpp b/src/surf/network_interface.cpp index 6ef24c45f3..15df730be1 100644 --- a/src/surf/network_interface.cpp +++ b/src/surf/network_interface.cpp @@ -216,7 +216,7 @@ double Link::getLatency() double Link::getBandwidth() { - return p_power.peak * p_power.scale; + return p_speed.peak * p_speed.scale; } int Link::sharingPolicy() diff --git a/src/surf/network_interface.hpp b/src/surf/network_interface.hpp index ec90a5cfaf..5b12fc9912 100644 --- a/src/surf/network_interface.hpp +++ b/src/surf/network_interface.hpp @@ -232,7 +232,7 @@ public: /* LMM */ tmgr_trace_event_t p_stateEvent = NULL; - s_surf_metric_t p_power; + s_surf_metric_t p_speed; /* User data */ public: -- 2.20.1