Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[HostLoad] Add total idle time
authorChristian Heinrich <franz-christian.heinrich@inria.fr>
Tue, 17 Jul 2018 11:56:33 +0000 (13:56 +0200)
committerChristian Heinrich <franz-christian.heinrich@inria.fr>
Wed, 18 Jul 2018 14:42:11 +0000 (16:42 +0200)
The 'normal' idle time can (and does) get reset, but
it is interesting to know how much a host idled until
now in total.

include/simgrid/plugins/load.h
src/plugins/host_load.cpp

index 734752a..eedabd4 100644 (file)
@@ -15,6 +15,7 @@ XBT_PUBLIC void sg_host_load_plugin_init();
 XBT_PUBLIC double sg_host_get_current_load(sg_host_t host);
 XBT_PUBLIC double sg_host_get_avg_load(sg_host_t host);
 XBT_PUBLIC double sg_host_get_idle_time(sg_host_t host);
+XBT_PUBLIC double sg_host_get_total_idle_time(sg_host_t host);
 XBT_PUBLIC double sg_host_get_computed_flops(sg_host_t host);
 XBT_PUBLIC void sg_host_load_reset(sg_host_t host);
 
index f584bba..4d7f644 100644 (file)
@@ -44,6 +44,7 @@ public:
   double get_average_load() { return (theor_max_flops_ == 0) ? 0 : computed_flops_ / theor_max_flops_; };
   double get_computed_flops() { return computed_flops_; }
   double get_idle_time() { return idle_time_; } /** Return idle time since last reset */
+  double get_total_idle_time() { return total_idle_time_; } /** Return idle time over the whole simulation */
   void update();
   void reset();
 
@@ -62,6 +63,7 @@ private:
   double current_flops_     = 0;
   double computed_flops_    = 0;
   double idle_time_         = 0;
+  double total_idle_time_   = 0; /* This gets never reset */
   double theor_max_flops_   = 0;
   bool was_prev_idle_       = true; /* A host is idle at the beginning */
 };
@@ -81,6 +83,7 @@ void HostLoad::update()
 
   if (was_prev_idle_) {
     idle_time_ += (now - last_updated_);
+    total_idle_time_ += (now - last_updated_);
   }
 
   theor_max_flops_ += current_speed_ * host_->get_core_count() * (now - last_updated_);
@@ -219,6 +222,14 @@ double sg_host_get_idle_time(sg_host_t host)
   return host->extension<HostLoad>()->get_idle_time();
 }
 
+double sg_host_get_total_idle_time(sg_host_t host)
+{
+  xbt_assert(HostLoad::EXTENSION_ID.valid(),
+             "The Load plugin is not active. Please call sg_host_load_plugin_init() during initialization.");
+
+  return host->extension<HostLoad>()->get_total_idle_time();
+}
+
 double sg_host_get_computed_flops(sg_host_t host)
 {
   xbt_assert(HostLoad::EXTENSION_ID.valid(),