- simgrid::surf::Host* surf_host = host->extension<simgrid::surf::Host>();
- double start_time = this->last_updated;
- double finish_time = surf_get_clock();
- double cpu_load;
- if (surf_host->p_cpu->m_speedPeak == 0)
- // Some users declare a pstate of speed 0 flops (eg to model boot time).
- // We consider that the machine is then fully loaded. That's arbitrary but it avoids a NaN
- cpu_load = 1;
- else
- cpu_load = lmm_constraint_get_usage(surf_host->p_cpu->getConstraint())
- / surf_host->p_cpu->m_speedPeak;
-
- if (cpu_load > 1) // A machine with a load > 1 consumes as much as a fully loaded machine, not mores
- cpu_load = 1;
-
- double previous_energy = this->total_energy;
-
- double instantaneous_consumption;
- if (host->is_off())
- instantaneous_consumption = this->watts_off;
- else
- instantaneous_consumption = this->getCurrentWattsValue(cpu_load);
-
- double energy_this_step = instantaneous_consumption*(finish_time-start_time);
-
- this->total_energy = previous_energy + energy_this_step;
- this->last_updated = finish_time;
-
- XBT_DEBUG("[update_energy of %s] period=[%.2f-%.2f]; current power peak=%.0E flop/s; consumption change: %.2f J -> %.2f J",
- surf_host->getName(), start_time, finish_time, surf_host->p_cpu->m_speedPeak, previous_energy, energy_this_step);
+ simgrid::surf::HostImpl* surf_host = host->extension<simgrid::surf::HostImpl>();
+ double start_time = this->last_updated;
+ double finish_time = surf_get_clock();
+ double cpu_load;
+ if (surf_host->p_cpu->speed_.peak == 0)
+ // Some users declare a pstate of speed 0 flops (eg to model boot time).
+ // We consider that the machine is then fully loaded. That's arbitrary but it avoids a NaN
+ cpu_load = 1;
+ else
+ cpu_load = lmm_constraint_get_usage(surf_host->p_cpu->getConstraint())
+ / surf_host->p_cpu->speed_.peak;
+
+ if (cpu_load > 1) // A machine with a load > 1 consumes as much as a fully loaded machine, not mores
+ cpu_load = 1;
+
+ double previous_energy = this->total_energy;
+
+ double instantaneous_consumption;
+ if (host->isOff())
+ instantaneous_consumption = this->watts_off;
+ else
+ instantaneous_consumption = this->getCurrentWattsValue(cpu_load);
+
+ double energy_this_step = instantaneous_consumption*(finish_time-start_time);
+
+ this->total_energy = previous_energy + energy_this_step;
+ this->last_updated = finish_time;
+
+ XBT_DEBUG("[update_energy of %s] period=[%.2f-%.2f]; current power peak=%.0E flop/s; consumption change: %.2f J -> %.2f J",
+ surf_host->getName(), start_time, finish_time, surf_host->p_cpu->speed_.peak, previous_energy, energy_this_step);