Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Riley authored and Dan Riley committed Jan 9, 2023
1 parent bb07499 commit 3df8ae5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions FWCore/Services/plugins/CPU.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// CPU.cc: v 1.0 2009/01/08 11:31:07

#include "FWCore/MessageLogger/interface/JobReport.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ServiceRegistry/interface/ActivityRegistry.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
Expand Down Expand Up @@ -84,8 +85,8 @@ namespace edm {
}

void compressWhitespace(std::string &s) {
auto last = std::unique(
s.begin(), s.end(), [](unsigned char a, unsigned char b) -> bool { return std::isspace(a) && a == b; });
auto last =
std::unique(s.begin(), s.end(), [](const auto a, const auto b) { return std::isspace(a) && a == b; });
s.erase(last, s.end());
}

Expand Down Expand Up @@ -289,7 +290,11 @@ namespace edm {
unsigned coreCount = 0;
for (const auto &entry : info) {
if (entry.first == "cpu MHz") {
averageCoreSpeed += std::stod(entry.second);
try {
averageCoreSpeed += std::stod(entry.second);
} catch (const std::logic_error &e) {
LogWarning("CPU::getAverageSpeed") << "stod(" << entry.second << ") conversion error: " << e.what();
}
coreCount++;
}
}
Expand Down

0 comments on commit 3df8ae5

Please sign in to comment.