added alwaysDisplay mode to PerformanceWarnings class

This commit is contained in:
ZappoMan 2013-05-08 12:01:55 -07:00
parent 2bae64ad87
commit 7a5ce57b4e
3 changed files with 8 additions and 4 deletions

View file

@ -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);

View file

@ -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);
}
};

View file

@ -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();
};