Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use std::string for xbt_parse_units.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 27 May 2021 09:04:25 +0000 (11:04 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 27 May 2021 09:43:16 +0000 (11:43 +0200)
Combine parameters 'entity_kind' and 'name'.
Also rename surf_parse_* to xbt_parse_*.

include/xbt/parse_units.hpp
src/bindings/lua/lua_platf.cpp
src/plugins/file_system/s4u_FileSystem.cpp
src/s4u/s4u_Host.cpp
src/s4u/s4u_Link.cpp
src/s4u/s4u_Netzone.cpp
src/smpi/internals/smpi_config.cpp
src/smpi/internals/smpi_utils.cpp
src/surf/xml/surfxml_sax_cb.cpp
src/xbt/xbt_parse_units.cpp

index 05954fa..6ced941 100644 (file)
@@ -7,17 +7,19 @@
 #ifndef SIMGRID_XBT_PARSE_UNITS_HPP
 #define SIMGRID_XBT_PARSE_UNITS_HPP
 
-double xbt_parse_get_time(const std::string& filename, int lineno, const char* string, const char* entity_kind,
-                          const std::string& name);
-double surf_parse_get_size(const std::string& filename, int lineno, const char* string, const char* entity_kind,
-                           const std::string& name);
-double xbt_parse_get_bandwidth(const std::string& filename, int lineno, const char* string, const char* entity_kind,
-                               const std::string& name);
-std::vector<double> xbt_parse_get_bandwidths(const std::string& filename, int lineno, const char* string,
-                                             const char* entity_kind, const std::string& name);
-double xbt_parse_get_speed(const std::string& filename, int lineno, const char* string, const char* entity_kind,
-                           const std::string& name);
-std::vector<double> xbt_parse_get_all_speeds(const std::string& filename, int lineno, char* speeds,
-                                             const char* entity_kind, const std::string& id);
+#include <string>
+
+double xbt_parse_get_time(const std::string& filename, int lineno, const std::string& string,
+                          const std::string& entity_kind);
+double xbt_parse_get_size(const std::string& filename, int lineno, const std::string& string,
+                          const std::string& entity_kind);
+double xbt_parse_get_bandwidth(const std::string& filename, int lineno, const std::string& string,
+                               const std::string& entity_kind);
+std::vector<double> xbt_parse_get_bandwidths(const std::string& filename, int lineno, const std::string& string,
+                                             const std::string& entity_kind);
+double xbt_parse_get_speed(const std::string& filename, int lineno, const std::string& string,
+                           const std::string& entity_kind);
+std::vector<double> xbt_parse_get_all_speeds(const std::string& filename, int lineno, const std::string& speeds,
+                                             const std::string& entity_kind);
 
 #endif
index 48dface..1df2436 100644 (file)
@@ -96,8 +96,8 @@ int console_add_backbone(lua_State *L) {
   type = lua_gettable(L, -2);
   lua_ensure(type == LUA_TSTRING || type == LUA_TNUMBER,
       "Attribute 'bandwidth' must be specified for backbone and must either be a string (in the right format; see docs) or a number.");
-  link->bandwidths.push_back(xbt_parse_get_bandwidth(ar.short_src, ar.currentline, lua_tostring(L, -1),
-                                                     "bandwidth of backbone", link->id.c_str()));
+  link->bandwidths.push_back(
+      xbt_parse_get_bandwidth(ar.short_src, ar.currentline, lua_tostring(L, -1), "bandwidth of backbone " + link->id));
   lua_pop(L, 1);
 
   lua_pushstring(L, "lat");
@@ -105,7 +105,7 @@ int console_add_backbone(lua_State *L) {
   lua_ensure(type == LUA_TSTRING || type == LUA_TNUMBER,
       "Attribute 'lat' must be specified for backbone and must either be a string (in the right format; see docs) or a number.");
   link->latency =
-      xbt_parse_get_time(ar.short_src, ar.currentline, lua_tostring(L, -1), "latency of backbone", link->id.c_str());
+      xbt_parse_get_time(ar.short_src, ar.currentline, lua_tostring(L, -1), "latency of backbone " + link->id);
   lua_pop(L, 1);
 
   lua_pushstring(L, "sharing_policy");
@@ -179,7 +179,7 @@ int console_add_host(lua_State *L) {
     host.speed_per_pstate.push_back(lua_tonumber(L, -1));
   else // LUA_TSTRING
     host.speed_per_pstate.push_back(
-        xbt_parse_get_speed(ar.short_src, ar.currentline, lua_tostring(L, -1), "speed of host", host.id));
+        xbt_parse_get_speed(ar.short_src, ar.currentline, lua_tostring(L, -1), "speed of host " + host.id));
   lua_pop(L, 1);
 
   // get core
@@ -241,8 +241,8 @@ int  console_add_link(lua_State *L) {
   if (type == LUA_TNUMBER)
     link.bandwidths.push_back(lua_tonumber(L, -1));
   else // LUA_TSTRING
-    link.bandwidths.push_back(xbt_parse_get_bandwidth(ar.short_src, ar.currentline, lua_tostring(L, -1),
-                                                      "bandwidth of link", link.id.c_str()));
+    link.bandwidths.push_back(
+        xbt_parse_get_bandwidth(ar.short_src, ar.currentline, lua_tostring(L, -1), "bandwidth of link " + link.id));
   lua_pop(L, 1);
 
   //get latency value
@@ -253,8 +253,7 @@ int  console_add_link(lua_State *L) {
   if (type == LUA_TNUMBER)
     link.latency = lua_tonumber(L, -1);
   else // LUA_TSTRING
-    link.latency =
-        xbt_parse_get_time(ar.short_src, ar.currentline, lua_tostring(L, -1), "latency of link", link.id.c_str());
+    link.latency = xbt_parse_get_time(ar.short_src, ar.currentline, lua_tostring(L, -1), "latency of link " + link.id);
   lua_pop(L, 1);
 
   /*Optional Arguments  */
index bfa07cc..12dd673 100644 (file)
@@ -329,7 +329,7 @@ FileSystemDiskExt::FileSystemDiskExt(const Disk* ptr)
   const char* size_str    = ptr->get_property("size");
   std::string dummyfile;
   if (size_str)
-    size_ = surf_parse_get_size(dummyfile, -1, size_str, "disk size", ptr->get_name());
+    size_ = xbt_parse_get_size(dummyfile, -1, size_str, "disk size " + ptr->get_name());
 
   const char* current_mount_str = ptr->get_property("mount");
   if (current_mount_str)
index 7005ea0..b56ad8f 100644 (file)
@@ -277,7 +277,7 @@ std::vector<double> Host::convert_pstate_speed_vector(const std::vector<std::str
   speed_list.reserve(speed_per_state.size());
   for (const auto& speed_str : speed_per_state) {
     try {
-      double speed = xbt_parse_get_speed("", 0, speed_str.c_str(), nullptr, "");
+      double speed = xbt_parse_get_speed("", 0, speed_str, "");
       speed_list.push_back(speed);
     } catch (const simgrid::ParseError&) {
       throw std::invalid_argument(std::string("Invalid speed value: ") + speed_str);
@@ -329,14 +329,14 @@ Disk* Host::create_disk(const std::string& name, const std::string& read_bandwid
 {
   double d_read;
   try {
-    d_read = xbt_parse_get_bandwidth("", 0, read_bandwidth.c_str(), nullptr, "");
+    d_read = xbt_parse_get_bandwidth("", 0, read_bandwidth, "");
   } catch (const simgrid::ParseError&) {
     throw std::invalid_argument(std::string("Impossible to create disk: ") + name +
                                 std::string(". Invalid read bandwidth: ") + read_bandwidth);
   }
   double d_write;
   try {
-    d_write = xbt_parse_get_bandwidth("", 0, write_bandwidth.c_str(), nullptr, "");
+    d_write = xbt_parse_get_bandwidth("", 0, write_bandwidth, "");
   } catch (const simgrid::ParseError&) {
     throw std::invalid_argument(std::string("Impossible to create disk: ") + name +
                                 std::string(". Invalid write bandwidth: ") + write_bandwidth);
index ce6ba9d..5badfff 100644 (file)
@@ -73,7 +73,7 @@ Link* Link::set_latency(const std::string& value)
 {
   double d_value = 0.0;
   try {
-    d_value = xbt_parse_get_time("", 0, value.c_str(), nullptr, "");
+    d_value = xbt_parse_get_time("", 0, value, "");
   } catch (const simgrid::ParseError&) {
     throw std::invalid_argument(std::string("Impossible to set latency for link: ") + get_name() +
                                 std::string(". Invalid value: ") + value);
index 3d768ab..d9d23ef 100644 (file)
@@ -186,7 +186,7 @@ s4u::Link* NetZone::create_link(const std::string& name, const std::vector<std::
   bw.reserve(bandwidths.size());
   for (const auto& speed_str : bandwidths) {
     try {
-      double speed = xbt_parse_get_bandwidth("", 0, speed_str.c_str(), nullptr, "");
+      double speed = xbt_parse_get_bandwidth("", 0, speed_str, "");
       bw.push_back(speed);
     } catch (const simgrid::ParseError&) {
       throw std::invalid_argument(std::string("Impossible to create link: ") + name +
index d38ea1b..bab79ce 100644 (file)
@@ -38,11 +38,9 @@ double _smpi_cfg_host_speed;
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_config, smpi, "Logging specific to SMPI (config)");
 
 simgrid::config::Flag<std::string> _smpi_cfg_host_speed_string{
-    "smpi/host-speed",
-    "Speed of the host running the simulation (in flop/s). "
-    "Used to bench the operations.",
-    "20000f", [](const std::string& str) {
-      _smpi_cfg_host_speed = xbt_parse_get_speed("smpi/host-speed", 1, str.c_str(), "option", "smpi/host-speed");
+    "smpi/host-speed", "Speed of the host running the simulation (in flop/s). Used to bench the operations.", "20000f",
+    [](const std::string& str) {
+      _smpi_cfg_host_speed = xbt_parse_get_speed("smpi/host-speed", 1, str, "option smpi/host-speed");
       xbt_assert(_smpi_cfg_host_speed > 0.0, "Invalid value (%s) for 'smpi/host-speed': it must be positive.",
                  _smpi_cfg_host_speed_string.get().c_str());
     }};
index aec528f..870ae30 100644 (file)
@@ -85,8 +85,7 @@ std::vector<s_smpi_factor_t> parse_factor(const std::string& smpi_coef_string)
         }
       } else {
         try {
-          fact.values.push_back(
-              xbt_parse_get_time(surf_parsed_filename, surf_parse_lineno, (*factor_iter).c_str(), "smpi factor", ""));
+          fact.values.push_back(xbt_parse_get_time(surf_parsed_filename, surf_parse_lineno, *factor_iter, ""));
         } catch (const std::invalid_argument&) {
           throw std::invalid_argument(std::string("Invalid factor value ") + std::to_string(iteration) + " in chunk " +
                                       std::to_string(smpi_factor.size() + 1) + ": " + *factor_iter);
index fc31b33..b95eb0b 100644 (file)
@@ -237,8 +237,8 @@ void STag_surfxml_host()
   property_sets.emplace_back();
   host.id = A_surfxml_host_id;
 
-  host.speed_per_pstate =
-      xbt_parse_get_all_speeds(surf_parsed_filename, surf_parse_lineno, A_surfxml_host_speed, "speed of host", host.id);
+  host.speed_per_pstate = xbt_parse_get_all_speeds(surf_parsed_filename, surf_parse_lineno, A_surfxml_host_speed,
+                                                   "speed of host " + host.id);
 
   XBT_DEBUG("pstate: %s", A_surfxml_host_pstate);
   host.core_amount = surf_parse_get_int(A_surfxml_host_core);
@@ -276,9 +276,9 @@ void ETag_surfxml_disk() {
 
   disk.id       = A_surfxml_disk_id;
   disk.read_bw  = xbt_parse_get_bandwidth(surf_parsed_filename, surf_parse_lineno, A_surfxml_disk_read___bw,
-                                         "read_bw of disk ", disk.id);
+                                         "read_bw of disk " + disk.id);
   disk.write_bw = xbt_parse_get_bandwidth(surf_parsed_filename, surf_parse_lineno, A_surfxml_disk_write___bw,
-                                          "write_bw of disk ", disk.id);
+                                          "write_bw of disk " + disk.id);
 
   sg_platf_new_disk(&disk);
 }
@@ -307,29 +307,30 @@ void ETag_surfxml_cluster(){
   cluster.suffix      = A_surfxml_cluster_suffix;
   explodesRadical(A_surfxml_cluster_radical, &cluster.radicals);
 
-  cluster.speeds      = xbt_parse_get_all_speeds(surf_parsed_filename, surf_parse_lineno, A_surfxml_cluster_speed,
-                                            "speed of cluster", cluster.id);
+  cluster.speeds = xbt_parse_get_all_speeds(surf_parsed_filename, surf_parse_lineno, A_surfxml_cluster_speed,
+                                            "speed of cluster " + cluster.id);
   cluster.core_amount = surf_parse_get_int(A_surfxml_cluster_core);
-  cluster.bw = xbt_parse_get_bandwidth(surf_parsed_filename, surf_parse_lineno, A_surfxml_cluster_bw, "bw of cluster",
-                                       cluster.id);
-  cluster.lat =
-      xbt_parse_get_time(surf_parsed_filename, surf_parse_lineno, A_surfxml_cluster_lat, "lat of cluster", cluster.id);
+  cluster.bw          = xbt_parse_get_bandwidth(surf_parsed_filename, surf_parse_lineno, A_surfxml_cluster_bw,
+                                       "bw of cluster " + cluster.id);
+  cluster.lat = xbt_parse_get_time(surf_parsed_filename, surf_parse_lineno, A_surfxml_cluster_lat,
+                                   "lat of cluster " + cluster.id);
   if(strcmp(A_surfxml_cluster_bb___bw,""))
     cluster.bb_bw = xbt_parse_get_bandwidth(surf_parsed_filename, surf_parse_lineno, A_surfxml_cluster_bb___bw,
-                                            "bb_bw of cluster", cluster.id);
+                                            "bb_bw of cluster " + cluster.id);
   if(strcmp(A_surfxml_cluster_bb___lat,""))
     cluster.bb_lat = xbt_parse_get_time(surf_parsed_filename, surf_parse_lineno, A_surfxml_cluster_bb___lat,
-                                        "bb_lat of cluster", cluster.id);
+                                        "bb_lat of cluster " + cluster.id);
   if(strcmp(A_surfxml_cluster_limiter___link,""))
     cluster.limiter_link =
         xbt_parse_get_bandwidth(surf_parsed_filename, surf_parse_lineno, A_surfxml_cluster_limiter___link,
-                                "limiter_link of cluster", cluster.id);
+                                "limiter_link of cluster " + cluster.id);
   if(strcmp(A_surfxml_cluster_loopback___bw,""))
-    cluster.loopback_bw = xbt_parse_get_bandwidth(
-        surf_parsed_filename, surf_parse_lineno, A_surfxml_cluster_loopback___bw, "loopback_bw of cluster", cluster.id);
+    cluster.loopback_bw =
+        xbt_parse_get_bandwidth(surf_parsed_filename, surf_parse_lineno, A_surfxml_cluster_loopback___bw,
+                                "loopback_bw of cluster " + cluster.id);
   if(strcmp(A_surfxml_cluster_loopback___lat,""))
     cluster.loopback_lat = xbt_parse_get_time(surf_parsed_filename, surf_parse_lineno, A_surfxml_cluster_loopback___lat,
-                                              "loopback_lat of cluster", cluster.id);
+                                              "loopback_lat of cluster " + cluster.id);
 
   switch(AX_surfxml_cluster_topology){
   case A_surfxml_cluster_topology_FLAT:
@@ -391,11 +392,11 @@ void STag_surfxml_cabinet(){
   cabinet.prefix  = A_surfxml_cabinet_prefix;
   cabinet.suffix  = A_surfxml_cabinet_suffix;
   cabinet.speed   = xbt_parse_get_speed(surf_parsed_filename, surf_parse_lineno, A_surfxml_cabinet_speed,
-                                      "speed of cabinet", cabinet.id.c_str());
-  cabinet.bw  = xbt_parse_get_bandwidth(surf_parsed_filename, surf_parse_lineno, A_surfxml_cabinet_bw, "bw of cabinet",
-                                       cabinet.id.c_str());
-  cabinet.lat = xbt_parse_get_time(surf_parsed_filename, surf_parse_lineno, A_surfxml_cabinet_lat, "lat of cabinet",
-                                   cabinet.id.c_str());
+                                      "speed of cabinet " + cabinet.id);
+  cabinet.bw = xbt_parse_get_bandwidth(surf_parsed_filename, surf_parse_lineno, A_surfxml_cabinet_bw,
+                                       "bw of cabinet " + cabinet.id);
+  cabinet.lat = xbt_parse_get_time(surf_parsed_filename, surf_parse_lineno, A_surfxml_cabinet_lat,
+                                   "lat of cabinet " + cabinet.id);
   explodesRadical(A_surfxml_cabinet_radical, &cabinet.radicals);
 
   sg_platf_new_cabinet(&cabinet);
@@ -405,12 +406,12 @@ void STag_surfxml_peer(){
   simgrid::kernel::routing::PeerCreationArgs peer;
 
   peer.id          = std::string(A_surfxml_peer_id);
-  peer.speed       = xbt_parse_get_speed(surf_parsed_filename, surf_parse_lineno, A_surfxml_peer_speed, "speed of peer",
-                                   peer.id.c_str());
-  peer.bw_in = xbt_parse_get_bandwidth(surf_parsed_filename, surf_parse_lineno, A_surfxml_peer_bw___in, "bw_in of peer",
-                                       peer.id.c_str());
-  peer.bw_out      = xbt_parse_get_bandwidth(surf_parsed_filename, surf_parse_lineno, A_surfxml_peer_bw___out,
-                                        "bw_out of peer", peer.id.c_str());
+  peer.speed =
+      xbt_parse_get_speed(surf_parsed_filename, surf_parse_lineno, A_surfxml_peer_speed, "speed of peer " + peer.id);
+  peer.bw_in = xbt_parse_get_bandwidth(surf_parsed_filename, surf_parse_lineno, A_surfxml_peer_bw___in,
+                                       "bw_in of peer " + peer.id);
+  peer.bw_out = xbt_parse_get_bandwidth(surf_parsed_filename, surf_parse_lineno, A_surfxml_peer_bw___out,
+                                        "bw_out of peer " + peer.id);
   peer.coord       = A_surfxml_peer_coordinates;
   peer.speed_trace = nullptr;
   if (A_surfxml_peer_availability___file[0] != '\0') {
@@ -442,12 +443,12 @@ void ETag_surfxml_link(){
 
   link.id                  = std::string(A_surfxml_link_id);
   link.bandwidths          = xbt_parse_get_bandwidths(surf_parsed_filename, surf_parse_lineno, A_surfxml_link_bandwidth,
-                                             "bandwidth of link", link.id.c_str());
+                                             "bandwidth of link " + link.id);
   link.bandwidth_trace     = A_surfxml_link_bandwidth___file[0]
                              ? simgrid::kernel::profile::Profile::from_file(A_surfxml_link_bandwidth___file)
                              : nullptr;
-  link.latency = xbt_parse_get_time(surf_parsed_filename, surf_parse_lineno, A_surfxml_link_latency, "latency of link",
-                                    link.id.c_str());
+  link.latency =
+      xbt_parse_get_time(surf_parsed_filename, surf_parse_lineno, A_surfxml_link_latency, "latency of link " + link.id);
   link.latency_trace       = A_surfxml_link_latency___file[0]
                            ? simgrid::kernel::profile::Profile::from_file(A_surfxml_link_latency___file)
                            : nullptr;
@@ -517,11 +518,10 @@ void ETag_surfxml_backbone()
   auto link = std::make_unique<simgrid::kernel::routing::LinkCreationArgs>();
 
   link->id = std::string(A_surfxml_backbone_id);
-  link->bandwidths.push_back(xbt_parse_get_bandwidth(surf_parsed_filename, surf_parse_lineno,
-                                                     A_surfxml_backbone_bandwidth, "bandwidth of backbone",
-                                                     link->id.c_str()));
+  link->bandwidths.push_back(xbt_parse_get_bandwidth(
+      surf_parsed_filename, surf_parse_lineno, A_surfxml_backbone_bandwidth, "bandwidth of backbone " + link->id));
   link->latency = xbt_parse_get_time(surf_parsed_filename, surf_parse_lineno, A_surfxml_backbone_latency,
-                                     "latency of backbone", link->id.c_str());
+                                     "latency of backbone " + link->id);
   link->policy  = simgrid::s4u::Link::SharingPolicy::SHARED;
 
   routing_cluster_add_backbone(std::move(link));
index 7bdcbf9..01066f2 100644 (file)
@@ -51,14 +51,14 @@ unit_scale::unit_scale(std::initializer_list<std::tuple<const std::string, doubl
   }
 }
 
-/* Note: no warning is issued for unit-less values when `name' is empty. */
-static double surf_parse_get_value_with_unit(const std::string& filename, int lineno, const char* string,
-                                             const unit_scale& units, const char* entity_kind, const std::string& name,
-                                             const char* error_msg, const char* default_unit)
+/* Note: no warning is issued for unit-less values when `entity_kind' is empty. */
+static double xbt_parse_get_value_with_unit(const std::string& filename, int lineno, const std::string& string,
+                                            const unit_scale& units, const std::string& entity_kind,
+                                            const char* error_msg, const char* default_unit)
 {
   char* endptr;
   errno           = 0;
-  double res      = strtod(string, &endptr);
+  double res      = strtod(string.c_str(), &endptr);
   const char* ptr = endptr; // for const-correctness
   if (errno == ERANGE)
     throw simgrid::ParseError(filename, lineno, std::string("value out of range: ") + string);
@@ -66,8 +66,8 @@ static double surf_parse_get_value_with_unit(const std::string& filename, int li
     throw simgrid::ParseError(filename, lineno, std::string("cannot parse number:") + string);
   if (ptr[0] == '\0') {
     // Ok, 0 can be unit-less
-    if (res != 0 && not name.empty())
-      XBT_WARN("Deprecated unit-less value '%s' for %s %s. %s", string, entity_kind, name.c_str(), error_msg);
+    if (res != 0 && not entity_kind.empty())
+      XBT_WARN("Deprecated unit-less value '%s' for %s. %s", string.c_str(), entity_kind.c_str(), error_msg);
     ptr = default_unit;
   }
   auto u = units.find(ptr);
@@ -76,8 +76,8 @@ static double surf_parse_get_value_with_unit(const std::string& filename, int li
   return res * u->second;
 }
 
-double xbt_parse_get_time(const std::string& filename, int lineno, const char* string, const char* entity_kind,
-                          const std::string& name)
+double xbt_parse_get_time(const std::string& filename, int lineno, const std::string& string,
+                          const std::string& entity_kind)
 {
   static const unit_scale units{std::make_pair("w", 7 * 24 * 60 * 60),
                                 std::make_pair("d", 24 * 60 * 60),
@@ -88,31 +88,31 @@ double xbt_parse_get_time(const std::string& filename, int lineno, const char* s
                                 std::make_pair("us", 1e-6),
                                 std::make_pair("ns", 1e-9),
                                 std::make_pair("ps", 1e-12)};
-  return surf_parse_get_value_with_unit(filename, lineno, string, units, entity_kind, name,
-                                        "Append 's' to your time to get seconds", "s");
+  return xbt_parse_get_value_with_unit(filename, lineno, string, units, entity_kind,
+                                       "Append 's' to your time to get seconds", "s");
 }
 
-double surf_parse_get_size(const std::string& filename, int lineno, const char* string, const char* entity_kind,
-                           const std::string& name)
+double xbt_parse_get_size(const std::string& filename, int lineno, const std::string& string,
+                          const std::string& entity_kind)
 {
   static const unit_scale units{std::make_tuple("b", 0.125, 2, true), std::make_tuple("b", 0.125, 10, true),
                                 std::make_tuple("B", 1.0, 2, true), std::make_tuple("B", 1.0, 10, true)};
-  return surf_parse_get_value_with_unit(filename, lineno, string, units, entity_kind, name,
-                                        "Append 'B' to get bytes (or 'b' for bits but 1B = 8b).", "B");
+  return xbt_parse_get_value_with_unit(filename, lineno, string, units, entity_kind,
+                                       "Append 'B' to get bytes (or 'b' for bits but 1B = 8b).", "B");
 }
 
-double xbt_parse_get_bandwidth(const std::string& filename, int lineno, const char* string, const char* entity_kind,
-                               const std::string& name)
+double xbt_parse_get_bandwidth(const std::string& filename, int lineno, const std::string& string,
+                               const std::string& entity_kind)
 {
   static const unit_scale units{std::make_tuple("bps", 0.125, 2, true), std::make_tuple("bps", 0.125, 10, true),
                                 std::make_tuple("Bps", 1.0, 2, true), std::make_tuple("Bps", 1.0, 10, true)};
-  return surf_parse_get_value_with_unit(filename, lineno, string, units, entity_kind, name,
-                                        "Append 'Bps' to get bytes per second (or 'bps' for bits but 1Bps = 8bps)",
-                                        "Bps");
+  return xbt_parse_get_value_with_unit(filename, lineno, string, units, entity_kind,
+                                       "Append 'Bps' to get bytes per second (or 'bps' for bits but 1Bps = 8bps)",
+                                       "Bps");
 }
 
-std::vector<double> xbt_parse_get_bandwidths(const std::string& filename, int lineno, const char* string,
-                                             const char* entity_kind, const std::string& name)
+std::vector<double> xbt_parse_get_bandwidths(const std::string& filename, int lineno, const std::string& string,
+                                             const std::string& entity_kind)
 {
   static const unit_scale units{std::make_tuple("bps", 0.125, 2, true), std::make_tuple("bps", 0.125, 10, true),
                                 std::make_tuple("Bps", 1.0, 2, true), std::make_tuple("Bps", 1.0, 10, true)};
@@ -121,36 +121,36 @@ std::vector<double> xbt_parse_get_bandwidths(const std::string& filename, int li
   std::vector<std::string> tokens;
   boost::split(tokens, string, boost::is_any_of(";,"));
   for (auto const& token : tokens) {
-    bandwidths.push_back(surf_parse_get_value_with_unit(
-        filename, lineno, token.c_str(), units, entity_kind, name,
+    bandwidths.push_back(xbt_parse_get_value_with_unit(
+        filename, lineno, token.c_str(), units, entity_kind,
         "Append 'Bps' to get bytes per second (or 'bps' for bits but 1Bps = 8bps)", "Bps"));
   }
 
   return bandwidths;
 }
 
-double xbt_parse_get_speed(const std::string& filename, int lineno, const char* string, const char* entity_kind,
-                           const std::string& name)
+double xbt_parse_get_speed(const std::string& filename, int lineno, const std::string& string,
+                           const std::string& entity_kind)
 {
   static const unit_scale units{std::make_tuple("f", 1.0, 10, true), std::make_tuple("flops", 1.0, 10, false)};
-  return surf_parse_get_value_with_unit(filename, lineno, string, units, entity_kind, name,
-                                        "Append 'f' or 'flops' to your speed to get flop per second", "f");
+  return xbt_parse_get_value_with_unit(filename, lineno, string, units, entity_kind,
+                                       "Append 'f' or 'flops' to your speed to get flop per second", "f");
 }
 
-std::vector<double> xbt_parse_get_all_speeds(const std::string& filename, int lineno, char* speeds,
-                                             const char* entity_kind, const std::string& id)
+std::vector<double> xbt_parse_get_all_speeds(const std::string& filename, int lineno, const std::string& speeds,
+                                             const std::string& entity_kind)
 {
   std::vector<double> speed_per_pstate;
 
-  if (strchr(speeds, ',') == nullptr) {
-    double speed = xbt_parse_get_speed(filename, lineno, speeds, entity_kind, id);
+  if (speeds.find('.') == std::string::npos) {
+    double speed = xbt_parse_get_speed(filename, lineno, speeds, entity_kind);
     speed_per_pstate.push_back(speed);
   } else {
     std::vector<std::string> pstate_list;
     boost::split(pstate_list, speeds, boost::is_any_of(","));
     for (auto speed_str : pstate_list) {
       boost::trim(speed_str);
-      double speed = xbt_parse_get_speed(filename, lineno, speed_str.c_str(), entity_kind, id);
+      double speed = xbt_parse_get_speed(filename, lineno, speed_str, entity_kind);
       speed_per_pstate.push_back(speed);
       XBT_DEBUG("Speed value: %f", speed);
     }