summaryrefslogtreecommitdiff
path: root/src/base
diff options
context:
space:
mode:
Diffstat (limited to 'src/base')
-rw-r--r--src/base/statistics.cc17
-rw-r--r--src/base/statistics.hh2
2 files changed, 19 insertions, 0 deletions
diff --git a/src/base/statistics.cc b/src/base/statistics.cc
index e3f3ad78b..545d08cab 100644
--- a/src/base/statistics.cc
+++ b/src/base/statistics.cc
@@ -441,6 +441,23 @@ registerResetCallback(Callback *cb)
resetQueue.add(cb);
}
+bool _enabled = false;
+
+bool
+enabled()
+{
+ return _enabled;
+}
+
+void
+enable()
+{
+ if (_enabled)
+ fatal("Stats are already enabled");
+
+ _enabled = true;
+}
+
} // namespace Stats
void
diff --git a/src/base/statistics.hh b/src/base/statistics.hh
index 1f8a59326..cb63af708 100644
--- a/src/base/statistics.hh
+++ b/src/base/statistics.hh
@@ -3126,6 +3126,8 @@ sum(Temp val)
/** Dump all statistics data to the registered outputs */
void dump();
void reset();
+void enable();
+bool enabled();
/**
* Register a callback that should be called whenever statistics are