mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-07 12:00:05 -05:00
Update _performanceRecord to store std::chrono::nanosecond duration instead of bare number
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/*****************************************************************************************
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
@@ -403,35 +403,35 @@ void PerformanceManager::storeScenePerformanceMeasurements(
|
||||
std::next(std::begin(entry.renderTime)),
|
||||
std::end(entry.renderTime)
|
||||
);
|
||||
entry.renderTime[PerformanceLayout::NumberValues - 1] = r.renderTime / micro;
|
||||
entry.renderTime[PerformanceLayout::NumberValues - 1] = std::chrono::duration_cast<std::chrono::microseconds>(r.renderTime).count();
|
||||
|
||||
std::rotate(
|
||||
std::begin(entry.updateTranslation),
|
||||
std::next(std::begin(entry.updateTranslation)),
|
||||
std::end(entry.updateTranslation)
|
||||
);
|
||||
entry.updateTranslation[PerformanceLayout::NumberValues - 1] = r.updateTimeTranslation / micro;
|
||||
entry.updateTranslation[PerformanceLayout::NumberValues - 1] = std::chrono::duration_cast<std::chrono::microseconds>(r.updateTimeTranslation).count();
|
||||
|
||||
std::rotate(
|
||||
std::begin(entry.updateRotation),
|
||||
std::next(std::begin(entry.updateRotation)),
|
||||
std::end(entry.updateRotation)
|
||||
);
|
||||
entry.updateRotation[PerformanceLayout::NumberValues - 1] = r.updateTimeRotation / micro;
|
||||
entry.updateRotation[PerformanceLayout::NumberValues - 1] = std::chrono::duration_cast<std::chrono::microseconds>(r.updateTimeRotation).count();
|
||||
|
||||
std::rotate(
|
||||
std::begin(entry.updateScaling),
|
||||
std::next(std::begin(entry.updateScaling)),
|
||||
std::end(entry.updateScaling)
|
||||
);
|
||||
entry.updateScaling[PerformanceLayout::NumberValues - 1] = r.updateTimeScaling / micro;
|
||||
entry.updateScaling[PerformanceLayout::NumberValues - 1] = std::chrono::duration_cast<std::chrono::microseconds>(r.updateTimeScaling).count();
|
||||
|
||||
std::rotate(
|
||||
std::begin(entry.updateRenderable),
|
||||
std::next(std::begin(entry.updateRenderable)),
|
||||
std::end(entry.updateRenderable)
|
||||
);
|
||||
entry.updateRenderable[PerformanceLayout::NumberValues - 1] = r.updateTimeRenderable / micro;
|
||||
entry.updateRenderable[PerformanceLayout::NumberValues - 1] = std::chrono::duration_cast<std::chrono::microseconds>(r.updateTimeRenderable).count();
|
||||
}
|
||||
_performanceMemory->releaseLock();
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*****************************************************************************************
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
@@ -169,7 +169,14 @@ SceneGraphNode::SceneGraphNode()
|
||||
: properties::PropertyOwner("")
|
||||
, _parent(nullptr)
|
||||
, _scene(nullptr)
|
||||
, _performanceRecord({0, 0, 0, 0, 0})
|
||||
, _performanceRecord({
|
||||
std::chrono::nanoseconds(0),
|
||||
std::chrono::nanoseconds(0),
|
||||
std::chrono::nanoseconds(0),
|
||||
std::chrono::nanoseconds(0),
|
||||
std::chrono::nanoseconds(0),
|
||||
std::chrono::nanoseconds(0)
|
||||
})
|
||||
, _renderable(nullptr)
|
||||
, _transform {
|
||||
std::make_unique<StaticTranslation>(),
|
||||
@@ -231,6 +238,11 @@ void SceneGraphNode::traversePostOrder(std::function<void(SceneGraphNode*)> fn)
|
||||
}
|
||||
|
||||
void SceneGraphNode::update(const UpdateData& data) {
|
||||
auto startUpdate = std::chrono::high_resolution_clock::now();
|
||||
auto endUpdate = startUpdate;
|
||||
if (data.doPerformanceMeasurement) {
|
||||
startUpdate = std::chrono::high_resolution_clock::now();
|
||||
}
|
||||
if (_transform.translation) {
|
||||
if (data.doPerformanceMeasurement) {
|
||||
glFinish();
|
||||
@@ -240,7 +252,7 @@ void SceneGraphNode::update(const UpdateData& data) {
|
||||
|
||||
glFinish();
|
||||
auto end = std::chrono::high_resolution_clock::now();
|
||||
_performanceRecord.updateTimeTranslation = (end - start).count();
|
||||
_performanceRecord.updateTimeTranslation = (end - start);
|
||||
}
|
||||
else {
|
||||
_transform.translation->update(data);
|
||||
@@ -256,7 +268,7 @@ void SceneGraphNode::update(const UpdateData& data) {
|
||||
|
||||
glFinish();
|
||||
auto end = std::chrono::high_resolution_clock::now();
|
||||
_performanceRecord.updateTimeRotation = (end - start).count();
|
||||
_performanceRecord.updateTimeRotation = (end - start);
|
||||
}
|
||||
else {
|
||||
_transform.rotation->update(data);
|
||||
@@ -272,7 +284,7 @@ void SceneGraphNode::update(const UpdateData& data) {
|
||||
|
||||
glFinish();
|
||||
auto end = std::chrono::high_resolution_clock::now();
|
||||
_performanceRecord.updateTimeScaling = (end - start).count();
|
||||
_performanceRecord.updateTimeScaling = (end - start);
|
||||
}
|
||||
else {
|
||||
_transform.scale->update(data);
|
||||
@@ -308,11 +320,16 @@ void SceneGraphNode::update(const UpdateData& data) {
|
||||
|
||||
glFinish();
|
||||
auto end = std::chrono::high_resolution_clock::now();
|
||||
_performanceRecord.updateTimeRenderable = (end - start).count();
|
||||
_performanceRecord.updateTimeRenderable = (end - start);
|
||||
}
|
||||
else
|
||||
_renderable->update(newUpdateData);
|
||||
}
|
||||
|
||||
if (data.doPerformanceMeasurement) {
|
||||
endUpdate = std::chrono::high_resolution_clock::now();
|
||||
_performanceRecord.totalTime += (endUpdate - startUpdate);
|
||||
}
|
||||
}
|
||||
|
||||
void SceneGraphNode::render(const RenderData& data, RendererTasks& tasks) {
|
||||
@@ -344,7 +361,8 @@ void SceneGraphNode::render(const RenderData& data, RendererTasks& tasks) {
|
||||
|
||||
glFinish();
|
||||
auto end = std::chrono::high_resolution_clock::now();
|
||||
_performanceRecord.renderTime = (end - start).count();
|
||||
_performanceRecord.renderTime = (end - start);
|
||||
_performanceRecord.totalTime += (end - start);
|
||||
}
|
||||
else
|
||||
_renderable->render(newData, tasks);
|
||||
|
||||
Reference in New Issue
Block a user