Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Allow units in smpi factors.
[simgrid.git] / src / smpi / internals / smpi_utils.cpp
index e646ff7..931d3ec 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2016-2017. The SimGrid Team.
+/* Copyright (c) 2016-2019. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -8,10 +8,11 @@
 #include "xbt/log.h"
 #include "xbt/sysdep.h"
 #include <boost/tokenizer.hpp>
+#include "src/surf/xml/platf_private.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_utils, smpi, "Logging specific to SMPI (utils)");
 
-std::vector<s_smpi_factor_t> parse_factor(std::string smpi_coef_string)
+std::vector<s_smpi_factor_t> parse_factor(const std::string& smpi_coef_string)
 {
   std::vector<s_smpi_factor_t> smpi_factor;
 
@@ -48,7 +49,7 @@ std::vector<s_smpi_factor_t> parse_factor(std::string smpi_coef_string)
         }
       } else {
         try {
-          fact.values.push_back(std::stod(*factor_iter));
+          fact.values.push_back(surf_parse_get_time((*factor_iter).c_str(), "smpi factor", std::to_string(smpi_factor.size() + 1) + ": " + *factor_iter));
         } catch (std::invalid_argument& ia) {
           throw std::invalid_argument(std::string("Invalid factor value ") + std::to_string(iteration) + " in chunk " +
                                       std::to_string(smpi_factor.size() + 1) + ": " + *factor_iter);