// Some users declare a pstate of speed 0 flops (e.g., to model boot time).
// We consider that the machine is then fully loaded. That's arbitrary but it avoids a NaN
cpu_load = 1;
// Some users declare a pstate of speed 0 flops (e.g., to model boot time).
// We consider that the machine is then fully loaded. That's arbitrary but it avoids a NaN
cpu_load = 1;
/* The problem with this model is that the load is always 0 or 1, never something less.
* Another possibility could be to model the total energy as
/* The problem with this model is that the load is always 0 or 1, never something less.
* Another possibility could be to model the total energy as
/* min_power corresponds to the power consumed when only one core is active */
/* max_power is the power consumed at 100% cpu load */
auto range = power_range_watts_list_.at(this->pstate_);
/* min_power corresponds to the power consumed when only one core is active */
/* max_power is the power consumed at 100% cpu load */
auto range = power_range_watts_list_.at(this->pstate_);
* i.e., we need min_power + (maxCpuLoad-1/coreCount)*power_slope == max_power
* (maxCpuLoad is by definition 1)
*/
* i.e., we need min_power + (maxCpuLoad-1/coreCount)*power_slope == max_power
* (maxCpuLoad is by definition 1)
*/
int coreCount = host_->get_core_count();
double coreReciprocal = static_cast<double>(1) / static_cast<double>(coreCount);
if (coreCount > 1)
int coreCount = host_->get_core_count();
double coreReciprocal = static_cast<double>(1) / static_cast<double>(coreCount);
if (coreCount > 1)
current_power = min_power + (cpu_load - coreReciprocal) * power_slope;
} else { /* Our machine is idle, take the dedicated value! */
current_power = min_power + (cpu_load - coreReciprocal) * power_slope;
} else { /* Our machine is idle, take the dedicated value! */
/* This callback is fired either when the host changes its state (on/off) ("onStateChange") or its speed
* (because the user changed the pstate, or because of external trace events) ("onSpeedChange") */
/* This callback is fired either when the host changes its state (on/off) ("onStateChange") or its speed
* (because the user changed the pstate, or because of external trace events) ("onSpeedChange") */
// that the next trigger would be the 2nd compute, hence ignoring the idle time
// during the recv call. By updating at the beginning of a compute, we can
// fix that. (If the cpu is not idle, this is not required.)
// that the next trigger would be the 2nd compute, hence ignoring the idle time
// during the recv call. By updating at the beginning of a compute, we can
// fix that. (If the cpu is not idle, this is not required.)
- simgrid::kernel::activity::ExecImpl::on_creation.connect([](simgrid::kernel::activity::ExecImplPtr activity){
- if (activity->host_ != nullptr) { // We only run on one host
- simgrid::s4u::Host* host = activity->host_;
+ simgrid::kernel::activity::ExecImpl::on_creation.connect([](simgrid::kernel::activity::ExecImpl const& activity) {
+ if (activity.host_ != nullptr) { // We only run on one host
+ simgrid::s4u::Host* host = activity.host_;