X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/ea10e88fd41a11386d9e3868d72ab8cb933a4292..a6071d1660902b3e0634c8ee6b7508e7f965c787:/src/smpi/internals/instr_smpi.cpp diff --git a/src/smpi/internals/instr_smpi.cpp b/src/smpi/internals/instr_smpi.cpp index 29beff2dfa..335b79e27b 100644 --- a/src/smpi/internals/instr_smpi.cpp +++ b/src/smpi/internals/instr_smpi.cpp @@ -5,9 +5,6 @@ #include "private.hpp" #include -#include -#include -#include #include #include #include @@ -89,9 +86,9 @@ static const char* instr_find_color(const char* c_state) if (smpi_colors.find(state) != smpi_colors.end()) { // Exact match in the map? return smpi_colors.find(state)->second.c_str(); } - for (const auto& pair : smpi_colors) { // Is an entry of our map a substring of this state name? - if (std::strstr(state.c_str(), pair.first.c_str()) != nullptr) - return pair.second.c_str(); + for (const auto& [smpi_state, color] : smpi_colors) { // Is an entry of our map a substring of this state name? + if (state.find(smpi_state) != std::string::npos) + return color.c_str(); } return "0.5 0.5 0.5"; // Just in case we find nothing in the map ... @@ -123,8 +120,7 @@ static std::string TRACE_smpi_get_key(aid_t src, aid_t dst, int tag, int send) std::string key; std::string aux = std::to_string(src) + "#" + std::to_string(dst) + "#" + std::to_string(tag) + "#" + std::to_string(send == 1 ? 0 : 1); - auto it = keys.find(aux); - if (it == keys.end()) { + if (auto it = keys.find(aux); it == keys.end()) { // first posted key = TRACE_smpi_put_key(src, dst, tag, send); } else { @@ -170,12 +166,12 @@ void TRACE_smpi_init(aid_t pid, const std::string& calling_func) const simgrid::instr::Container* container = smpi_container(pid); papi_counter_t counters = smpi_process()->papi_counters(); - for (auto const& it : counters) { + for (auto const& [counter, _] : counters) { /** * Check whether this variable already exists or not. Otherwise, it will be created * multiple times but only the last one would be used... */ - container->get_type()->by_name_or_create(it.first, ""); + container->get_type()->by_name_or_create(counter, ""); } #endif }