aboutsummaryrefslogtreecommitdiff
path: root/dep/g3dlite/include/G3D/Stopwatch.h
diff options
context:
space:
mode:
Diffstat (limited to 'dep/g3dlite/include/G3D/Stopwatch.h')
-rw-r--r--dep/g3dlite/include/G3D/Stopwatch.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/dep/g3dlite/include/G3D/Stopwatch.h b/dep/g3dlite/include/G3D/Stopwatch.h
index 3f2aa9c8d86..48c223b5ba5 100644
--- a/dep/g3dlite/include/G3D/Stopwatch.h
+++ b/dep/g3dlite/include/G3D/Stopwatch.h
@@ -46,6 +46,9 @@ class Stopwatch {
private:
std::string myName;
+
+ bool m_enabled;
+
double startTime;
std::string prevMark;
double prevTime;
@@ -85,6 +88,15 @@ public:
Stopwatch(const std::string& name = "Stopwatch");
+ void setEnabled(bool e) {
+ m_enabled = e;
+ }
+
+ /** A stopwatch only prints output when enabled */
+ bool enabled() const {
+ return m_enabled;
+ }
+
/** Returns the number of times that tick was called per wall-clock second;
e.g. frames-per-second. */
double FPS() const {
@@ -130,7 +142,10 @@ public:
void reset();
/** Call after an operation has completed, with the name of the operation, to
- print a debug message listing the time since the previous after() call. */
+ print a debug message listing the time since the previous after() call.
+
+ Does nothing if the stopwatch is disabled.
+ */
void after(const std::string& s = "");
};