Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[S4U] Make s4u::Host::get_actor_count() available
authorChristian Heinrich <franz-christian.heinrich@inria.fr>
Tue, 10 Apr 2018 06:05:20 +0000 (08:05 +0200)
committerChristian Heinrich <franz-christian.heinrich@inria.fr>
Fri, 13 Apr 2018 08:28:13 +0000 (10:28 +0200)
This function returns the number of actors that are running
on that specific host.

ChangeLog
include/simgrid/s4u/Host.hpp
src/s4u/s4u_host.cpp

index 8e7bc3a..1a99bb0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,10 @@ TRACE
  - Change --cfg=tracing/msg/vm to --cfg=tracing/vm as virtual machine
    behavior tracing is no longer limited to MSG
 
+ S4U:
+ - Introduced new function simgrid::s4u::Host::get_actor_count. This function
+   returns the number of actors running on a specific host.
+
  Fixed bugs:
  - #258: daemonized actors hang after all non-daemonized actors have completed
 
index 3696d91..76eb900 100644 (file)
@@ -97,6 +97,7 @@ public:
   const char* getProperty(const char* key);
   void setProperty(std::string key, std::string value);
   void getProcesses(std::vector<ActorPtr> * list);
+  int get_actor_count() const;
   double getPstateSpeed(int pstate_index);
   int getPstatesCount() const;
   void setPstate(int pstate_index);
index 42b8791..7c18d22 100644 (file)
@@ -186,6 +186,13 @@ void Host::getProcesses(std::vector<ActorPtr>* list)
   }
 }
 
+/** @brief Returns how many actors have been launched on this host */
+// FIXME: Specify whether the user should expect only non-daemon actors here!
+int Host::get_actor_count() const
+{
+  return this->extension<simgrid::simix::Host>()->process_list.size();
+}
+
 /** @brief Get the peak processor speed (in flops/s), at the specified pstate  */
 double Host::getPstateSpeed(int pstate_index)
 {
@@ -194,7 +201,7 @@ double Host::getPstateSpeed(int pstate_index)
   });
 }
 
-/** @brief Get the peak processor speed (in flops/s), at the current pstate */
+/** @brief Get the peak processor speed (under full load (=1.0), in flops/s), at the current pstate */
 double Host::getSpeed()
 {
   return pimpl_cpu->getSpeed(1.0);