Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
snake_case s4u::Host and improve doc
authorMartin Quinson <martin.quinson@loria.fr>
Sat, 23 Jun 2018 19:58:50 +0000 (21:58 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sat, 23 Jun 2018 20:11:18 +0000 (22:11 +0200)
25 files changed:
examples/s4u/actor-migration/s4u-actor-migration.cpp
examples/s4u/cloud-capping/s4u-cloud-capping.cpp
examples/s4u/energy-exec/s4u-energy-exec.cpp
examples/s4u/engine-filtering/s4u-engine-filtering.cpp
examples/s4u/exec-dvfs/s4u-exec-dvfs.cpp
examples/s4u/exec-remote/s4u-exec-remote.cpp
examples/s4u/io-file-system/s4u-io-file-system.cpp
examples/s4u/io-storage-raw/s4u-io-storage-raw.cpp
examples/s4u/platform-properties/s4u-platform-properties.cpp
examples/s4u/plugin-hostload/s4u-plugin-hostload.cpp
examples/simdag/test/sd_test.cpp
include/simgrid/s4u/Host.hpp
src/bindings/java/jmsg_host.cpp
src/instr/instr_platform.cpp
src/kernel/lmm/maxmin.cpp
src/plugins/file_system/s4u_FileSystem.cpp
src/plugins/host_energy.cpp
src/plugins/host_load.cpp
src/plugins/vm/VmLiveMigration.cpp
src/plugins/vm/s4u_VirtualMachine.cpp
src/s4u/s4u_Host.cpp
src/simdag/sd_task.cpp
src/smpi/internals/smpi_dvfs.cpp
src/smpi/mpi/smpi_request.cpp
teshsuite/s4u/storage_client_server/storage_client_server.cpp

index d6fb4c5..788bf0f 100644 (file)
@@ -23,7 +23,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_actor_migration, "Messages specific for this s4
 
 static void worker(simgrid::s4u::Host* first, simgrid::s4u::Host* second)
 {
-  double flopAmount = first->getSpeed() * 5 + second->getSpeed() * 5;
+  double flopAmount = first->get_speed() * 5 + second->get_speed() * 5;
 
   XBT_INFO("Let's move to %s to execute %.2f Mflops (5sec on %s and 5sec on %s)", first->get_cname(), flopAmount / 1e6,
            first->get_cname(), second->get_cname());
index 42c2984..fbdef2a 100644 (file)
@@ -63,7 +63,7 @@ static void test_dynamic_change()
   vm1->start();
 
   simgrid::s4u::Actor::create("worker0", vm0, worker_busy_loop, "Task0", -1);
-  simgrid::s4u::Actor::create("worker1", vm1, worker_busy_loop, "Task1", pm0->getSpeed());
+  simgrid::s4u::Actor::create("worker1", vm1, worker_busy_loop, "Task1", pm0->get_speed());
 
   simgrid::s4u::this_actor::sleep_for(3000); // let the tasks end
   vm0->destroy();
@@ -72,7 +72,7 @@ static void test_dynamic_change()
 
 static void test_one_task(simgrid::s4u::Host* host)
 {
-  const double cpu_speed          = host->getSpeed();
+  const double cpu_speed          = host->get_speed();
   const double computation_amount = cpu_speed * 10;
 
   XBT_INFO("### Test: with/without task set_bound");
@@ -105,8 +105,8 @@ static void test_one_task(simgrid::s4u::Host* host)
 
 static void test_two_tasks(simgrid::s4u::Host* hostA, simgrid::s4u::Host* hostB)
 {
-  const double cpu_speed = hostA->getSpeed();
-  xbt_assert(cpu_speed == hostB->getSpeed());
+  const double cpu_speed = hostA->get_speed();
+  xbt_assert(cpu_speed == hostB->get_speed());
   const double computation_amount = cpu_speed * 10;
   const char* hostA_name          = hostA->get_cname();
   const char* hostB_name          = hostB->get_cname();
@@ -189,7 +189,7 @@ static void master_main()
   vm0->destroy();
 
   vm0 = new simgrid::s4u::VirtualMachine("VM0", pm0, 1);
-  vm0->set_bound(pm0->getSpeed() / 10);
+  vm0->set_bound(pm0->get_speed() / 10);
   vm0->start();
 
   XBT_INFO("# 7. Put a single task on the VM capped by 10%%.");
@@ -210,7 +210,7 @@ static void master_main()
   vm0->set_ramsize(1e9); // 1GB
   vm0->start();
 
-  double cpu_speed = pm0->getSpeed();
+  double cpu_speed = pm0->get_speed();
 
   XBT_INFO("# 10. Test migration");
   const double computation_amount = cpu_speed * 10;
index 1a30be2..62d0f6c 100644 (file)
@@ -14,14 +14,14 @@ static void dvfs()
   simgrid::s4u::Host* host2 = simgrid::s4u::Host::by_name("MyHost2");
 
   XBT_INFO("Energetic profile: %s", host1->get_property("watt_per_state"));
-  XBT_INFO("Initial peak speed=%.0E flop/s; Energy dissipated =%.0E J", host1->getSpeed(),
+  XBT_INFO("Initial peak speed=%.0E flop/s; Energy dissipated =%.0E J", host1->get_speed(),
            sg_host_get_consumed_energy(host1));
 
   double start = simgrid::s4u::Engine::get_clock();
   XBT_INFO("Sleep for 10 seconds");
   simgrid::s4u::this_actor::sleep_for(10);
   XBT_INFO("Done sleeping (duration: %.2f s). Current peak speed=%.0E; Energy dissipated=%.2f J",
-           simgrid::s4u::Engine::get_clock() - start, host1->getSpeed(), sg_host_get_consumed_energy(host1));
+           simgrid::s4u::Engine::get_clock() - start, host1->get_speed(), sg_host_get_consumed_energy(host1));
 
   // Execute something
   start             = simgrid::s4u::Engine::get_clock();
@@ -30,7 +30,7 @@ static void dvfs()
   simgrid::s4u::this_actor::execute(flopAmount);
   XBT_INFO("Task done (duration: %.2f s). Current peak speed=%.0E flop/s; Current consumption: from %.0fW to %.0fW"
            " depending on load; Energy dissipated=%.0f J",
-           simgrid::s4u::Engine::get_clock() - start, host1->getSpeed(),
+           simgrid::s4u::Engine::get_clock() - start, host1->get_speed(),
            sg_host_get_wattmin_at(host1, host1->get_pstate()), sg_host_get_wattmax_at(host1, host1->get_pstate()),
            sg_host_get_consumed_energy(host1));
 
@@ -38,20 +38,20 @@ static void dvfs()
   int pstate = 2;
   host1->set_pstate(pstate);
   XBT_INFO("========= Requesting pstate %d (speed should be of %.0E flop/s and is of %.0E flop/s)", pstate,
-           host1->getPstateSpeed(pstate), host1->getSpeed());
+           host1->get_pstate_speed(pstate), host1->get_speed());
 
   // Run another task
   start = simgrid::s4u::Engine::get_clock();
   XBT_INFO("Run a task of %.0E flops", flopAmount);
   simgrid::s4u::this_actor::execute(flopAmount);
   XBT_INFO("Task done (duration: %.2f s). Current peak speed=%.0E flop/s; Energy dissipated=%.0f J",
-           simgrid::s4u::Engine::get_clock() - start, host1->getSpeed(), sg_host_get_consumed_energy(host1));
+           simgrid::s4u::Engine::get_clock() - start, host1->get_speed(), sg_host_get_consumed_energy(host1));
 
   start = simgrid::s4u::Engine::get_clock();
   XBT_INFO("Sleep for 4 seconds");
   simgrid::s4u::this_actor::sleep_for(4);
   XBT_INFO("Done sleeping (duration: %.2f s). Current peak speed=%.0E flop/s; Energy dissipated=%.0f J",
-           simgrid::s4u::Engine::get_clock() - start, host1->getSpeed(), sg_host_get_consumed_energy(host1));
+           simgrid::s4u::Engine::get_clock() - start, host1->get_speed(), sg_host_get_consumed_energy(host1));
 
   // =========== Turn the other host off ==========
   XBT_INFO("Turning MyHost2 off, and sleeping another 10 seconds. MyHost2 dissipated %.0f J so far.",
@@ -60,7 +60,7 @@ static void dvfs()
   start = simgrid::s4u::Engine::get_clock();
   simgrid::s4u::this_actor::sleep_for(10);
   XBT_INFO("Done sleeping (duration: %.2f s). Current peak speed=%.0E flop/s; Energy dissipated=%.0f J",
-           simgrid::s4u::Engine::get_clock() - start, host1->getSpeed(), sg_host_get_consumed_energy(host1));
+           simgrid::s4u::Engine::get_clock() - start, host1->get_speed(), sg_host_get_consumed_energy(host1));
 }
 
 int main(int argc, char* argv[])
