mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-18 17:59:51 -06:00
Add PerformanceMeasurement logging variables to ConfigurationManager. Read from logDir and file prefix from config file in PerformanceManager.
This commit is contained in:
@@ -78,12 +78,16 @@ public:
|
||||
static const std::string KeySettingsScript;
|
||||
/// The key that stores the settings for determining log-related settings
|
||||
static const std::string KeyLogging;
|
||||
/// The key that stores the directory for Logging
|
||||
static const std::string PartLogDir;
|
||||
/// The key that stores the desired LogLevel for the whole application
|
||||
/// \sa ghoul::logging::LogManager
|
||||
static const std::string PartLogLevel;
|
||||
/// The key that stores whether the log should be immediately flushed after a n
|
||||
/// \sa ghoul::logging::LogManager
|
||||
static const std::string PartImmediateFlush;
|
||||
/// The key for prefixing PerformanceMeasurement logfiles
|
||||
static const std::string PartLogPerformancePrefix;
|
||||
/// The key that stores a subdirectory with a description for additional
|
||||
/// ghoul::logging::Log%s to be created
|
||||
/// \sa LogFactory
|
||||
|
||||
@@ -59,6 +59,12 @@ public:
|
||||
void storeScenePerformanceMeasurements(const std::vector<SceneGraphNode*>& sceneNodes);
|
||||
|
||||
void outputLogs();
|
||||
|
||||
void logDir(std::string dir);
|
||||
std::string logDir();
|
||||
void prefix(std::string prefix);
|
||||
std::string prefix();
|
||||
|
||||
void enableLogging();
|
||||
void disableLogging();
|
||||
void toggleLogging();
|
||||
@@ -69,6 +75,9 @@ public:
|
||||
private:
|
||||
bool _doPerformanceMeasurements;
|
||||
bool _loggingEnabled;
|
||||
|
||||
std::string _logDir;
|
||||
std::string _prefix;
|
||||
|
||||
std::map<std::string, size_t> individualPerformanceLocations;
|
||||
|
||||
|
||||
@@ -62,8 +62,11 @@ const string ConfigurationManager::KeyConfigScene = "Scene";
|
||||
const string ConfigurationManager::KeyConfigTask = "Task";
|
||||
|
||||
const string ConfigurationManager::KeyLogging = "Logging";
|
||||
const string ConfigurationManager::PartLogDir = "LogDir";
|
||||
const string ConfigurationManager::PartLogLevel = "LogLevel";
|
||||
const string ConfigurationManager::PartImmediateFlush = "ImmediateFlush";
|
||||
const string ConfigurationManager::PartLogPerformancePrefix = "PerformancePrefix";
|
||||
|
||||
const string ConfigurationManager::PartLogs = "Logs";
|
||||
const string ConfigurationManager::PartAppend = "Append";
|
||||
const string ConfigurationManager::PartCapabilitiesVerbosity = "CapabilitiesVerbosity";
|
||||
|
||||
@@ -86,6 +86,18 @@ documentation::Documentation ConfigurationManager::Documentation() {
|
||||
{
|
||||
ConfigurationManager::KeyLogging,
|
||||
new TableVerifier({
|
||||
{
|
||||
ConfigurationManager::PartLogDir,
|
||||
new StringVerifier,
|
||||
"The directory for logs",
|
||||
Optional::Yes
|
||||
},
|
||||
{
|
||||
ConfigurationManager::PartLogPerformancePrefix,
|
||||
new StringVerifier,
|
||||
"A string to prefix PerformanceMeasurement logfiles",
|
||||
Optional::Yes
|
||||
},
|
||||
{
|
||||
ConfigurationManager::PartLogLevel,
|
||||
new StringInListVerifier(
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
#include <ghoul/misc/sharedmemory.h>
|
||||
#include <ghoul/misc/onscopeexit.h>
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
@@ -132,6 +133,8 @@ PerformanceManager::PerformanceManager()
|
||||
: _performanceMemory(nullptr)
|
||||
, _tick(0)
|
||||
, _loggingEnabled(false)
|
||||
, _logDir(absPath("${BASE_PATH}"))
|
||||
, _prefix("PM-")
|
||||
{
|
||||
using ghoul::SharedMemory;
|
||||
PerformanceManager::createGlobalSharedMemory();
|
||||
@@ -207,14 +210,31 @@ void PerformanceManager::outputLogs() {
|
||||
PerformanceLayout* layout = performanceData();
|
||||
|
||||
for (size_t i = 0; i < layout->nFunctionEntries; ++i) {
|
||||
LINFO("Log:" << i << " Node: " << layout->sceneGraphEntries[i].name << " " << layout->functionEntries[i].time[0]);
|
||||
LINFO("LogA:" << i << " Node: " << layout->sceneGraphEntries[i].name << " " << layout->functionEntries[i].time[0]);
|
||||
}
|
||||
|
||||
LINFO("Log Dir: " << absPath(_logDir + "/" + _prefix));
|
||||
for (size_t i = 0; i < layout->nScaleGraphEntries; ++i) {
|
||||
LINFO("Log:" << i << " Node: " << layout->sceneGraphEntries[i].name << " " << layout->sceneGraphEntries[i].renderTime[0];);
|
||||
LINFO("LogB:" << i << " Node: " << layout->sceneGraphEntries[i].name << " " << layout->sceneGraphEntries[i].renderTime[0];);
|
||||
}
|
||||
}
|
||||
|
||||
void PerformanceManager::logDir(std::string dir) {
|
||||
_logDir = absPath(dir);
|
||||
}
|
||||
|
||||
std::string PerformanceManager::logDir() {
|
||||
return _logDir;
|
||||
}
|
||||
|
||||
void PerformanceManager::prefix(std::string prefix) {
|
||||
_prefix = prefix;
|
||||
}
|
||||
|
||||
std::string PerformanceManager::prefix() {
|
||||
return _prefix;
|
||||
}
|
||||
|
||||
void PerformanceManager::enableLogging() {
|
||||
setLogging(true);
|
||||
}
|
||||
|
||||
@@ -134,6 +134,14 @@ RenderEngine::RenderEngine()
|
||||
if (_performanceMeasurements) {
|
||||
if (!_performanceManager) {
|
||||
_performanceManager = std::make_unique<performance::PerformanceManager>();
|
||||
const std::string KeyLogDir = ConfigurationManager::KeyLogging + "." + ConfigurationManager::PartLogDir;
|
||||
const std::string KeyPrefix = ConfigurationManager::KeyLogging + "." + ConfigurationManager::PartLogPerformancePrefix;
|
||||
if (OsEng.configurationManager().hasKeyAndValue<std::string>(KeyLogDir)) {
|
||||
_performanceManager->logDir(OsEng.configurationManager().value<std::string>(KeyLogDir));
|
||||
}
|
||||
if (OsEng.configurationManager().hasKeyAndValue<std::string>(KeyPrefix)) {
|
||||
_performanceManager->prefix(OsEng.configurationManager().value<std::string>(KeyPrefix));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user