From: Martin Quinson Date: Sat, 19 Mar 2016 02:51:57 +0000 (+0100) Subject: remove speedTrace from the CPU constructor X-Git-Tag: v3_13~371 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/bab5efc96624e2d815745cd0c9c0b29118d88f39 remove speedTrace from the CPU constructor --- diff --git a/src/surf/cpu_cas01.cpp b/src/surf/cpu_cas01.cpp index 1ccdcb8426..dabefd7490 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 speedPeak, tmgr_trace_t speedTrace, int core) +Cpu *CpuCas01Model::createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedList, int core) { - xbt_assert(xbt_dynar_getfirst_as(speedPeak, double) > 0.0, + xbt_assert(xbt_dynar_getfirst_as(speedList, 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, speedPeak, speedTrace, core); + return new CpuCas01(this, host, speedList, core); } double CpuCas01Model::next_occuring_event_full(double /*now*/) @@ -98,18 +98,14 @@ double CpuCas01Model::next_occuring_event_full(double /*now*/) /************ * Resource * ************/ -CpuCas01::CpuCas01(CpuCas01Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeak, - tmgr_trace_t speedTrace, int core) +CpuCas01::CpuCas01(CpuCas01Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedList, int core) : Cpu(model, host, - lmm_constraint_new(model->getMaxminSystem(), this, core * xbt_dynar_get_as(speedPeak, 0/*pstate*/, double)), - speedPeak, core, xbt_dynar_get_as(speedPeak, 0/*pstate*/, double)) + 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)) { - XBT_DEBUG("CPU create: peak=%f, pstate=%d", speed_.peak, pstate_); coresAmount_ = core; - if (speedTrace) - speed_.event = future_evt_set->add_trace(speedTrace, 0.0, this); } CpuCas01::~CpuCas01() diff --git a/src/surf/cpu_cas01.hpp b/src/surf/cpu_cas01.hpp index 393455224d..6c43dd7619 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 speedPeak, tmgr_trace_t speedTrace, int core) override; + Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedList, int core) override; double next_occuring_event_full(double now) override; ActionList *p_cpuRunningActionSetThatDoesNotNeedBeingChecked; }; @@ -38,8 +38,7 @@ public: class CpuCas01 : public Cpu { public: - CpuCas01(CpuCas01Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeak, - tmgr_trace_t speedTrace, int core); + CpuCas01(CpuCas01Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedList, 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.hpp b/src/surf/cpu_interface.hpp index 1b050c8082..a0c958cba4 100644 --- a/src/surf/cpu_interface.hpp +++ b/src/surf/cpu_interface.hpp @@ -43,11 +43,10 @@ public: * @brief Create a Cpu * * @param host The host that will have this CPU - * @param speedPeak The peak spead (max speed in Flops when no external load comes from a trace) - * @param speedTrace Speed variations + * @param speedList The peak speed (max speed in Flops when no external load comes from a trace) for each pstate * @param core The number of core of this Cpu */ - virtual Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPeak, tmgr_trace_t speedTrace, int core)=0; + virtual Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedList, int core)=0; void updateActionsStateLazy(double now, double delta); void updateActionsStateFull(double now, double delta); @@ -70,7 +69,7 @@ public: * @param model The CpuModel associated to this Cpu * @param host The host in which this Cpu should be plugged * @param constraint The lmm constraint associated to this Cpu if it is part of a LMM component - * @param speedPeakList [TODO] + * @param speedList [TODO] * @param core The number of core of this Cpu * @param speedPeak The speed peak of this Cpu in flops (max speed) */ diff --git a/src/surf/cpu_ti.cpp b/src/surf/cpu_ti.cpp index 1b21c4511e..6dfd69e7ce 100644 --- a/src/surf/cpu_ti.cpp +++ b/src/surf/cpu_ti.cpp @@ -414,15 +414,12 @@ CpuTiModel::~CpuTiModel() xbt_heap_free(tiActionHeap_); } -Cpu *CpuTiModel::createCpu(simgrid::s4u::Host *host, - xbt_dynar_t speedPeak, - tmgr_trace_t speedTrace, - int core) +Cpu *CpuTiModel::createCpu(simgrid::s4u::Host *host, xbt_dynar_t speeds, int core) { xbt_assert(core==1,"Multi-core not handled with this model yet"); - xbt_assert(xbt_dynar_getfirst_as(speedPeak, double) > 0.0, + xbt_assert(xbt_dynar_getfirst_as(speeds, double) > 0.0, "Speed has to be >0.0. Did you forget to specify the mandatory speed attribute?"); - return new CpuTi(this, host, speedPeak, speedTrace, core); + return new CpuTi(this, host, speeds, core); } double CpuTiModel::next_occuring_event(double now) @@ -464,20 +461,18 @@ void CpuTiModel::updateActionsState(double now, double /*delta*/) /************ * Resource * ************/ -CpuTi::CpuTi(CpuTiModel *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeak, - tmgr_trace_t speedTrace, int core) +CpuTi::CpuTi(CpuTiModel *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeak, int core) : Cpu(model, host, NULL, core, 0) { xbt_assert(core==1,"Multi-core not handled by this model yet"); coresAmount_ = core; - actionSet_ = new ActionTiList(); xbt_dynar_get_cpy(speedPeak, 0, &speed_.peak); XBT_DEBUG("CPU create: peak=%f", speed_.peak); - setSpeedTrace(speedTrace); + speedIntegratedTrace_ = new CpuTiTgmr(NULL, 1/*scale*/); } CpuTi::~CpuTi() diff --git a/src/surf/cpu_ti.hpp b/src/surf/cpu_ti.hpp index 3f531d8921..5e737a67f8 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, tmgr_trace_t speedTrace, int core); + CpuTi(CpuTiModel *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeak, int core); ~CpuTi(); void setSpeedTrace(tmgr_trace_t trace) override; @@ -147,8 +147,7 @@ class CpuTiModel : public CpuModel { public: CpuTiModel(); ~CpuTiModel(); - Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPeak, - tmgr_trace_t speedTrace, int core) override; + Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speeds, int core) override; double next_occuring_event(double now) override; void updateActionsState(double now, double delta) override; diff --git a/src/surf/ptask_L07.cpp b/src/surf/ptask_L07.cpp index 31d8c77d62..9c70b312e4 100644 --- a/src/surf/ptask_L07.cpp +++ b/src/surf/ptask_L07.cpp @@ -264,28 +264,23 @@ Action *NetworkL07Model::communicate(NetCard *src, NetCard *dst, sg_host_t*host_list = xbt_new0(sg_host_t, 2); double *flops_amount = xbt_new0(double, 2); double *bytes_amount = xbt_new0(double, 4); - Action *res = NULL; host_list[0] = sg_host_by_name(src->name()); host_list[1] = sg_host_by_name(dst->name()); bytes_amount[1] = size; - res = p_hostModel->executeParallelTask(2, host_list, flops_amount, bytes_amount, rate); - - return res; + return p_hostModel->executeParallelTask(2, host_list, flops_amount, bytes_amount, rate); } -Cpu *CpuL07Model::createCpu(simgrid::s4u::Host *host, xbt_dynar_t powerPeakList, - tmgr_trace_t power_trace, int core) +Cpu *CpuL07Model::createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedsList, int core) { - return new CpuL07(this, host, powerPeakList, power_trace, core); + return new CpuL07(this, host, speedsList, core); } Link* NetworkL07Model::createLink(const char *name, double bandwidth, double latency, e_surf_link_sharing_policy_t policy, xbt_dict_t properties) { - xbt_assert(!Link::byName(name), - "Link '%s' declared several times in the platform.", name); + xbt_assert(!Link::byName(name), "Link '%s' declared several times in the platform.", name); Link* link = new LinkL07(this, name, properties, bandwidth, latency, policy); Link::onCreation(link); @@ -296,16 +291,10 @@ Link* NetworkL07Model::createLink(const char *name, double bandwidth, double lat * Resource * ************/ -CpuL07::CpuL07(CpuL07Model *model, simgrid::s4u::Host *host, - xbt_dynar_t speedPeakList, - tmgr_trace_t speedTrace, - int core) - : Cpu(model, host, speedPeakList, core, xbt_dynar_get_as(speedPeakList,0,double)) +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)) { - p_constraint = lmm_constraint_new(model->getMaxminSystem(), this, xbt_dynar_get_as(speedPeakList,0,double)); - - if (speedTrace) - speed_.event = future_evt_set->add_trace(speedTrace, 0.0, this); + p_constraint = lmm_constraint_new(model->getMaxminSystem(), this, xbt_dynar_get_as(speedList,0,double)); } CpuL07::~CpuL07() diff --git a/src/surf/ptask_L07.hpp b/src/surf/ptask_L07.hpp index ea5c913d80..1fc2a88072 100644 --- a/src/surf/ptask_L07.hpp +++ b/src/surf/ptask_L07.hpp @@ -54,8 +54,7 @@ public: CpuL07Model(HostL07Model *hmodel,lmm_system_t sys); ~CpuL07Model(); - Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPeakList, - tmgr_trace_t speedTrace, int core) override; + Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedsList, int core) override; HostL07Model *p_hostModel; }; @@ -79,7 +78,7 @@ public: class CpuL07 : public Cpu { public: - CpuL07(CpuL07Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeakList, tmgr_trace_t power_trace, int core); + CpuL07(CpuL07Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedList, int core); ~CpuL07(); bool isUsed() override; void apply_event(tmgr_trace_iterator_t event, double value) override; diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index c1b9bdfe7d..5236231be1 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -115,10 +115,11 @@ 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_trace, host->core_amount); if (host->state_trace) cpu->setStateTrace(host->state_trace); + if (host->speed_trace) + cpu->setSpeedTrace(host->speed_trace); surf_host_model->createHost(host->id, netcard, cpu, host->properties)->attach(h); if (host->pstate != 0) diff --git a/src/surf/vm_hl13.cpp b/src/surf/vm_hl13.cpp index 893902807d..63248cf617 100644 --- a/src/surf/vm_hl13.cpp +++ b/src/surf/vm_hl13.cpp @@ -131,9 +131,7 @@ VMHL13::VMHL13(VMModel *model, const char* name, xbt_dict_t props, sg_host_t hos CpuCas01 *sub_cpu = static_cast(host_PM->pimpl_cpu); p_cpu = surf_cpu_model_vm->createCpu(host_VM, // the machine hosting the VM - sub_cpu->getSpeedPeakList(), // host->speed_peak, - NULL, // host->speed_trace, - 1); // host->core_amount, + sub_cpu->getSpeedPeakList(), 1 /*cores*/); if (sub_cpu->getPState() != 0) p_cpu->setPState(sub_cpu->getPState());