From 9fc9b3239f3f2a3a5441fe5c8bac82c1ffa3c9d0 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sat, 19 Mar 2016 23:14:06 +0100 Subject: [PATCH] get a better name for the speedPerPstate attribute in CPU --- src/bindings/lua/lua_platf.cpp | 8 ++++---- src/surf/cpu_cas01.cpp | 16 ++++++++-------- src/surf/cpu_cas01.hpp | 4 ++-- src/surf/cpu_interface.cpp | 24 ++++++++++++------------ src/surf/cpu_interface.hpp | 10 +++++----- src/surf/cpu_ti.cpp | 4 ++-- src/surf/cpu_ti.hpp | 2 +- src/surf/instr_routing.cpp | 2 +- src/surf/ptask_L07.cpp | 10 +++++----- src/surf/ptask_L07.hpp | 2 +- src/surf/sg_platf.cpp | 20 ++++++++++---------- src/surf/xml/platf_private.hpp | 2 +- src/surf/xml/surfxml_sax_cb.cpp | 8 ++++---- 13 files changed, 56 insertions(+), 56 deletions(-) diff --git a/src/bindings/lua/lua_platf.cpp b/src/bindings/lua/lua_platf.cpp index 5fb2ccd447..c20e7c4beb 100644 --- a/src/bindings/lua/lua_platf.cpp +++ b/src/bindings/lua/lua_platf.cpp @@ -181,11 +181,11 @@ int console_add_host(lua_State *L) { if (type != LUA_TSTRING && type != LUA_TNUMBER) { XBT_ERROR("Attribute 'speed' must be specified for host and must either be a string (in the correct format; check documentation) or a number."); } - host.speed_peak = xbt_dynar_new(sizeof(double), NULL); + host.speed_per_pstate = xbt_dynar_new(sizeof(double), NULL); if (type == LUA_TNUMBER) - xbt_dynar_push_as(host.speed_peak, double, lua_tointeger(L, -1)); + xbt_dynar_push_as(host.speed_per_pstate, double, lua_tointeger(L, -1)); else // LUA_TSTRING - xbt_dynar_push_as(host.speed_peak, double, surf_parse_get_speed(lua_tostring(L, -1), "speed of host", host.id)); + xbt_dynar_push_as(host.speed_per_pstate, double, surf_parse_get_speed(lua_tostring(L, -1), "speed of host", host.id)); lua_pop(L, 1); // get core @@ -216,7 +216,7 @@ int console_add_host(lua_State *L) { lua_pop(L, 1); sg_platf_new_host(&host); - xbt_dynar_free(&host.speed_peak); + xbt_dynar_free(&host.speed_per_pstate); return 0; } diff --git a/src/surf/cpu_cas01.cpp b/src/surf/cpu_cas01.cpp index dabefd7490..0a7f39155b 100644 --- a/src/surf/cpu_cas01.cpp +++ b/src/surf/cpu_cas01.cpp @@ -82,12 +82,12 @@ CpuCas01Model::~CpuCas01Model() delete p_cpuRunningActionSetThatDoesNotNeedBeingChecked; } -Cpu *CpuCas01Model::createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedList, int core) +Cpu *CpuCas01Model::createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPerPstate, int core) { - xbt_assert(xbt_dynar_getfirst_as(speedList, double) > 0.0, + xbt_assert(xbt_dynar_getfirst_as(speedPerPstate, double) > 0.0, "Speed has to be >0.0. Did you forget to specify the mandatory power attribute?"); xbt_assert(core > 0, "Invalid number of cores %d. Must be larger than 0", core); - return new CpuCas01(this, host, speedList, core); + return new CpuCas01(this, host, speedPerPstate, core); } double CpuCas01Model::next_occuring_event_full(double /*now*/) @@ -98,10 +98,10 @@ double CpuCas01Model::next_occuring_event_full(double /*now*/) /************ * Resource * ************/ -CpuCas01::CpuCas01(CpuCas01Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedList, int core) +CpuCas01::CpuCas01(CpuCas01Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedPerPstate, int core) : Cpu(model, host, - lmm_constraint_new(model->getMaxminSystem(), this, core * xbt_dynar_get_as(speedList, 0/*pstate*/, double)), - speedList, core, xbt_dynar_get_as(speedList, 0/*pstate*/, double)) + lmm_constraint_new(model->getMaxminSystem(), this, core * xbt_dynar_get_as(speedPerPstate, 0/*pstate*/, double)), + speedPerPstate, core, xbt_dynar_get_as(speedPerPstate, 0/*pstate*/, double)) { XBT_DEBUG("CPU create: peak=%f, pstate=%d", speed_.peak, pstate_); @@ -111,11 +111,11 @@ CpuCas01::CpuCas01(CpuCas01Model *model, simgrid::s4u::Host *host, xbt_dynar_t s CpuCas01::~CpuCas01() { if (getModel() == surf_cpu_model_pm) - xbt_dynar_free(&speedPeakList_); + xbt_dynar_free(&speedPerPstate_); } xbt_dynar_t CpuCas01::getSpeedPeakList(){ - return speedPeakList_; + return speedPerPstate_; } bool CpuCas01::isUsed() diff --git a/src/surf/cpu_cas01.hpp b/src/surf/cpu_cas01.hpp index 6c43dd7619..cee99343e9 100644 --- a/src/surf/cpu_cas01.hpp +++ b/src/surf/cpu_cas01.hpp @@ -27,7 +27,7 @@ public: CpuCas01Model(); ~CpuCas01Model(); - Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedList, int core) override; + Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPerPstate, int core) override; double next_occuring_event_full(double now) override; ActionList *p_cpuRunningActionSetThatDoesNotNeedBeingChecked; }; @@ -38,7 +38,7 @@ public: class CpuCas01 : public Cpu { public: - CpuCas01(CpuCas01Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedList, int core); + CpuCas01(CpuCas01Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedPerPstate, int core); ~CpuCas01(); void apply_event(tmgr_trace_iterator_t event, double value) override; CpuAction *execution_start(double size) override; diff --git a/src/surf/cpu_interface.cpp b/src/surf/cpu_interface.cpp index ccdad63294..6da354f5b0 100644 --- a/src/surf/cpu_interface.cpp +++ b/src/surf/cpu_interface.cpp @@ -134,13 +134,13 @@ void CpuModel::updateActionsStateFull(double now, double delta) * Resource * ************/ Cpu::Cpu(Model *model, simgrid::s4u::Host *host, - xbt_dynar_t speedPeakList, int core, double speedPeak) - : Cpu(model, host, NULL/*constraint*/, speedPeakList, core, speedPeak) + xbt_dynar_t speedPerPstate, int core, double speedPeak) + : Cpu(model, host, NULL/*constraint*/, speedPerPstate, core, speedPeak) { } Cpu::Cpu(Model *model, simgrid::s4u::Host *host, lmm_constraint_t constraint, - xbt_dynar_t speedPeakList, int core, double speedPeak) + xbt_dynar_t speedPerPstate, int core, double speedPeak) : Resource(model, host->name().c_str(), constraint) , coresAmount_(core) , host_(host) @@ -151,11 +151,11 @@ Cpu::Cpu(Model *model, simgrid::s4u::Host *host, lmm_constraint_t constraint, xbt_assert(speed_.scale > 0, "Available speed has to be >0"); // Copy the power peak array: - speedPeakList_ = xbt_dynar_new(sizeof(double), nullptr); - unsigned long n = xbt_dynar_length(speedPeakList); + speedPerPstate_ = xbt_dynar_new(sizeof(double), nullptr); + unsigned long n = xbt_dynar_length(speedPerPstate); for (unsigned long i = 0; i != n; ++i) { - double value = xbt_dynar_get_as(speedPeakList, i, double); - xbt_dynar_push(speedPeakList_, &value); + double value = xbt_dynar_get_as(speedPerPstate, i, double); + xbt_dynar_push(speedPerPstate_, &value); } /* Currently, we assume that a VM does not have a multicore CPU. */ @@ -185,8 +185,8 @@ Cpu::~Cpu() } if (p_constraintCoreId) xbt_free(p_constraintCoreId); - if (speedPeakList_) - xbt_dynar_free(&speedPeakList_); + if (speedPerPstate_) + xbt_dynar_free(&speedPerPstate_); } double Cpu::getCurrentPowerPeak() @@ -196,12 +196,12 @@ double Cpu::getCurrentPowerPeak() int Cpu::getNbPStates() { - return xbt_dynar_length(speedPeakList_); + return xbt_dynar_length(speedPerPstate_); } void Cpu::setPState(int pstate_index) { - xbt_dynar_t plist = speedPeakList_; + xbt_dynar_t plist = speedPerPstate_; xbt_assert(pstate_index <= (int)xbt_dynar_length(plist), "Invalid parameters for CPU %s (pstate %d > length of pstates %d)", getName(), pstate_index, (int)xbt_dynar_length(plist)); @@ -219,7 +219,7 @@ int Cpu::getPState() double Cpu::getPowerPeakAt(int pstate_index) { - xbt_dynar_t plist = speedPeakList_; + xbt_dynar_t plist = speedPerPstate_; 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); diff --git a/src/surf/cpu_interface.hpp b/src/surf/cpu_interface.hpp index a0c958cba4..2de8e3ad00 100644 --- a/src/surf/cpu_interface.hpp +++ b/src/surf/cpu_interface.hpp @@ -43,10 +43,10 @@ public: * @brief Create a Cpu * * @param host The host that will have this CPU - * @param speedList The peak speed (max speed in Flops when no external load comes from a trace) for each pstate + * @param speedPerPstate Processor speed (in Flops) of each pstate. This ignores any potential external load coming from a trace. * @param core The number of core of this Cpu */ - virtual Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedList, int core)=0; + virtual Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPerPstate, int core)=0; void updateActionsStateLazy(double now, double delta); void updateActionsStateFull(double now, double delta); @@ -81,12 +81,12 @@ public: * * @param model The CpuModel associated to this Cpu * @param host The host in which this Cpu should be plugged - * @param speedPeakList [TODO] + * @param speedPerPstate Processor speed (in flop per second) for each pstate * @param core The number of core of this Cpu * @param speedPeak The speed peak of this Cpu in flops (max speed) */ Cpu(simgrid::surf::Model *model, simgrid::s4u::Host *host, - xbt_dynar_t speedPeakList, int core, double speedPeak); + xbt_dynar_t speedPerPstate, int core, double speedPeak); ~Cpu(); @@ -135,7 +135,7 @@ public: int coresAmount_ = 1; simgrid::s4u::Host* host_; - xbt_dynar_t speedPeakList_ = NULL; /*< List of supported CPU capacities (pstate related) */ + xbt_dynar_t speedPerPstate_ = NULL; /*< List of supported CPU capacities (pstate related) */ int pstate_ = 0; /*< Current pstate (index in the speedPeakList)*/ /* Note (hypervisor): */ diff --git a/src/surf/cpu_ti.cpp b/src/surf/cpu_ti.cpp index 6dfd69e7ce..d094a12bec 100644 --- a/src/surf/cpu_ti.cpp +++ b/src/surf/cpu_ti.cpp @@ -461,7 +461,7 @@ void CpuTiModel::updateActionsState(double now, double /*delta*/) /************ * Resource * ************/ -CpuTi::CpuTi(CpuTiModel *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeak, int core) +CpuTi::CpuTi(CpuTiModel *model, simgrid::s4u::Host *host, xbt_dynar_t speedPerPstate, int core) : Cpu(model, host, NULL, core, 0) { xbt_assert(core==1,"Multi-core not handled by this model yet"); @@ -469,7 +469,7 @@ CpuTi::CpuTi(CpuTiModel *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeak, actionSet_ = new ActionTiList(); - xbt_dynar_get_cpy(speedPeak, 0, &speed_.peak); + xbt_dynar_get_cpy(speedPerPstate, 0, &speed_.peak); XBT_DEBUG("CPU create: peak=%f", speed_.peak); speedIntegratedTrace_ = new CpuTiTgmr(NULL, 1/*scale*/); diff --git a/src/surf/cpu_ti.hpp b/src/surf/cpu_ti.hpp index 5e737a67f8..ea853280a5 100644 --- a/src/surf/cpu_ti.hpp +++ b/src/surf/cpu_ti.hpp @@ -110,7 +110,7 @@ typedef boost::intrusive::list ActionTiList; ************/ class CpuTi : public Cpu { public: - CpuTi(CpuTiModel *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeak, int core); + CpuTi(CpuTiModel *model, simgrid::s4u::Host *host, xbt_dynar_t speedPerPstate, int core); ~CpuTi(); void setSpeedTrace(tmgr_trace_t trace) override; diff --git a/src/surf/instr_routing.cpp b/src/surf/instr_routing.cpp index 4523960ef6..ad7511791a 100644 --- a/src/surf/instr_routing.cpp +++ b/src/surf/instr_routing.cpp @@ -269,7 +269,7 @@ void sg_instr_new_host(sg_platf_host_cbarg_t host) } double current_speed_state; - xbt_dynar_get_cpy(host->speed_peak, host->pstate, ¤t_speed_state); + xbt_dynar_get_cpy(host->speed_per_pstate, host->pstate, ¤t_speed_state); new_pajeSetVariable (0, container, speed, current_speed_state); } if (TRACE_uncategorized()){ diff --git a/src/surf/ptask_L07.cpp b/src/surf/ptask_L07.cpp index 0f34db8807..a5f933953c 100644 --- a/src/surf/ptask_L07.cpp +++ b/src/surf/ptask_L07.cpp @@ -271,9 +271,9 @@ Action *NetworkL07Model::communicate(NetCard *src, NetCard *dst, double size, do return p_hostModel->executeParallelTask(2, host_list, flops_amount, bytes_amount, rate); } -Cpu *CpuL07Model::createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedsList, int core) +Cpu *CpuL07Model::createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPerPstate, int core) { - return new CpuL07(this, host, speedsList, core); + return new CpuL07(this, host, speedPerPstate, core); } Link* NetworkL07Model::createLink(const char *name, double bandwidth, double latency, @@ -286,10 +286,10 @@ Link* NetworkL07Model::createLink(const char *name, double bandwidth, double lat * Resource * ************/ -CpuL07::CpuL07(CpuL07Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedList, int core) - : Cpu(model, host, speedList, core, xbt_dynar_get_as(speedList,0,double)) +CpuL07::CpuL07(CpuL07Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedPerPstate, int core) + : Cpu(model, host, speedPerPstate, core, xbt_dynar_get_as(speedPerPstate,0,double)) { - p_constraint = lmm_constraint_new(model->getMaxminSystem(), this, xbt_dynar_get_as(speedList,0,double)); + p_constraint = lmm_constraint_new(model->getMaxminSystem(), this, xbt_dynar_get_as(speedPerPstate,0,double)); } CpuL07::~CpuL07() diff --git a/src/surf/ptask_L07.hpp b/src/surf/ptask_L07.hpp index 1fc2a88072..403ad2bc3b 100644 --- a/src/surf/ptask_L07.hpp +++ b/src/surf/ptask_L07.hpp @@ -54,7 +54,7 @@ public: CpuL07Model(HostL07Model *hmodel,lmm_system_t sys); ~CpuL07Model(); - Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedsList, int core) override; + Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPerPstate, int core) override; HostL07Model *p_hostModel; }; diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index 5236231be1..f65533f1c6 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -114,7 +114,7 @@ void sg_platf_new_host(sg_platf_host_cbarg_t host) simgrid::surf::Cpu *cpu = surf_cpu_model_pm->createCpu( h, - host->speed_peak, + host->speed_per_pstate, host->core_amount); if (host->state_trace) cpu->setStateTrace(host->state_trace); @@ -289,15 +289,15 @@ void sg_platf_new_cluster(sg_platf_cluster_cbarg_t cluster) XBT_DEBUG("\tstate_file=\"\""); } - host.speed_peak = xbt_dynar_new(sizeof(double), NULL); - xbt_dynar_push(host.speed_peak,&cluster->speed); + host.speed_per_pstate = xbt_dynar_new(sizeof(double), NULL); + xbt_dynar_push(host.speed_per_pstate,&cluster->speed); host.pstate = 0; //host.power_peak = cluster->power; host.core_amount = cluster->core_amount; host.coord = ""; sg_platf_new_host(&host); - xbt_dynar_free(&host.speed_peak); + xbt_dynar_free(&host.speed_per_pstate); XBT_DEBUG(""); XBT_DEBUG("", link_id, @@ -474,10 +474,10 @@ void sg_platf_new_cabinet(sg_platf_cabinet_cbarg_t cabinet) link_id = bprintf("link_%s%d%s",cabinet->prefix,i,cabinet->suffix); host.id = host_id; link.id = link_id; - host.speed_peak = xbt_dynar_new(sizeof(double), NULL); - xbt_dynar_push(host.speed_peak,&cabinet->speed); + host.speed_per_pstate = xbt_dynar_new(sizeof(double), NULL); + xbt_dynar_push(host.speed_per_pstate,&cabinet->speed); sg_platf_new_host(&host); - xbt_dynar_free(&host.speed_peak); + xbt_dynar_free(&host.speed_per_pstate); sg_platf_new_link(&link); char* link_up = bprintf("%s_UP",link_id); @@ -724,15 +724,15 @@ void sg_platf_new_peer(sg_platf_peer_cbarg_t peer) memset(&host, 0, sizeof(host)); host.id = host_id; - host.speed_peak = xbt_dynar_new(sizeof(double), NULL); - xbt_dynar_push(host.speed_peak,&peer->speed); + host.speed_per_pstate = xbt_dynar_new(sizeof(double), NULL); + xbt_dynar_push(host.speed_per_pstate,&peer->speed); host.pstate = 0; //host.power_peak = peer->power; host.speed_trace = peer->availability_trace; host.state_trace = peer->state_trace; host.core_amount = 1; sg_platf_new_host(&host); - xbt_dynar_free(&host.speed_peak); + xbt_dynar_free(&host.speed_per_pstate); s_sg_platf_link_cbarg_t link = SG_PLATF_LINK_INITIALIZER; memset(&link, 0, sizeof(link)); diff --git a/src/surf/xml/platf_private.hpp b/src/surf/xml/platf_private.hpp index f3c11b3a3e..f2996deb57 100644 --- a/src/surf/xml/platf_private.hpp +++ b/src/surf/xml/platf_private.hpp @@ -41,7 +41,7 @@ typedef enum { typedef struct { const char* id; - xbt_dynar_t speed_peak; + xbt_dynar_t speed_per_pstate; int pstate; int core_amount; tmgr_trace_t speed_trace; diff --git a/src/surf/xml/surfxml_sax_cb.cpp b/src/surf/xml/surfxml_sax_cb.cpp index d98e65ebd3..659d682858 100644 --- a/src/surf/xml/surfxml_sax_cb.cpp +++ b/src/surf/xml/surfxml_sax_cb.cpp @@ -455,10 +455,10 @@ void ETag_surfxml_host(void) { buf = A_surfxml_host_speed; XBT_DEBUG("Buffer: %s", buf); - host.speed_peak = xbt_dynar_new(sizeof(double), nullptr); + host.speed_per_pstate = xbt_dynar_new(sizeof(double), nullptr); if (strchr(buf, ',') == nullptr){ double speed = surf_parse_get_speed(A_surfxml_host_speed,"speed of host", host.id); - xbt_dynar_push_as(host.speed_peak,double, speed); + xbt_dynar_push_as(host.speed_per_pstate,double, speed); } else { xbt_dynar_t pstate_list = xbt_str_split(buf, ","); @@ -470,7 +470,7 @@ void ETag_surfxml_host(void) { xbt_dynar_get_cpy(pstate_list, i, &speed_str); xbt_str_trim(speed_str, nullptr); speed = surf_parse_get_speed(speed_str,"speed of host", host.id); - xbt_dynar_push_as(host.speed_peak, double, speed); + xbt_dynar_push_as(host.speed_per_pstate, double, speed); XBT_DEBUG("Speed value: %f", speed); } xbt_dynar_free(&pstate_list); @@ -484,7 +484,7 @@ void ETag_surfxml_host(void) { host.coord = A_surfxml_host_coordinates; sg_platf_new_host(&host); - xbt_dynar_free(&host.speed_peak); + xbt_dynar_free(&host.speed_per_pstate); current_property_set = nullptr; } -- 2.20.1