mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 14:03:55 +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() {
|
||||
PerformanceWarning warn(true, "trueColorize()",true);
|
||||
_nodeCount = 0;
|
||||
_tree->recurseTreeWithOperation(trueColorizeOperation);
|
||||
printLog("setting true color for %d nodes\n", _nodeCount);
|
||||
|
|
|
@ -108,15 +108,16 @@ int PerfStat::DumpStats(char** array) {
|
|||
PerformanceWarning::~PerformanceWarning() {
|
||||
double end = usecTimestampNow();
|
||||
double elapsedmsec = (end - _start) / 1000.0;
|
||||
if (_renderWarningsOn && elapsedmsec > 1) {
|
||||
if ((_alwaysDisplay || _renderWarningsOn) && elapsedmsec > 1) {
|
||||
if (elapsedmsec > 1000) {
|
||||
double elapsedsec = (end - _start) / 1000000.0;
|
||||
printLog("WARNING! %s took %lf seconds\n", _message, elapsedsec);
|
||||
} else {
|
||||
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;
|
||||
const char* _message;
|
||||
bool _renderWarningsOn;
|
||||
bool _alwaysDisplay;
|
||||
public:
|
||||
PerformanceWarning(bool renderWarnings, const char* message) :
|
||||
PerformanceWarning(bool renderWarnings, const char* message, bool alwaysDisplay = false) :
|
||||
_start(usecTimestampNow()),
|
||||
_message(message),
|
||||
_renderWarningsOn(renderWarnings) { };
|
||||
_renderWarningsOn(renderWarnings),
|
||||
_alwaysDisplay(alwaysDisplay) { };
|
||||
|
||||
~PerformanceWarning();
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue