Update counter maps sanely

operator[] default-constructs the map value if no value exists
for that key. Default-construction of int yields a zero. So all
the manual faffing around is just unnecessary.


[ROCm/hip commit: d8beee8918]
This commit is contained in:
Chris Kitching
2017-10-25 19:42:46 +01:00
rodzic 51df5b20c9
commit a3c1d30745
@@ -181,18 +181,9 @@ protected:
map = cuda2hipUnconverted;
mapTotal = cuda2hipUnconvertedTotal;
}
auto found = map.find(cudaName);
if (found == map.end()) {
map.insert(std::pair<std::string, uint64_t>(cudaName, 1));
} else {
found->second++;
}
auto foundT = mapTotal.find(cudaName);
if (foundT == mapTotal.end()) {
mapTotal.insert(std::pair<std::string, uint64_t>(cudaName, 1));
} else {
foundT->second++;
}
map[cudaName]++;
mapTotal[cudaName]++;
}
virtual void updateCounters(const hipCounter &counter, const std::string &cudaName) {