-/* Copyright (c) 2016-2017. The SimGrid Team.
+/* Copyright (c) 2016-2020. 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/smpi_utils.hpp"
-#include "xbt/sysdep.h"
+#include "smpi_utils.hpp"
#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;
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(std::stod(*factor_iter));
- } catch (std::invalid_argument& ia) {
+ fact.values.push_back(surf_parse_get_time((*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);
}