- CpuPtr cpu = NULL;
- 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(power_peak, double) > 0.0,
- "Power has to be >0.0");
- xbt_assert(core > 0, "Invalid number of cores %d", 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, static_cast<ResourcePtr>(cpu));
-
+ Cpu *cpu = NULL;
+ sg_host_t host = sg_host_by_name(name);
+ xbt_assert(xbt_dynar_getfirst_as(speedPeak, 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);
+
+ cpu = new CpuCas01(this, name, speedPeak, pstate, speedScale, speedTrace, core, state_initial, state_trace, cpu_properties);
+ sg_host_surfcpu_register(host, cpu);