index c3e0e7e..acc9391 100644 (file)
@@ -21,7 +21,7 @@ namespace filter {
 /* First example of thing that we can use as a filtering criteria: a simple boolean function */
 static bool filter_speed_more_than_50Mf(simgrid::s4u::Host* host)
 {
-  return host->getSpeed() > 50E6;
+  return host->get_speed() > 50E6;
 }
 
 /* Second kind of thing that we can use as a filtering criteria: a functor (=function object).
@@ -80,7 +80,8 @@ int main(int argc, char* argv[])
   list = e.get_filtered_hosts(filter);
 
   for (auto& host : list)
-    XBT_INFO("The following hosts changed their frequency: %s (from %.1ff to %.1ff)", host->get_cname(), host->getPstateSpeed(filter.get_old_speed(host)), host->getSpeed());
+    XBT_INFO("The following hosts changed their frequency: %s (from %.1ff to %.1ff)", host->get_cname(),
+             host->get_pstate_speed(filter.get_old_speed(host)), host->get_speed());
 
   /* You can also just use any regular function (namespaced on need) to filter  */
   list = e.get_filtered_hosts(filter::filter_speed_more_than_50Mf);
index 81abcf6..32ef5dd 100644 (file)
@@ -15,7 +15,7 @@ static int dvfs()
   int nb = host->get_pstate_count();
   XBT_INFO("Count of Processor states=%d", nb);
 
-  XBT_INFO("Current power peak=%f", host->getSpeed());
+  XBT_INFO("Current power peak=%f", host->get_speed());
 
   // Run a task
   simgrid::s4u::this_actor::execute(workload);
@@ -26,11 +26,11 @@ static int dvfs()
   // Change power peak
   int new_pstate = 2;
 
-  XBT_INFO("Changing power peak value to %f (at index %d)", host->getPstateSpeed(new_pstate), new_pstate);
+  XBT_INFO("Changing power peak value to %f (at index %d)", host->get_pstate_speed(new_pstate), new_pstate);
 
   host->set_pstate(new_pstate);
 
-  XBT_INFO("Current power peak=%f", host->getSpeed());
+  XBT_INFO("Current power peak=%f", host->get_speed());
 
   // Run a second task
   simgrid::s4u::this_actor::execute(workload);
@@ -42,7 +42,7 @@ static int dvfs()
   host = simgrid::s4u::Host::by_name_or_null("MyHost2");
   XBT_INFO("Count of Processor states=%d", host->get_pstate_count());
 
-  XBT_INFO("Current power peak=%f", host->getSpeed());
+  XBT_INFO("Current power peak=%f", host->get_speed());
   return 0;
 }
 
