Create clearLogs()

This commit is contained in:
Matthew Territo
2017-07-19 19:39:30 -06:00
parent 82454c02b8
commit 034bfda71d
2 changed files with 19 additions and 1 deletions

View File

@@ -169,6 +169,9 @@ PerformanceManager::PerformanceManager()
_performanceMemory = std::make_unique<ghoul::SharedMemory>(localName);
// Using the placement-new to create a PerformanceLayout in the shared memory
new (_performanceMemory->memory()) PerformanceLayout;
// Create or clear the logs
clearLogs();
}
PerformanceManager::~PerformanceManager() {
@@ -449,5 +452,18 @@ void PerformanceManager::storeScenePerformanceMeasurements(
tick();
}
void PerformanceManager::clearLogs() {
const PerformanceLayout* layout = performanceData();
for (size_t n = 0; n < layout->nFunctionEntries; n++) {
const std::string filename = formatLogName(layout->functionEntries[n].name);
std::ofstream out = std::ofstream(absPath(filename), std::ofstream::out | std::ofstream::trunc);
}
for (size_t n = 0; n < layout->nScaleGraphEntries; n++) {
const std::string filename = formatLogName(layout->sceneGraphEntries[n].name);
std::ofstream out = std::ofstream(absPath(filename), std::ofstream::out | std::ofstream::trunc);
}
}
} // namespace performance
} // namespace openspace