X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/6d4ada780dde0b81879a78d8e2f10644dd406f20..cfbf3bda3a828313326d322fa92fb6719904d1a4:/src/smpi/internals/smpi_utils.cpp diff --git a/src/smpi/internals/smpi_utils.cpp b/src/smpi/internals/smpi_utils.cpp index ae8df4423a..3973f8b2c2 100644 --- a/src/smpi/internals/smpi_utils.cpp +++ b/src/smpi/internals/smpi_utils.cpp @@ -1,23 +1,28 @@ -/* Copyright (c) 2016-2019. The SimGrid Team. +/* Copyright (c) 2016-2021. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ #include "smpi_utils.hpp" + +#include "src/surf/xml/platf_private.hpp" #include "xbt/log.h" +#include "xbt/parse_units.hpp" #include "xbt/sysdep.h" #include -#include "src/surf/xml/platf_private.hpp" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_utils, smpi, "Logging specific to SMPI (utils)"); +extern std::string surf_parsed_filename; +extern int surf_parse_lineno; + std::vector parse_factor(const std::string& smpi_coef_string) { std::vector smpi_factor; /** Setup the tokenizer that parses the string **/ - typedef boost::tokenizer> Tokenizer; + using Tokenizer = boost::tokenizer>; boost::char_separator sep(";"); boost::char_separator factor_separator(":"); Tokenizer tokens(smpi_coef_string, sep); @@ -43,14 +48,15 @@ std::vector parse_factor(const std::string& smpi_coef_string) if (factor_iter == factor_values.begin()) { /* first element */ try { fact.factor = std::stoi(*factor_iter); - } catch (std::invalid_argument& ia) { + } catch (const std::invalid_argument&) { throw std::invalid_argument(std::string("Invalid factor in chunk ") + std::to_string(smpi_factor.size() + 1) + ": " + *factor_iter); } } else { try { - fact.values.push_back(surf_parse_get_time((*factor_iter).c_str(), "smpi factor", "")); - } catch (std::invalid_argument& ia) { + fact.values.push_back( + xbt_parse_get_time(surf_parsed_filename, surf_parse_lineno, (*factor_iter).c_str(), "smpi factor", "")); + } 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); }