From: Martin Quinson Date: Fri, 1 Jan 2016 20:54:23 +0000 (+0100) Subject: some cleanups in the CPU constructor hierarchy X-Git-Tag: v3_13~1372 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/685c03b7bc7bbc0d98ad42ecf48eff00ca702976 some cleanups in the CPU constructor hierarchy --- diff --git a/src/surf/cpu_interface.cpp b/src/surf/cpu_interface.cpp index 1b843c0253..302d3935e6 100644 --- a/src/surf/cpu_interface.cpp +++ b/src/surf/cpu_interface.cpp @@ -133,6 +133,7 @@ void CpuModel::updateActionsStateFull(double now, double delta) ************/ Cpu::Cpu() { + xbt_die("FIXME: DEADCODE"); } @@ -140,23 +141,8 @@ Cpu::Cpu(Model *model, simgrid::Host *host, xbt_dynar_t speedPeakList, int pstate, int core, double speedPeak, double speedScale, e_surf_resource_state_t stateInitial) - : Resource(model, host->getName().c_str(), stateInitial) - , m_core(core) - , m_speedPeak(speedPeak) - , m_speedScale(speedScale) - , m_host(host) + : Cpu(model, host, NULL/*constraint*/, speedPeakList, pstate, core, speedPeak, speedScale, stateInitial) { - host->p_cpu = this; - - // Copy the power peak array: - p_speedPeakList = xbt_dynar_new(sizeof(double), nullptr); - unsigned long n = xbt_dynar_length(speedPeakList); - for (unsigned long i = 0; i != n; ++i) { - double value = xbt_dynar_get_as(speedPeakList, i, double); - xbt_dynar_push(p_speedPeakList, &value); - } - - m_pstate = pstate; } Cpu::Cpu(Model *model, simgrid::Host *host, lmm_constraint_t constraint, @@ -170,6 +156,7 @@ Cpu::Cpu(Model *model, simgrid::Host *host, lmm_constraint_t constraint, , m_host(host) { host->p_cpu = this; + xbt_assert(m_speedScale > 0, "Available speed has to be >0"); // Copy the power peak array: p_speedPeakList = xbt_dynar_new(sizeof(double), nullptr); @@ -203,7 +190,7 @@ Cpu::Cpu(Model *model, simgrid::Host *host, lmm_constraint_t constraint, int core, double speedPeak, double speedScale) : Cpu(model, host, constraint, speedPeakList, pstate, core, speedPeak, speedScale, SURF_RESOURCE_ON) { - xbt_assert(0,"FIXME: this constructor could be removed"); + xbt_die("FIXME: DEADCODE"); } Cpu::Cpu(Model *model, simgrid::Host *host, diff --git a/src/surf/host_ptask_L07.cpp b/src/surf/host_ptask_L07.cpp index 943d715b83..e5a7d6670a 100644 --- a/src/surf/host_ptask_L07.cpp +++ b/src/surf/host_ptask_L07.cpp @@ -402,7 +402,6 @@ CpuL07::CpuL07(CpuL07Model *model, simgrid::Host *host, : Cpu(model, host, speedPeakList, pstate, core, xbt_dynar_get_as(speedPeakList,pstate,double), speedScale, state_initial) { - xbt_assert(m_speedScale > 0, "Power has to be >0"); p_constraint = lmm_constraint_new(model->getMaxminSystem(), this, xbt_dynar_get_as(speedPeakList,pstate,double) * speedScale); if (speedTrace)