mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-20 03:49:31 -06:00
Started implementing PerformanceHelper class
This commit is contained in:
@@ -25,9 +25,26 @@
|
||||
#ifndef __PERFORMANCEHELPER_H__
|
||||
#define __PERFORMANCEHELPER_H__
|
||||
|
||||
#include <chrono>
|
||||
#include <string>
|
||||
|
||||
namespace openspace {
|
||||
namespace performance {
|
||||
|
||||
class PerformanceManager;
|
||||
|
||||
class PerformanceHelper {
|
||||
public:
|
||||
PerformanceHelper(std::string identifier, performance::PerformanceManager* manager);
|
||||
~PerformanceHelper();
|
||||
|
||||
private:
|
||||
std::string _identifier;
|
||||
performance::PerformanceManager* _manager;
|
||||
|
||||
std::chrono::high_resolution_clock::time_point _startTime;
|
||||
};
|
||||
|
||||
} // namespace performance
|
||||
} // namespace openspace
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#ifndef __PERFORMANCEMANAGER_H__
|
||||
#define __PERFORMANCEMANAGER_H__
|
||||
|
||||
#include <chrono>
|
||||
#include <vector>
|
||||
|
||||
namespace ghoul {
|
||||
@@ -45,6 +46,8 @@ public:
|
||||
~PerformanceManager();
|
||||
|
||||
bool isMeasuringPerformance() const;
|
||||
|
||||
void storeIndividualPerformanceMeasurement(std::string identifier, long long us);
|
||||
void storeScenePerformanceMeasurements(const std::vector<SceneGraphNode*>& sceneNodes);
|
||||
|
||||
private:
|
||||
|
||||
@@ -24,9 +24,31 @@
|
||||
|
||||
#include <openspace/performance/performancehelper.h>
|
||||
|
||||
#include <openspace/performance/performancemanager.h>
|
||||
|
||||
#include <ghoul/opengl/ghoul_gl.h>
|
||||
|
||||
namespace openspace {
|
||||
namespace performance {
|
||||
|
||||
PerformanceHelper::PerformanceHelper(std::string identifier,
|
||||
performance::PerformanceManager* manager)
|
||||
: _identifier(std::move(identifier))
|
||||
, _manager(manager)
|
||||
{
|
||||
glFinish();
|
||||
|
||||
_startTime = std::chrono::high_resolution_clock::now();
|
||||
}
|
||||
|
||||
PerformanceHelper::~PerformanceHelper() {
|
||||
auto endTime = std::chrono::high_resolution_clock::now();
|
||||
auto duration = std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
endTime - _startTime).count();
|
||||
|
||||
_manager->storeIndividualPerformanceMeasurement(std::move(_identifier), duration);
|
||||
}
|
||||
|
||||
|
||||
} // namespace performance
|
||||
} // namespace openspace
|
||||
|
||||
@@ -54,6 +54,10 @@ bool PerformanceManager::isMeasuringPerformance() const {
|
||||
return _doPerformanceMeasurements;
|
||||
}
|
||||
|
||||
void PerformanceManager::storeIndividualPerformanceMeasurement(std::string identifier, long long us) {
|
||||
|
||||
}
|
||||
|
||||
void PerformanceManager::storeScenePerformanceMeasurements(
|
||||
const std::vector<SceneGraphNode*>& sceneNodes)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user