Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Modified error messages when creating CPUs for more verbosity.
[simgrid.git] / src / surf / cpu_ti.cpp
index 10f16cf..81a156d 100644 (file)
@@ -31,7 +31,7 @@ CpuTiTrace::CpuTiTrace(tmgr_trace_t power_trace)
                   (xbt_dynar_length(power_trace->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);
+  m_nbPoints = xbt_dynar_length(power_trace->s_list.event_list) + 1;
   xbt_dynar_foreach(power_trace->s_list.event_list, cpt, val) {
     p_timePoints[i] = time;
     p_integral[i] = integral;
@@ -437,6 +437,8 @@ CpuPtr CpuTiModel::createCpu(const char *name,
   xbt_assert(!surf_cpu_resource_priv(surf_cpu_resource_by_name(name)),
               "Host '%s' declared several times in the platform file",
               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?");
   CpuTiPtr cpu = new CpuTi(this, name, powerPeak, pstate, powerScale, powerTrace,
                           core, stateInitial, stateTrace, cpuProperties);
   xbt_lib_set(host_lib, name, SURF_CPU_LEVEL, static_cast<ResourcePtr>(cpu));