Fix error

This commit is contained in:
Alexey Milovidov 2020-11-07 19:08:19 +03:00
parent c3973123bd
commit 8b8383d375

View File

@ -398,8 +398,7 @@ bool PerfEventsCounters::processThreadLocalChanges(const std::string & needed_ev
return true; return true;
} }
// Parse comma-separated list of event names. Empty means all available // Parse comma-separated list of event names. Empty means all available events.
// events.
std::vector<size_t> PerfEventsCounters::eventIndicesFromString(const std::string & events_list) std::vector<size_t> PerfEventsCounters::eventIndicesFromString(const std::string & events_list)
{ {
std::vector<size_t> result; std::vector<size_t> result;
@ -415,12 +414,10 @@ std::vector<size_t> PerfEventsCounters::eventIndicesFromString(const std::string
} }
std::istringstream iss(events_list); std::istringstream iss(events_list);
iss.exceptions(std::ios::failbit);
std::string event_name; std::string event_name;
while (std::getline(iss, event_name, ',')) while (std::getline(iss, event_name, ','))
{ {
// Allow spaces at the beginning of the token, so that you can write // Allow spaces at the beginning of the token, so that you can write 'a, b'.
// 'a, b'.
event_name.erase(0, event_name.find_first_not_of(' ')); event_name.erase(0, event_name.find_first_not_of(' '));
auto entry = event_name_to_index.find(event_name); auto entry = event_name_to_index.find(event_name);