index 8044e17..a119a8d 100644 (file)
@@ -20,8 +20,8 @@ static void wizard()
   XBT_INFO("It started. Running 48.492Mf takes exactly one second on Ginette (but not on Fafard).");
 
   simgrid::s4u::this_actor::sleep_for(0.1);
-  XBT_INFO("Loads in flops/s: Boivin=%.0f; Fafard=%.0f; Ginette=%.0f",
-      boivin->getLoad(), fafard->getLoad(), ginette->getLoad());
+  XBT_INFO("Loads in flops/s: Boivin=%.0f; Fafard=%.0f; Ginette=%.0f", boivin->get_load(), fafard->get_load(),
+           ginette->get_load());
 
   exec->wait();
 
@@ -31,14 +31,14 @@ static void wizard()
   exec->start();
 
   simgrid::s4u::this_actor::sleep_for(0.5);
-  XBT_INFO("Loads before the move: Boivin=%.0f; Fafard=%.0f; Ginette=%.0f",
-      boivin->getLoad(), fafard->getLoad(), ginette->getLoad());
+  XBT_INFO("Loads before the move: Boivin=%.0f; Fafard=%.0f; Ginette=%.0f", boivin->get_load(), fafard->get_load(),
+           ginette->get_load());
 
   exec->set_host(boivin);
 
   simgrid::s4u::this_actor::sleep_for(0.1);
-  XBT_INFO("Loads after the move: Boivin=%.0f; Fafard=%.0f; Ginette=%.0f",
-      boivin->getLoad(), fafard->getLoad(), ginette->getLoad());
+  XBT_INFO("Loads after the move: Boivin=%.0f; Fafard=%.0f; Ginette=%.0f", boivin->get_load(), fafard->get_load(),
+           ginette->get_load());
 
   exec->wait();
   XBT_INFO("Done!");
