-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCubeRegionInfo.cpp
44 lines (36 loc) · 1.22 KB
/
CubeRegionInfo.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "CubeRegionInfo.h"
#include <iostream>
using namespace regioninfo;
void RegionInfoManager::addRegionInfo(std::string regionIdentifier,
RegionInfo reginfo) {
regInfos[regionIdentifier] = reginfo;
}
std::set<std::string> RegionInfoManager::getAllFilenames() const {
std::set<std::string> r;
for (const auto &p : regInfos) {
r.insert(p.second.filename);
}
return r;
}
std::set<std::string> RegionInfoManager::getAllFunctionNames() const {
std::set<std::string> r;
for (const auto &p : regInfos) {
r.insert(p.second.regionName);
}
return r;
}
void RegionInfoManager::addNumberOfCalls(std::string fName,
unsigned long long numberOfCalls) {
regInfos[fName].numberOfCalls += numberOfCalls;
}
void RegionInfoManager::addRuntimeData(std::string fName,
double timeInSeconds) {
regInfos[fName].runtimeInSeconds += timeInSeconds;
}
void RegionInfoManager::printAll() const {
for (const auto &ri : regInfos) {
std::cout << ri.first << " " << ri.second.filename << "\n"
<< ri.second.runtimeInSeconds << " at " << ri.second.numberOfCalls
<< " calls" << std::endl;
}
}