From: Christian Heinrich Date: Thu, 26 Jul 2018 09:16:41 +0000 (+0200) Subject: [HostLoad] Update when calling getters X-Git-Tag: v3_21~355^2~15 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/135f798edba6bcb47842fd17318485bd226ea196 [HostLoad] Update when calling getters This will allow us to remove the CpuAction hook and replace it with hooks that are only used after a calculation has completed. If for instance a daemon (dvfs, load balancer, ...) wants to get up-to-date information, this is now assured through the update call. --- diff --git a/src/plugins/host_load.cpp b/src/plugins/host_load.cpp index 5387b3c214..c12ac691cd 100644 --- a/src/plugins/host_load.cpp +++ b/src/plugins/host_load.cpp @@ -40,10 +40,10 @@ public: explicit HostLoad(simgrid::s4u::Host&& ptr) = delete; double get_current_load(); - 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 */ + double get_average_load() { update(); return (theor_max_flops_ == 0) ? 0 : computed_flops_ / theor_max_flops_; }; + double get_computed_flops() { update(); return computed_flops_; } + double get_idle_time() { update(); return idle_time_; } /** Return idle time since last reset */ + double get_total_idle_time() { update(); return total_idle_time_; } /** Return idle time over the whole simulation */ void update(); void reset();