index 2c34333..bce3113 100644 (file)
@@ -30,7 +30,7 @@ public:
   void operator()()
   {
     std::unordered_map<std::string, simgrid::s4u::Storage*> const& mounts =
-        simgrid::s4u::Host::current()->getMountedStorages();
+        simgrid::s4u::Host::current()->get_mounted_storages();
 
     show_info(mounts);
 
index e594a1e..feaba5e 100644 (file)
@@ -16,7 +16,7 @@ static void host()
 
   /* - Retrieve all mount points of current host */
   std::unordered_map<std::string, simgrid::s4u::Storage*> const& storage_list =
-      simgrid::s4u::Host::current()->getMountedStorages();
+      simgrid::s4u::Host::current()->get_mounted_storages();
 
   /* - For each disk mounted on host, display disk name and mount point */
   for (auto const& kv : storage_list)
index f125e9d..d35bf9f 100644 (file)
@@ -114,7 +114,7 @@ int main(int argc, char* argv[])
   XBT_INFO("There are %zu hosts in the environment", totalHosts);
   std::vector<simgrid::s4u::Host*> hosts = e.get_all_hosts();
   for (unsigned int i = 0; i < hosts.size(); i++)
-    XBT_INFO("Host '%s' runs at %.0f flops/s", hosts[i]->get_cname(), hosts[i]->getSpeed());
+    XBT_INFO("Host '%s' runs at %.0f flops/s", hosts[i]->get_cname(), hosts[i]->get_speed());
 
   e.load_deployment(argv[2]);
   e.run();
index ac8962a..6ac50d8 100644 (file)
@@ -12,37 +12,39 @@ static void execute_load_test()
 {
   s4u_Host* host = simgrid::s4u::Host::by_name("MyHost1");
 
-  XBT_INFO("Initial peak speed: %.0E flop/s; number of flops computed so far: %.0E (should be 0) and current average load: %.5f (should be 0)", host->getSpeed(),
-           sg_host_get_computed_flops(host), sg_host_get_avg_load(host));
+  XBT_INFO("Initial peak speed: %.0E flop/s; number of flops computed so far: %.0E (should be 0) and current average "
+           "load: %.5f (should be 0)",
+           host->get_speed(), sg_host_get_computed_flops(host), sg_host_get_avg_load(host));
 
   double start = simgrid::s4u::Engine::get_clock();
   XBT_INFO("Sleep for 10 seconds");
   simgrid::s4u::this_actor::sleep_for(10);
 
-  double speed = host->getSpeed();
+  double speed = host->get_speed();
   XBT_INFO("Done sleeping %.2fs; peak speed: %.0E flop/s; number of flops computed so far: %.0E (nothing should have "
            "changed)",
-           simgrid::s4u::Engine::get_clock() - start, host->getSpeed(), sg_host_get_computed_flops(host));
+           simgrid::s4u::Engine::get_clock() - start, host->get_speed(), sg_host_get_computed_flops(host));
 
   // Run a task
   start = simgrid::s4u::Engine::get_clock();
-  XBT_INFO("Run a task of %.0E flops at current speed of %.0E flop/s", 200E6, host->getSpeed());
+  XBT_INFO("Run a task of %.0E flops at current speed of %.0E flop/s", 200E6, host->get_speed());
   simgrid::s4u::this_actor::execute(200E6);
 
   XBT_INFO("Done working on my task; this took %.2fs; current peak speed: %.0E flop/s (when I started the computation, "
            "the speed was set to %.0E flop/s); number of flops computed so "
            "far: %.2E, average load as reported by the HostLoad plugin: %.5f (should be %.5f)",
-           simgrid::s4u::Engine::get_clock() - start, host->getSpeed(), speed, sg_host_get_computed_flops(host),
+           simgrid::s4u::Engine::get_clock() - start, host->get_speed(), speed, sg_host_get_computed_flops(host),
            sg_host_get_avg_load(host),
            static_cast<double>(200E6) /
                (10.5 * speed * host->get_core_count() +
-                (simgrid::s4u::Engine::get_clock() - start - 0.5) * host->getSpeed() * host->get_core_count()));
+                (simgrid::s4u::Engine::get_clock() - start - 0.5) * host->get_speed() * host->get_core_count()));
 
   // ========= Change power peak =========
   int pstate = 1;
   host->set_pstate(pstate);
-  XBT_INFO("========= Requesting pstate %d (speed should be of %.0E flop/s and is of %.0E flop/s, average load is %.5f)", pstate,
-           host->getPstateSpeed(pstate), host->getSpeed(), sg_host_get_avg_load(host));
+  XBT_INFO(
+      "========= Requesting pstate %d (speed should be of %.0E flop/s and is of %.0E flop/s, average load is %.5f)",
+      pstate, host->get_pstate_speed(pstate), host->get_speed(), sg_host_get_avg_load(host));
 
   // Run a second task
   start = simgrid::s4u::Engine::get_clock();
