mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-23 12:39:24 -05:00
Rename PerformanceHelper to PerformanceMeasurement
Add performance measurements to FramebufferRenderer
This commit is contained in:
+7
-7
@@ -22,8 +22,8 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __PERFORMANCEHELPER_H__
|
||||
#define __PERFORMANCEHELPER_H__
|
||||
#ifndef __PERFORMANCEMEASUREMENT_H__
|
||||
#define __PERFORMANCEMEASUREMENT_H__
|
||||
|
||||
#include <chrono>
|
||||
#include <string>
|
||||
@@ -33,10 +33,10 @@ namespace performance {
|
||||
|
||||
class PerformanceManager;
|
||||
|
||||
class PerformanceHelper {
|
||||
class PerformanceMeasurement {
|
||||
public:
|
||||
PerformanceHelper(std::string identifier, performance::PerformanceManager* manager);
|
||||
~PerformanceHelper();
|
||||
PerformanceMeasurement(std::string identifier, performance::PerformanceManager* manager);
|
||||
~PerformanceMeasurement();
|
||||
|
||||
private:
|
||||
std::string _identifier;
|
||||
@@ -49,9 +49,9 @@ private:
|
||||
#define __LABEL(a) __MERGE(unique_name_, a)
|
||||
|
||||
/// Declare a new variable for measuring the performance of the current block
|
||||
#define PerformanceMeasurement(name) auto __LABEL(__LINE__) = openspace::performance::PerformanceHelper((name), OsEng.renderEngine().performanceManager())
|
||||
#define PerfMeasure(name) auto __LABEL(__LINE__) = openspace::performance::PerformanceMeasurement((name), OsEng.renderEngine().performanceManager())
|
||||
|
||||
} // namespace performance
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __PERFORMANCEHELPER_H__
|
||||
#endif // __PERFORMANCEMEASUREMENTHELPER_H__
|
||||
+2
-2
@@ -50,7 +50,7 @@ set(OPENSPACE_SOURCE
|
||||
${OPENSPACE_BASE_DIR}/src/network/networkengine.cpp
|
||||
${OPENSPACE_BASE_DIR}/src/network/parallelconnection.cpp
|
||||
${OPENSPACE_BASE_DIR}/src/network/parallelconnection_lua.inl
|
||||
${OPENSPACE_BASE_DIR}/src/performance/performancehelper.cpp
|
||||
${OPENSPACE_BASE_DIR}/src/performance/performancemeasurement.cpp
|
||||
${OPENSPACE_BASE_DIR}/src/performance/performancelayout.cpp
|
||||
${OPENSPACE_BASE_DIR}/src/performance/performancemanager.cpp
|
||||
${OPENSPACE_BASE_DIR}/src/properties/matrixproperty.cpp
|
||||
@@ -122,7 +122,7 @@ set(OPENSPACE_HEADER
|
||||
${OPENSPACE_BASE_DIR}/include/openspace/network/networkengine.h
|
||||
${OPENSPACE_BASE_DIR}/include/openspace/network/parallelconnection.h
|
||||
${OPENSPACE_BASE_DIR}/include/openspace/network/messagestructures.h
|
||||
${OPENSPACE_BASE_DIR}/include/openspace/performance/performancehelper.h
|
||||
${OPENSPACE_BASE_DIR}/include/openspace/performance/performancemeasurement.h
|
||||
${OPENSPACE_BASE_DIR}/include/openspace/performance/performancelayout.h
|
||||
${OPENSPACE_BASE_DIR}/include/openspace/performance/performancemanager.h
|
||||
${OPENSPACE_BASE_DIR}/include/openspace/properties/matrixproperty.h
|
||||
|
||||
@@ -22,16 +22,18 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <openspace/performance/performancehelper.h>
|
||||
#include <openspace/performance/performancemeasurement.h>
|
||||
|
||||
#include <openspace/performance/performancemanager.h>
|
||||
|
||||
#include <ghoul/opengl/ghoul_gl.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace openspace {
|
||||
namespace performance {
|
||||
|
||||
PerformanceHelper::PerformanceHelper(std::string identifier,
|
||||
PerformanceMeasurement::PerformanceMeasurement(std::string identifier,
|
||||
performance::PerformanceManager* manager)
|
||||
: _identifier(std::move(identifier))
|
||||
, _manager(manager)
|
||||
@@ -43,7 +45,7 @@ PerformanceHelper::PerformanceHelper(std::string identifier,
|
||||
}
|
||||
}
|
||||
|
||||
PerformanceHelper::~PerformanceHelper() {
|
||||
PerformanceMeasurement::~PerformanceMeasurement() {
|
||||
auto endTime = std::chrono::high_resolution_clock::now();
|
||||
auto duration = std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
endTime - _startTime).count();
|
||||
@@ -33,6 +33,8 @@
|
||||
#include <openspace/rendering/volumeraycaster.h>
|
||||
#include <openspace/rendering/raycastermanager.h>
|
||||
|
||||
#include <openspace/performance/performancemeasurement.h>
|
||||
|
||||
#include <ghoul/opengl/ghoul_gl.h>
|
||||
#include <ghoul/opengl/textureunit.h>
|
||||
#include <vector>
|
||||
@@ -157,6 +159,8 @@ void FramebufferRenderer::raycastersChanged(VolumeRaycaster& raycaster, bool att
|
||||
}
|
||||
|
||||
void FramebufferRenderer::update() {
|
||||
PerfMeasure("FramebufferRenderer::update");
|
||||
|
||||
if (_dirtyResolution) {
|
||||
updateResolution();
|
||||
}
|
||||
@@ -197,6 +201,8 @@ void FramebufferRenderer::update() {
|
||||
}
|
||||
|
||||
void FramebufferRenderer::updateResolution() {
|
||||
PerfMeasure("FramebufferRenderer::updateResolution");
|
||||
|
||||
int nSamples = OsEng.windowWrapper().currentNumberOfAaSamples();
|
||||
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, _mainColorTexture);
|
||||
|
||||
@@ -252,6 +258,8 @@ void FramebufferRenderer::updateResolution() {
|
||||
}
|
||||
|
||||
void FramebufferRenderer::updateRaycastData() {
|
||||
PerfMeasure("FramebufferRenderer::updateRaycastData");
|
||||
|
||||
_raycastData.clear();
|
||||
_exitPrograms.clear();
|
||||
_raycastPrograms.clear();
|
||||
@@ -296,6 +304,8 @@ void FramebufferRenderer::updateRaycastData() {
|
||||
}
|
||||
|
||||
void FramebufferRenderer::render(float blackoutFactor, bool doPerformanceMeasurements) {
|
||||
PerfMeasure("FramebufferRenderer::render");
|
||||
|
||||
if (!_scene)
|
||||
return;
|
||||
if (!_camera)
|
||||
@@ -398,6 +408,8 @@ void FramebufferRenderer::setResolution(glm::ivec2 res) {
|
||||
}
|
||||
|
||||
void FramebufferRenderer::updateRendererData() {
|
||||
PerfMeasure("FramebufferRenderer::updateRendererData");
|
||||
|
||||
ghoul::Dictionary dict;
|
||||
dict.setValue("fragmentRendererPath", std::string(RenderFragmentShaderPath));
|
||||
dict.setValue("postFragmentRendererPath", std::string(PostRenderFragmentShaderPath));
|
||||
|
||||
@@ -223,7 +223,6 @@ bool RenderEngine::initializeGL() {
|
||||
// development
|
||||
OsEng.windowWrapper().setNearFarClippingPlane(0.001f, 1000.f);
|
||||
|
||||
|
||||
try {
|
||||
const float fontSizeTime = 15.f;
|
||||
_fontDate = OsEng.fontManager().font(KeyFontMono, fontSizeTime);
|
||||
|
||||
Reference in New Issue
Block a user