Bug 718214 - provide mozilla::Telemetry::CanRecord; r=taras
authorNathan Froyd <froydnj@mozilla.com>
Wed, 18 Jan 2012 09:08:18 -0800
changeset 86972 ea33b9fb8a717946f00ff0c218de6f9c9ed62b1a
parent 86971 3c2a8aa90e0683a7889c59f773140fc52a6eaaf2
child 86973 b7e5bbe0003df7d098e14d7b95a84cffc8501404
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstaras
bugs718214
milestone12.0a1
Bug 718214 - provide mozilla::Telemetry::CanRecord; r=taras
toolkit/components/telemetry/Telemetry.cpp
toolkit/components/telemetry/Telemetry.h
--- a/toolkit/components/telemetry/Telemetry.cpp
+++ b/toolkit/components/telemetry/Telemetry.cpp
@@ -1123,16 +1123,22 @@ Accumulate(ID aHistogram, PRUint32 aSamp
 
 void
 AccumulateTimeDelta(ID aHistogram, TimeStamp start, TimeStamp end)
 {
   Accumulate(aHistogram,
              static_cast<PRUint32>((end - start).ToMilliseconds()));
 }
 
+bool
+CanRecord()
+{
+  return TelemetryImpl::CanRecord();
+}
+
 base::Histogram*
 GetHistogramById(ID id)
 {
   Histogram *h = NULL;
   GetHistogramByEnumId(id, &h);
   return h;
 }
 
--- a/toolkit/components/telemetry/Telemetry.h
+++ b/toolkit/components/telemetry/Telemetry.h
@@ -128,16 +128,23 @@ public:
   }
 
 private:
   PRUint32 counter;
   MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 };
 
 /**
+ * Indicates whether Telemetry recording is turned on.  This is intended
+ * to guard calls to Accumulate when the statistic being recorded is
+ * expensive to compute.
+ */
+bool CanRecord();
+
+/**
  * Records slow SQL statements for Telemetry reporting.
  * For privacy reasons, only prepared statements are reported.
  *
  * @param statement - offending SQL statement to record
  * @param dbName - DB filename; reporting is only done for whitelisted DBs
  * @param delay - execution time in milliseconds
  */
 void RecordSlowSQLStatement(const nsACString &statement,