@@ -50,7 +52,7 @@ static void execute_load_test()
   simgrid::s4u::this_actor::execute(100E6);
   XBT_INFO("Done working on my task; this took %.2fs; current peak speed: %.0E flop/s; number of flops computed so "
            "far: %.2E",
-           simgrid::s4u::Engine::get_clock() - start, host->getSpeed(), sg_host_get_computed_flops(host));
+           simgrid::s4u::Engine::get_clock() - start, host->get_speed(), sg_host_get_computed_flops(host));
 
   start = simgrid::s4u::Engine::get_clock();
   XBT_INFO("========= Requesting a reset of the computation and load counters");
@@ -59,7 +61,7 @@ static void execute_load_test()
   XBT_INFO("Sleep for 4 seconds");
   simgrid::s4u::this_actor::sleep_for(4);
   XBT_INFO("Done sleeping %.2f s; peak speed: %.0E flop/s; number of flops computed so far: %.0E",
-           simgrid::s4u::Engine::get_clock() - start, host->getSpeed(), sg_host_get_computed_flops(host));
+           simgrid::s4u::Engine::get_clock() - start, host->get_speed(), sg_host_get_computed_flops(host));
 
   // =========== Turn the other host off ==========
   s4u_Host* host2 = simgrid::s4u::Host::by_name("MyHost2");
@@ -69,7 +71,7 @@ static void execute_load_test()
   start = simgrid::s4u::Engine::get_clock();
   simgrid::s4u::this_actor::sleep_for(10);
   XBT_INFO("Done sleeping %.2f s; peak speed: %.0E flop/s; number of flops computed so far: %.0E",
-           simgrid::s4u::Engine::get_clock() - start, host->getSpeed(), sg_host_get_computed_flops(host));
+           simgrid::s4u::Engine::get_clock() - start, host->get_speed(), sg_host_get_computed_flops(host));
 }
 
 static void change_speed()
index 35ce7c0..3e5822b 100644 (file)
@@ -33,8 +33,8 @@ int main(int argc, char **argv)
   double comp_amount2 = 1000000;
   double comm_amount12 = 2000000;
   double comm_amount21 = 3000000;
-  XBT_INFO("Computation time for %f flops on %s: %f", comp_amount1, h1->get_cname(), comp_amount1 / h1->getSpeed());
-  XBT_INFO("Computation time for %f flops on %s: %f", comp_amount2, h2->get_cname(), comp_amount2 / h2->getSpeed());
+  XBT_INFO("Computation time for %f flops on %s: %f", comp_amount1, h1->get_cname(), comp_amount1 / h1->get_speed());
+  XBT_INFO("Computation time for %f flops on %s: %f", comp_amount2, h2->get_cname(), comp_amount2 / h2->get_speed());
 
   XBT_INFO("Route between %s and %s:", h1->get_cname(), h2->get_cname());
   std::vector<sg_link_t> route;
index 4d9f607..477bb22 100644 (file)
@@ -108,15 +108,22 @@ public:
     return res;
   }
 
-  double getSpeed();
+  double get_speed();
   double get_available_speed();
   int get_core_count();
+  double get_load();
 
-  double getPstateSpeed(int pstate_index);
+  double get_pstate_speed(int pstate_index);
   int get_pstate_count() const;
   void set_pstate(int pstate_index);
   int get_pstate();
 
+  XBT_ATTRIB_DEPRECATED_v323("Please use Host::get_speed() instead.") double getSpeed() { return get_speed(); }
+  XBT_ATTRIB_DEPRECATED_v323("Please use Host::get_pstate_speed() instead.") double getPstateSpeed(int pstate_index)
+  {
+    return get_pstate_speed(pstate_index);
+  }
+
   std::vector<const char*> get_attached_storages();
   XBT_ATTRIB_DEPRECATED_v323("Please use Host::get_attached_storages() instead.") void getAttachedStorages(
       std::vector<const char*>* storages);
@@ -125,7 +132,11 @@ public:
    *
    *  This is defined in the platform file, and cannot be modified programatically (yet).
    */
-  std::unordered_map<std::string, Storage*> const& getMountedStorages();
+  std::unordered_map<std::string, Storage*> const& get_mounted_storages();
+  XBT_ATTRIB_DEPRECATED_v323("Please use Host::get_mounted_storages() instead.") std::unordered_map<std::string, Storage*> const& getMountedStorages()
+  {
+    return get_mounted_storages();
+  }
 
   void route_to(Host* dest, std::vector<Link*>& links, double* latency);
   void route_to(Host* dest, std::vector<kernel::resource::LinkImpl*>& links, double* latency);
@@ -139,13 +150,6 @@ public:
   /** Block the calling actor on an execution located on the called host (with explicit priority) */
   void execute(double flops, double priority);
 
