Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Modified error messages when creating CPUs for more verbosity.
authorChristian Heinrich <christian.heinrich@livando.com>
Thu, 22 Jan 2015 11:34:25 +0000 (12:34 +0100)
committerChristian Heinrich <christian.heinrich@livando.com>
Thu, 22 Jan 2015 11:43:21 +0000 (12:43 +0100)
As 0 may be assumed as the default powerPeak value (if no value specified),
the error message should point out that the power attribute may have been
forgotten. This was added in this commit.

src/surf/cpu_cas01.cpp
src/surf/cpu_ti.cpp

index b58815c..98ad19a 100644 (file)
@@ -118,8 +118,8 @@ CpuPtr CpuCas01Model::createCpu(const char *name, xbt_dynar_t power_peak,
              "Host '%s' declared several times in the platform file",
              name);
   xbt_assert(xbt_dynar_getfirst_as(power_peak, double) > 0.0,
-      "Power has to be >0.0");
-  xbt_assert(core > 0, "Invalid number of cores %d", core);
+      "Power 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);
 
   cpu = new CpuCas01(this, name, power_peak, pstate, power_scale, power_trace, core, state_initial, state_trace, cpu_properties);
   xbt_lib_set(host_lib, name, SURF_CPU_LEVEL, cpu);
index 38717da..81a156d 100644 (file)
@@ -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));