Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[DVFS] Add function sg_host_get_avg_load(host)
authorChristian Heinrich <franz-christian.heinrich@inria.fr>
Thu, 15 Feb 2018 14:09:37 +0000 (15:09 +0100)
committerChristian Heinrich <franz-christian.heinrich@inria.fr>
Thu, 1 Mar 2018 12:42:49 +0000 (13:42 +0100)
include/simgrid/plugins/load.h
src/surf/plugins/host_load.cpp

index 2fb2a94..5b7f903 100644 (file)
@@ -14,6 +14,7 @@ SG_BEGIN_DECL()
 
 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_computed_flops(sg_host_t host);
 XBT_PUBLIC(void) sg_host_load_reset(sg_host_t host);
index f353661..8e3dd94 100644 (file)
@@ -185,6 +185,18 @@ double sg_host_get_current_load(sg_host_t host)
   return host->extension<HostLoad>()->getCurrentLoad();
 }
 
+/** @brief Returns the current load of the host passed as argument
+ *
+ *  See also @ref plugin_load
+ */
+double sg_host_get_avg_load(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>()->getAverageLoad();
+}
+
 /** @brief Returns the time this host was idle since the last reset
  *
  *  See also @ref plugin_load