-  /** @brief Returns the current computation load (in flops per second)
-   * The external load (coming from an availability trace) is not taken in account.
-   *
-   * @return      The number of activities currently running on a host (an activity at priority 2 is counted twice).
-   */
-  double getLoad();
-
   // Deprecated functions
   XBT_ATTRIB_DEPRECATED_v323("Please use Host::get_name()") simgrid::xbt::string const& getName() const
   {
index 7076f7a..32c513f 100644 (file)
@@ -236,7 +236,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_Host_getMountedStorage(JNIEn
 
   int index = 0;
   jobjectArray jtable;
-  std::unordered_map<std::string, msg_storage_t> mounted_storages = host->getMountedStorages();
+  std::unordered_map<std::string, msg_storage_t> mounted_storages = host->get_mounted_storages();
   int count  = mounted_storages.size();
   jclass cls = env->FindClass("org/simgrid/msg/Storage");
 
index a9ba369..44d2276 100644 (file)
@@ -210,7 +210,7 @@ static void instr_host_on_creation(simgrid::s4u::Host& host)
   if ((TRACE_categorized() || TRACE_uncategorized() || TRACE_platform()) && (not TRACE_disable_speed())) {
     simgrid::instr::VariableType* power = container->type_->by_name_or_create("power", "");
     power->set_calling_container(container);
-    power->set_event(0, host.getSpeed());
+    power->set_event(0, host.get_speed());
   }
 
   if (TRACE_uncategorized())
index 5060a2d..6eab5be 100644 (file)
@@ -932,11 +932,11 @@ void System::remove_all_modified_set()
 /**
  * Returns resource load (in flop per second, or byte per second, or similar)
  *
- * If the resource is shared (the default case), the load is sum of resource usage made by every variables located on
- * this resource.
+ * If the resource is shared (the default case), the load is sum of resource usage made by
+ * every variables located on this resource.
  *
- * If the resource is not shared (ie in FATPIPE mode), then the load is the max (not the sum) of all resource usages
- * located on this resource.
+ * If the resource is not shared (ie in FATPIPE mode), then the load is the max (not the sum)
+ * of all resource usages located on this resource.
  */
 double Constraint::get_usage() const
 {
index 0dd3287..70a7a3b 100644 (file)
@@ -32,7 +32,7 @@ File::File(std::string fullpath, sg_host_t host, void* userdata) : fullpath_(ful
   size_t longest_prefix_length = 0;
   XBT_DEBUG("Search for storage name for '%s' on '%s'", fullpath.c_str(), host->get_cname());
 
-  for (auto const& mnt : host->getMountedStorages()) {
+  for (auto const& mnt : host->get_mounted_storages()) {
     XBT_DEBUG("See '%s'", mnt.first.c_str());
     mount_point_ = fullpath.substr(0, mnt.first.length());
 
@@ -246,7 +246,7 @@ int File::remote_copy(sg_host_t host, const char* fullpath)
   Host* dst_host;
   size_t longest_prefix_length = 0;
 
-  for (auto const& elm : host->getMountedStorages()) {
+  for (auto const& elm : host->get_mounted_storages()) {
     std::string mount_point = std::string(fullpath).substr(0, elm.first.size());
     if (mount_point == elm.first && elm.first.length() > longest_prefix_length) {
       /* The current mount name is found in the full path and is bigger than the previous*/
@@ -492,7 +492,7 @@ xbt_dict_t sg_host_get_storage_content(sg_host_t host)
 {
   xbt_assert((host != nullptr), "Invalid parameters");
   xbt_dict_t contents = xbt_dict_new_homogeneous(nullptr);
-  for (auto const& elm : host->getMountedStorages())
+  for (auto const& elm : host->get_mounted_storages())
     xbt_dict_set(contents, elm.first.c_str(), sg_storage_get_content(elm.second), nullptr);
 
   return contents;
index 6a8936a..579af03 100644 (file)
@@ -220,7 +220,7 @@ double HostEnergy::get_current_watts_value()
   if (this->pstate_ == pstate_off_) // The host is off (or was off at the beginning of this time interval)
     return this->watts_off_;
 
-  double current_speed = host_->getSpeed();
+  double current_speed = host_->get_speed();
 
   double cpu_load;
   // We may have start == finish if the past consumption was updated since the simcall was started
index 54d5fc9..dd1d428 100644 (file)
@@ -26,7 +26,7 @@ public:
       : host_(ptr)
       , last_updated_(surf_get_clock())
       , last_reset_(surf_get_clock())
-      , current_speed_(host_->getSpeed())
+      , current_speed_(host_->get_speed())
       , current_flops_(host_->pimpl_cpu->get_constraint()->get_usage())
       , theor_max_flops_(0)
       , was_prev_idle_(current_flops_ == 0)
@@ -81,7 +81,7 @@ void HostLoad::update()
   }
 
   theor_max_flops_ += current_speed_ * host_->get_core_count() * (now - last_updated_);
-  current_speed_ = host_->getSpeed();
+  current_speed_ = host_->get_speed();
   last_updated_  = now;
   was_prev_idle_ = (current_flops_ == 0);
 }
@@ -98,7 +98,7 @@ double HostLoad::get_current_load()
 {
   // We don't need to call update() here because it is called every time an action terminates or starts
   // FIXME: Can this happen at the same time? stop -> call to getCurrentLoad, load = 0 -> next action starts?
-  return current_flops_ / static_cast<double>(host_->getSpeed() * host_->get_core_count());
+  return current_flops_ / static_cast<double>(host_->get_speed() * host_->get_core_count());
 }
 
 /*
@@ -112,7 +112,7 @@ void HostLoad::reset()
   computed_flops_  = 0;
   theor_max_flops_ = 0;
   current_flops_   = host_->pimpl_cpu->get_constraint()->get_usage();
-  current_speed_   = host_->getSpeed();
+  current_speed_   = host_->get_speed();
   was_prev_idle_   = (current_flops_ == 0);
 }
 } // namespace plugin
index e946205..38741de 100644 (file)
@@ -134,7 +134,7 @@ void MigrationTx::operator()()
 {
   XBT_DEBUG("mig: tx_start");
 
-  double host_speed       = vm_->get_pm()->getSpeed();
+  double host_speed       = vm_->get_pm()->get_speed();
   const sg_size_t ramsize = vm_->get_ramsize();
   const double dp_rate =
       host_speed ? (sg_vm_get_migration_speed(vm_) * sg_vm_get_dirty_page_intensity(vm_)) / host_speed : 1;
index aca373b..b727465 100644 (file)
@@ -37,7 +37,7 @@ VirtualMachine::VirtualMachine(const char* name, s4u::Host* physical_host, int c
   // Create a VCPU for this VM
   std::vector<double> speeds;
   for (int i = 0; i < physical_host->get_pstate_count(); i++)
-    speeds.push_back(physical_host->getPstateSpeed(i));
+    speeds.push_back(physical_host->get_pstate_speed(i));
 
   surf_cpu_model_vm->create_cpu(this, &speeds, physical_host->get_core_count());
   if (physical_host->get_pstate() != 0)
index af81dcb..e321de2 100644 (file)
@@ -221,19 +221,36 @@ void Host::set_property(std::string key, std::string value)
 }
 
 /** @brief Get the peak processor speed (in flops/s), at the specified pstate  */
-double Host::getPstateSpeed(int pstate_index)
+double Host::get_pstate_speed(int pstate_index)
 {
   return simgrid::simix::simcall([this, pstate_index] { return this->pimpl_cpu->get_pstate_peak_speed(pstate_index); });
 }
 
-/** @brief Get the peak processor speed in flops/s, (under full load (=1.0), at the current pstate)
+/** @brief Get the peak computing speed in flops/s at the current pstate, taking the external load into account.
  *
- *  The result also takes the external load into account.
+ *  The amount of flops per second available for computing depends on several things:
+ *    - The current pstate determines the maximal peak computing speed (use @ref get_pstate_speed() to retrieve the
+ *      computing speed you would get at another pstate)
+ *    - If you declared an external load, then this reduces the available computing speed (see @ref set_speed_trace())
+ *
+ *  The remaining speed is then shared between the executions located on this host.
+ *  You can retrieve the amount of tasks currently running on this host with @ref get_load().
+ *
+ *  The host may have multiple cores, and your executions may be able to use more than a single core.
+ *
+ *  Finally, executions of priority 2 get twice the amount of flops than executions of priority 1.
  */
-double Host::getSpeed()
+double Host::get_speed()
 {
   return this->pimpl_cpu->get_speed(1.0);
 }
+/** @brief Returns the current computation load (in flops per second)
+ * The external load (coming from an availability trace) is not taken in account.
+ */
+double Host::get_load()
+{
+  return this->pimpl_cpu->get_load();
+}
 /** @brief Get the available speed ratio, between 0 and 1.
  *
  * This accounts for external load (see @ref set_speed_trace()).
@@ -278,7 +295,7 @@ void Host::getAttachedStorages(std::vector<const char*>* storages)
     storages->push_back(elm);
 }
 
-std::unordered_map<std::string, Storage*> const& Host::getMountedStorages()
+std::unordered_map<std::string, Storage*> const& Host::get_mounted_storages()
 {
   if (mounts_ == nullptr) {
     mounts_ = new std::unordered_map<std::string, Storage*>();
@@ -299,11 +316,6 @@ void Host::execute(double flops, double priority)
   simcall_execution_wait(s);
 }
 
-double Host::getLoad()
-{
-  return this->pimpl_cpu->get_load();
-}
-
 } // namespace s4u
 } // namespace simgrid
 
@@ -394,7 +406,7 @@ xbt_dict_t sg_host_get_mounted_storage_list(sg_host_t host)
 {
   xbt_assert((host != nullptr), "Invalid parameters");
   xbt_dict_t res = xbt_dict_new_homogeneous(nullptr);
-  for (auto const& elm : host->getMountedStorages()) {
+  for (auto const& elm : host->get_mounted_storages()) {
     const char* mount_name = elm.first.c_str();
     sg_storage_t storage   = elm.second;
     xbt_dict_set(res, mount_name, (void*)storage->get_cname(), nullptr);
@@ -417,7 +429,7 @@ xbt_dynar_t sg_host_get_attached_storage_list(sg_host_t host)
 /** @brief Returns the total speed of a host */
 double sg_host_speed(sg_host_t host)
 {
-  return host->getSpeed();
+  return host->get_speed();
 }
 
 /** \brief Return the speed of the processor (in flop/s) at a given pstate. See also @ref plugin_energy.
@@ -428,7 +440,7 @@ double sg_host_speed(sg_host_t host)
  */
 double sg_host_get_pstate_speed(sg_host_t host, int pstate_index)
 {
-  return host->getPstateSpeed(pstate_index);
+  return host->get_pstate_speed(pstate_index);
 }
 
 /** \ingroup m_host_management
@@ -603,7 +615,7 @@ double sg_host_route_bandwidth(sg_host_t from, sg_host_t to)
 void sg_host_dump(sg_host_t host)
 {
   XBT_INFO("Displaying host %s", host->get_cname());
-  XBT_INFO("  - speed: %.0f", host->getSpeed());
+  XBT_INFO("  - speed: %.0f", host->get_speed());
   XBT_INFO("  - available speed: %.2f", sg_host_get_available_speed(host));
   std::unordered_map<std::string, std::string>* props = host->get_properties();
 
index 7fd697e..2894ffa 100644 (file)
@@ -683,7 +683,7 @@ double SD_task_get_execution_time(SD_task_t /*task*/, int host_count, const sg_h
   for (int i = 0; i < host_count; i++) {
     double time = 0.0;
     if (flops_amount != nullptr)
-      time = flops_amount[i] / host_list[i]->getSpeed();
+      time = flops_amount[i] / host_list[i]->get_speed();
 
     if (bytes_amount != nullptr)
       for (int j = 0; j < host_count; j++)
index 8fe3b4e..a328d2c 100644 (file)
@@ -24,7 +24,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_dvfs, smpi, "Logging specific to SMPI (expe
  */
 double smpi_get_host_power_peak_at(int pstate_index)
 {
-  return sg_host_self()->getPstateSpeed(pstate_index);
+  return sg_host_self()->get_pstate_speed(pstate_index);
 }
 
 /**
@@ -34,7 +34,7 @@ double smpi_get_host_power_peak_at(int pstate_index)
  */
 double smpi_get_host_current_power_peak()
 {
-  return sg_host_self()->getSpeed();
+  return sg_host_self()->get_speed();
 }
 
 /**
index 4732410..f6ffd0b 100644 (file)
@@ -680,7 +680,7 @@ void Request::iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status*
   // nsleeps is a multiplier to the sleeptime, to increase speed of execution, each failed iprobe will increase it
   // This can speed up the execution of certain applications by an order of magnitude, such as HPL
   static int nsleeps = 1;
-  double speed        = simgrid::s4u::Actor::self()->get_host()->getSpeed();
+  double speed        = simgrid::s4u::Actor::self()->get_host()->get_speed();
   double maxrate      = simgrid::config::get_value<double>("smpi/iprobe-cpu-usage");
   MPI_Request request = new Request(nullptr, 0, MPI_CHAR,
                                     source == MPI_ANY_SOURCE ? MPI_ANY_SOURCE : comm->group()->actor(source)->get_pid(),
index d2ed8fe..26c3404 100644 (file)
@@ -103,7 +103,7 @@ static void storage_info(simgrid::s4u::Host* host)
 {
   XBT_INFO("*** Storage info on %s ***", host->get_cname());
 
-  for (auto const& elm : host->getMountedStorages()) {
+  for (auto const& elm : host->get_mounted_storages()) {
     const std::string& mount_name  = elm.first;
     simgrid::s4u::Storage* storage = elm.second;
     XBT_INFO("\tStorage name: %s, mount name: %s", storage->get_cname(), mount_name.c_str());