mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-08 12:30:00 -05:00
Merge branch 'master' into feature/memory-allocations
# Conflicts: # include/openspace/scene/scenegraphnode.h # modules/imgui/include/gui.h
This commit is contained in:
@@ -60,7 +60,6 @@ namespace interaction {
|
||||
class SessionRecording;
|
||||
class ShortcutManager;
|
||||
} // namespace interaction
|
||||
namespace performance { class PerformanceManager; }
|
||||
namespace properties { class PropertyOwner; }
|
||||
namespace scripting {
|
||||
class ScriptEngine;
|
||||
@@ -98,7 +97,6 @@ interaction::KeybindingManager& gKeybindingManager();
|
||||
interaction::NavigationHandler& gNavigationHandler();
|
||||
interaction::SessionRecording& gSessionRecording();
|
||||
interaction::ShortcutManager& gShortcutManager();
|
||||
performance::PerformanceManager& gPerformanceManager();
|
||||
properties::PropertyOwner& gRootPropertyOwner();
|
||||
properties::PropertyOwner& gScreenSpaceRootPropertyOwner();
|
||||
scripting::ScriptEngine& gScriptEngine();
|
||||
@@ -137,8 +135,6 @@ static interaction::KeybindingManager& keybindingManager = detail::gKeybindingMa
|
||||
static interaction::NavigationHandler& navigationHandler = detail::gNavigationHandler();
|
||||
static interaction::SessionRecording& sessionRecording = detail::gSessionRecording();
|
||||
static interaction::ShortcutManager& shortcutManager = detail::gShortcutManager();
|
||||
static performance::PerformanceManager& performanceManager =
|
||||
detail::gPerformanceManager();
|
||||
static properties::PropertyOwner& rootPropertyOwner = detail::gRootPropertyOwner();
|
||||
static properties::PropertyOwner& screenSpaceRootPropertyOwner =
|
||||
detail::gScreenSpaceRootPropertyOwner();
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2020 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_CORE___PERFORMANCELAYOUT___H__
|
||||
#define __OPENSPACE_CORE___PERFORMANCELAYOUT___H__
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace openspace::performance {
|
||||
|
||||
struct PerformanceLayout {
|
||||
constexpr static const int8_t Version = 0;
|
||||
constexpr static const int LengthName = 256;
|
||||
constexpr static const int NumberValues = 256;
|
||||
constexpr static const int MaxValues = 1024;
|
||||
|
||||
PerformanceLayout();
|
||||
|
||||
struct SceneGraphPerformanceLayout {
|
||||
char name[LengthName];
|
||||
float renderTime[NumberValues];
|
||||
float updateRenderable[NumberValues];
|
||||
float updateTranslation[NumberValues];
|
||||
float updateRotation[NumberValues];
|
||||
float updateScaling[NumberValues];
|
||||
};
|
||||
SceneGraphPerformanceLayout sceneGraphEntries[MaxValues] = {};
|
||||
int16_t nScaleGraphEntries = 0;
|
||||
|
||||
struct FunctionPerformanceLayout {
|
||||
char name[LengthName];
|
||||
float time[NumberValues];
|
||||
};
|
||||
FunctionPerformanceLayout functionEntries[MaxValues] = {};
|
||||
int16_t nFunctionEntries = 0;
|
||||
};
|
||||
|
||||
} // namespace openspace::performance
|
||||
|
||||
#endif // __OPENSPACE_CORE___PERFORMANCELAYOUT___H__
|
||||
@@ -1,94 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2020 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_CORE___PERFORMANCEMANAGER___H__
|
||||
#define __OPENSPACE_CORE___PERFORMANCEMANAGER___H__
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace ghoul { class SharedMemory; }
|
||||
namespace openspace { class SceneGraphNode; }
|
||||
|
||||
namespace openspace::performance {
|
||||
|
||||
struct PerformanceLayout;
|
||||
|
||||
class PerformanceManager {
|
||||
public:
|
||||
static void CreateGlobalSharedMemory();
|
||||
static void DestroyGlobalSharedMemory();
|
||||
|
||||
void setEnabled(bool enabled);
|
||||
bool isEnabled() const;
|
||||
|
||||
void resetPerformanceMeasurements();
|
||||
|
||||
void storeIndividualPerformanceMeasurement(const std::string& identifier,
|
||||
long long microseconds);
|
||||
void storeScenePerformanceMeasurements(
|
||||
const std::vector<SceneGraphNode*>& sceneNodes);
|
||||
|
||||
void outputLogs();
|
||||
|
||||
void writeData(std::ofstream& out, const std::vector<float>& data);
|
||||
|
||||
std::string formatLogName(std::string nodeName);
|
||||
|
||||
void logDir(std::string dir);
|
||||
const std::string& logDir() const;
|
||||
void prefix(std::string prefix);
|
||||
const std::string& prefix() const;
|
||||
|
||||
void enableLogging();
|
||||
void disableLogging();
|
||||
void toggleLogging();
|
||||
void setLogging(bool enabled);
|
||||
bool loggingEnabled() const;
|
||||
|
||||
PerformanceLayout* performanceData();
|
||||
|
||||
private:
|
||||
bool _performanceMeasurementEnabled = false;
|
||||
bool _loggingEnabled = false;
|
||||
|
||||
std::string _logDir;
|
||||
std::string _prefix;
|
||||
std::string _ext = "log";
|
||||
|
||||
std::map<std::string, size_t> individualPerformanceLocations;
|
||||
|
||||
std::unique_ptr<ghoul::SharedMemory> _performanceMemory;
|
||||
|
||||
size_t _currentTick = 0;
|
||||
|
||||
void tick();
|
||||
bool createLogDir();
|
||||
};
|
||||
|
||||
} // namespace openspace::performance
|
||||
|
||||
#endif // __OPENSPACE_CORE___PERFORMANCEMANAGER___H__
|
||||
@@ -1,55 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2020 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_CORE___PERFORMANCEMEASUREMENT___H__
|
||||
#define __OPENSPACE_CORE___PERFORMANCEMEASUREMENT___H__
|
||||
|
||||
#include <chrono>
|
||||
#include <string>
|
||||
|
||||
namespace openspace::performance {
|
||||
|
||||
class PerformanceManager;
|
||||
|
||||
class PerformanceMeasurement {
|
||||
public:
|
||||
PerformanceMeasurement(std::string identifier);
|
||||
~PerformanceMeasurement();
|
||||
|
||||
private:
|
||||
std::string _identifier;
|
||||
std::chrono::high_resolution_clock::time_point _startTime;
|
||||
};
|
||||
|
||||
#define __MERGE_PerfMeasure(a,b) a##b
|
||||
#define __LABEL_PerfMeasure(a) __MERGE_PerfMeasure(unique_name_, a)
|
||||
|
||||
/// Declare a new variable for measuring the performance of the current block
|
||||
#define PerfMeasure(name) \
|
||||
auto __LABEL_PerfMeasure(__LINE__) = \
|
||||
openspace::performance::PerformanceMeasurement((name))
|
||||
|
||||
} // namespace openspace::performance
|
||||
|
||||
#endif // __OPENSPACE_CORE___PERFORMANCEMEASUREMENT___H__
|
||||
@@ -179,8 +179,6 @@ private:
|
||||
Camera* _camera = nullptr;
|
||||
Scene* _scene = nullptr;
|
||||
|
||||
properties::BoolProperty _doPerformanceMeasurements;
|
||||
|
||||
std::unique_ptr<Renderer> _renderer;
|
||||
RendererImplementation _rendererImplementation = RendererImplementation::Invalid;
|
||||
ghoul::Dictionary _rendererData;
|
||||
|
||||
@@ -72,14 +72,6 @@ public:
|
||||
|
||||
BooleanType(UpdateScene);
|
||||
|
||||
struct PerformanceRecord {
|
||||
long long renderTime; // time in ns
|
||||
long long updateTimeRenderable; // time in ns
|
||||
long long updateTimeTranslation; // time in ns
|
||||
long long updateTimeRotation; // time in ns
|
||||
long long updateTimeScaling; // time in ns
|
||||
};
|
||||
|
||||
static constexpr const char* RootNodeIdentifier = "Root";
|
||||
static constexpr const char* KeyIdentifier = "Identifier";
|
||||
static constexpr const char* KeyParentName = "Parent";
|
||||
@@ -139,8 +131,6 @@ public:
|
||||
|
||||
SceneGraphNode* childNode(const std::string& identifier);
|
||||
|
||||
const PerformanceRecord& performanceRecord() const;
|
||||
|
||||
const Renderable* renderable() const;
|
||||
Renderable* renderable();
|
||||
|
||||
@@ -166,8 +156,6 @@ private:
|
||||
// might be a node that is not very interesting (for example barycenters)
|
||||
properties::BoolProperty _guiHidden;
|
||||
|
||||
PerformanceRecord _performanceRecord = { 0, 0, 0, 0, 0 };
|
||||
|
||||
ghoul::mm_unique_ptr<Renderable> _renderable;
|
||||
|
||||
properties::StringProperty _guiPath;
|
||||
|
||||
@@ -45,13 +45,11 @@ struct UpdateData {
|
||||
TransformData modelTransform;
|
||||
const Time time;
|
||||
const Time previousFrameTime;
|
||||
const bool doPerformanceMeasurement;
|
||||
};
|
||||
|
||||
struct RenderData {
|
||||
const Camera& camera;
|
||||
const Time time;
|
||||
bool doPerformanceMeasurement = false;
|
||||
int renderBinMask = -1;
|
||||
TransformData modelTransform;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user