Disabled saving data and cleanning up.

This commit is contained in:
Jonathas Costa
2020-05-13 10:40:49 -04:00
parent f79ce8ebc2
commit c239a40836
7 changed files with 87 additions and 28 deletions

View File

@@ -185,6 +185,7 @@ documentation::Documentation DashboardItemFramerate::Documentation() {
}
//JCC: Temp property to save the fps to a file
#ifdef __PERFORMANCE_MEASUREMENTS__
DashboardItemFramerate::~DashboardItemFramerate()
{
_runThread = false; // bad, but is just for collecting the data
@@ -217,6 +218,7 @@ DashboardItemFramerate::~DashboardItemFramerate()
}
}
}
#endif
DashboardItemFramerate::DashboardItemFramerate(const ghoul::Dictionary& dictionary)
: DashboardItem(dictionary)
@@ -224,9 +226,10 @@ DashboardItemFramerate::DashboardItemFramerate(const ghoul::Dictionary& dictiona
, _fontSize(FontSizeInfo, DefaultFontSize, 6.f, 144.f, 1.f)
, _frametimeType(FrametimeInfo, properties::OptionProperty::DisplayType::Dropdown)
, _clearCache(ClearCacheInfo)
//JCC: Temp property to save the fps to a file
#ifdef __PERFORMANCE_MEASUREMENTS__
, _enableFPSRecording({"EnableFPSRecording", "Enable FPS Recording", ""}, false)
, _markTimeRecording({"MarkPointInterest", "Mark Point of Interest", ""}, false)
#endif
{
documentation::testSpecificationAndThrow(
Documentation(),
@@ -305,16 +308,19 @@ DashboardItemFramerate::DashboardItemFramerate(const ghoul::Dictionary& dictiona
addProperty(_clearCache);
//JCC: Temp property to save the fps to a file
#ifdef __PERFORMANCE_MEASUREMENTS__
addProperty(_enableFPSRecording);
addProperty(_markTimeRecording);
_runThread = true;
_dataCollectingThread = std::thread([this] { this->threadFunction(); });
_dataCollectingThread.detach();
#endif
_font = global::fontManager.font(_fontName, _fontSize);
}
//JCC: Temp property to save the fps to a file
#ifdef __PERFORMANCE_MEASUREMENTS__
void DashboardItemFramerate::threadFunction() {
while (_runThread)
{
@@ -330,6 +336,7 @@ void DashboardItemFramerate::threadFunction() {
}
}
}
#endif
void DashboardItemFramerate::render(glm::vec2& penPosition) {
if (_shouldClearCache) {

View File

@@ -33,8 +33,12 @@
#include <openspace/properties/scalar/boolproperty.h>
#include <openspace/properties/scalar/floatproperty.h>
//#define __PERFORMANCE_MEASUREMENTS__
#ifdef __PERFORMANCE_MEASUREMENTS__
//JCC: Temp property to save the fps to a file
#include <thread>
#endif
namespace ghoul { class Dictionary; }
namespace ghoul::fontrendering { class Font; }
@@ -62,10 +66,10 @@ public:
static documentation::Documentation Documentation();
//JCC: Temp property to save the fps to a file
#ifdef __PERFORMANCE_MEASUREMENTS__
~DashboardItemFramerate();
//JCC: Temp property to save the fps to a file
void threadFunction();
#endif
private:
properties::StringProperty _fontName;
@@ -74,6 +78,7 @@ private:
properties::TriggerProperty _clearCache;
//JCC: Temp property to save the fps to a file
#ifdef __PERFORMANCE_MEASUREMENTS__
properties::BoolProperty _enableFPSRecording;
properties::BoolProperty _markTimeRecording;
int _markRecordings[100] = { -1 };
@@ -83,6 +88,7 @@ private:
int _numberMarkedItems = 0;
std::thread _dataCollectingThread;
bool _runThread = false;
#endif
std::shared_ptr<ghoul::fontrendering::Font> _font;