Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
remove some direct accesses to pimpl_cpu
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 18 Oct 2019 11:16:49 +0000 (13:16 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 18 Oct 2019 11:16:49 +0000 (13:16 +0200)
src/plugins/host_energy.cpp
src/plugins/host_load.cpp
src/surf/sg_platf.cpp

index 2b62506..85a17d3 100644 (file)
@@ -187,9 +187,10 @@ void HostEnergy::update()
     this->total_energy_ = previous_energy + energy_this_step;
     this->last_updated_ = finish_time;
 
     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 */
   }
 
   /* 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 {
     // 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 */
 
     /* 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?
 
     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?
index dd1b310..73debe7 100644 (file)
@@ -62,7 +62,7 @@ public:
       , last_updated_(surf_get_clock())
       , last_reset_(surf_get_clock())
       , current_speed_(host_->get_speed())
       , 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)
   {
   }
       , 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 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_);
 
   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;
   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
   current_speed_   = host_->get_speed();
 }
 } // namespace plugin
index 93fb932..2359340 100644 (file)
@@ -87,11 +87,11 @@ void sg_platf_new_host(simgrid::kernel::routing::HostCreationArgs* args)
 
   /* Change from the defaults */
   if (args->state_trace)
 
   /* 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)
   if (args->speed_trace)
-    host->pimpl_cpu->set_speed_profile(args->speed_trace);
+    host->set_speed_profile(args->speed_trace);
   if (args->pstate != 0)
   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);
 }
   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)
 
   /* 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)
   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 */
 }
 
 /* Pick the right models for CPU, net and host, and call their model_init_preparse */