From: Frederic Suter Date: Fri, 18 Oct 2019 11:16:49 +0000 (+0200) Subject: remove some direct accesses to pimpl_cpu X-Git-Tag: v3.25~520 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/e6e7aa1dcecc9e26fe09ede088b3ef9848b18eb3?hp=750cd83c93b3d52864bd37b42f5d1e66c4f88708 remove some direct accesses to pimpl_cpu --- diff --git a/src/plugins/host_energy.cpp b/src/plugins/host_energy.cpp index 2b62506659..85a17d3f3d 100644 --- a/src/plugins/host_energy.cpp +++ b/src/plugins/host_energy.cpp @@ -187,9 +187,10 @@ void HostEnergy::update() this->total_energy_ = previous_energy + energy_this_step; this->last_updated_ = finish_time; - XBT_DEBUG("[update_energy of %s] period=[%.8f-%.8f]; current speed=%.2E flop/s (pstate %i); total consumption before: %.8f J -> added now: %.8f J", - host_->get_cname(), start_time, finish_time, host_->pimpl_cpu->get_pstate_peak_speed(this->pstate_), this->pstate_, previous_energy, - energy_this_step); + XBT_DEBUG("[update_energy of %s] period=[%.8f-%.8f]; current speed=%.2E flop/s (pstate %i); total consumption " + "before: %.8f J -> added now: %.8f J", + host_->get_cname(), start_time, finish_time, host_->get_pstate_speed(this->pstate_), this->pstate_, + previous_energy, energy_this_step); } /* Save data for the upcoming time interval: whether it's on/off and the pstate if it's on */ @@ -269,10 +270,10 @@ double HostEnergy::get_current_watts_value() // We consider that the machine is then fully loaded. That's arbitrary but it avoids a NaN cpu_load = 1; else { - cpu_load = host_->pimpl_cpu->get_constraint()->get_usage() / current_speed; + cpu_load = host_->get_load() / current_speed; /* Divide by the number of cores here to have a value between 0 and 1 */ - cpu_load /= host_->pimpl_cpu->get_core_count(); + cpu_load /= host_->get_core_count(); if (cpu_load > 1) // This condition is true for energy_ptask on 32 bits, even if cpu_load is displayed as 1.000000 cpu_load = 1; // That may be an harmless rounding error? diff --git a/src/plugins/host_load.cpp b/src/plugins/host_load.cpp index dd1b310660..73debe7269 100644 --- a/src/plugins/host_load.cpp +++ b/src/plugins/host_load.cpp @@ -62,7 +62,7 @@ public: , last_updated_(surf_get_clock()) , last_reset_(surf_get_clock()) , current_speed_(host_->get_speed()) - , current_flops_(host_->pimpl_cpu->get_constraint()->get_usage()) + , current_flops_(host_->get_load()) , theor_max_flops_(0) { } @@ -146,7 +146,7 @@ void HostLoad::update() /* Current flop per second computed by the cpu; current_flops = k * pstate_speed_in_flops, k @in {0, 1, ..., cores-1} * designates number of active cores; will be 0 if CPU is currently idle */ - current_flops_ = host_->pimpl_cpu->get_constraint()->get_usage(); + current_flops_ = host_->get_load(); if (current_flops_ == 0) { idle_time_ += (now - last_updated_); @@ -188,7 +188,7 @@ void HostLoad::reset() idle_time_ = 0; computed_flops_ = 0; theor_max_flops_ = 0; - current_flops_ = host_->pimpl_cpu->get_constraint()->get_usage(); + current_flops_ = host_->get_load(); current_speed_ = host_->get_speed(); } } // namespace plugin diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index 93fb932916..2359340d52 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -87,11 +87,11 @@ void sg_platf_new_host(simgrid::kernel::routing::HostCreationArgs* args) /* Change from the defaults */ if (args->state_trace) - host->pimpl_cpu->set_state_profile(args->state_trace); + host->set_state_profile(args->state_trace); if (args->speed_trace) - host->pimpl_cpu->set_speed_profile(args->speed_trace); + host->set_speed_profile(args->speed_trace); if (args->pstate != 0) - host->pimpl_cpu->set_pstate(args->pstate); + host->set_pstate(args->pstate); if (not args->coord.empty()) new simgrid::kernel::routing::vivaldi::Coords(host->pimpl_netpoint, args->coord); } @@ -507,9 +507,9 @@ void sg_platf_new_peer(simgrid::kernel::routing::PeerCreationArgs* peer) /* Change from the defaults */ if (peer->state_trace) - host->pimpl_cpu->set_state_profile(peer->state_trace); + host->set_state_profile(peer->state_trace); if (peer->speed_trace) - host->pimpl_cpu->set_speed_profile(peer->speed_trace); + host->set_speed_profile(peer->speed_trace); } /* Pick the right models for CPU, net and host, and call their model_init_preparse */