mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 00:17:25 +02:00
added alwaysDisplay mode to PerformanceWarnings class
This commit is contained in:
parent
2bae64ad87
commit
7a5ce57b4e
3 changed files with 8 additions and 4 deletions
|
@ -503,6 +503,7 @@ bool VoxelSystem::trueColorizeOperation(VoxelNode* node, void* extraData) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void VoxelSystem::trueColorize() {
|
void VoxelSystem::trueColorize() {
|
||||||
|
PerformanceWarning warn(true, "trueColorize()",true);
|
||||||
_nodeCount = 0;
|
_nodeCount = 0;
|
||||||
_tree->recurseTreeWithOperation(trueColorizeOperation);
|
_tree->recurseTreeWithOperation(trueColorizeOperation);
|
||||||
printLog("setting true color for %d nodes\n", _nodeCount);
|
printLog("setting true color for %d nodes\n", _nodeCount);
|
||||||
|
|
|
@ -108,15 +108,16 @@ int PerfStat::DumpStats(char** array) {
|
||||||
PerformanceWarning::~PerformanceWarning() {
|
PerformanceWarning::~PerformanceWarning() {
|
||||||
double end = usecTimestampNow();
|
double end = usecTimestampNow();
|
||||||
double elapsedmsec = (end - _start) / 1000.0;
|
double elapsedmsec = (end - _start) / 1000.0;
|
||||||
if (_renderWarningsOn && elapsedmsec > 1) {
|
if ((_alwaysDisplay || _renderWarningsOn) && elapsedmsec > 1) {
|
||||||
if (elapsedmsec > 1000) {
|
if (elapsedmsec > 1000) {
|
||||||
double elapsedsec = (end - _start) / 1000000.0;
|
double elapsedsec = (end - _start) / 1000000.0;
|
||||||
printLog("WARNING! %s took %lf seconds\n", _message, elapsedsec);
|
printLog("WARNING! %s took %lf seconds\n", _message, elapsedsec);
|
||||||
} else {
|
} else {
|
||||||
printLog("WARNING! %s took %lf milliseconds\n", _message, elapsedmsec);
|
printLog("WARNING! %s took %lf milliseconds\n", _message, elapsedmsec);
|
||||||
}
|
}
|
||||||
|
} else if (_alwaysDisplay) {
|
||||||
|
printLog("WARNING! %s took %lf milliseconds\n", _message, elapsedmsec);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -87,11 +87,13 @@ private:
|
||||||
double _start;
|
double _start;
|
||||||
const char* _message;
|
const char* _message;
|
||||||
bool _renderWarningsOn;
|
bool _renderWarningsOn;
|
||||||
|
bool _alwaysDisplay;
|
||||||
public:
|
public:
|
||||||
PerformanceWarning(bool renderWarnings, const char* message) :
|
PerformanceWarning(bool renderWarnings, const char* message, bool alwaysDisplay = false) :
|
||||||
_start(usecTimestampNow()),
|
_start(usecTimestampNow()),
|
||||||
_message(message),
|
_message(message),
|
||||||
_renderWarningsOn(renderWarnings) { };
|
_renderWarningsOn(renderWarnings),
|
||||||
|
_alwaysDisplay(alwaysDisplay) { };
|
||||||
|
|
||||||
~PerformanceWarning();
|
~PerformanceWarning();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue