From: Christian Heinrich Date: Thu, 15 Feb 2018 14:09:37 +0000 (+0100) Subject: [DVFS] Add function sg_host_get_avg_load(host) X-Git-Tag: v3.19~170 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/aaf7f97eaedf1548f3d42497d410f77e273c4423 [DVFS] Add function sg_host_get_avg_load(host) --- diff --git a/include/simgrid/plugins/load.h b/include/simgrid/plugins/load.h index 2fb2a94c89..5b7f903ada 100644 --- a/include/simgrid/plugins/load.h +++ b/include/simgrid/plugins/load.h @@ -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); diff --git a/src/surf/plugins/host_load.cpp b/src/surf/plugins/host_load.cpp index f353661d25..8e3dd94986 100644 --- a/src/surf/plugins/host_load.cpp +++ b/src/surf/plugins/host_load.cpp @@ -185,6 +185,18 @@ double sg_host_get_current_load(sg_host_t host) return host->extension()->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()->getAverageLoad(); +} + /** @brief Returns the time this host was idle since the last reset * * See also @ref plugin_load