bug 661574: Use enum ids for histogram names r=glandium
--- a/toolkit/components/telemetry/Telemetry.cpp
+++ b/toolkit/components/telemetry/Telemetry.cpp
@@ -77,26 +77,25 @@ private:
// A initializer to initialize histogram collection
StatisticsRecorder gStatisticsRecorder;
// Hardcoded probes
struct TelemetryHistogram {
Histogram *histogram;
const char *id;
- const char *name;
PRUint32 min;
PRUint32 max;
PRUint32 bucketCount;
PRUint32 histogramType;
};
const TelemetryHistogram gHistograms[] = {
-#define HISTOGRAM(id, name, min, max, bucket_count, histogram_type, b) \
- { NULL, NS_STRINGIFY(id), name, min, max, bucket_count, nsITelemetry::HISTOGRAM_ ## histogram_type },
+#define HISTOGRAM(id, min, max, bucket_count, histogram_type, b) \
+ { NULL, NS_STRINGIFY(id), min, max, bucket_count, nsITelemetry::HISTOGRAM_ ## histogram_type },
#include "TelemetryHistograms.h"
#undef HISTOGRAM
};
nsresult
HistogramGet(const char *name, PRUint32 min, PRUint32 max, PRUint32 bucketCount,
@@ -137,17 +136,17 @@ GetHistogramByEnumId(Telemetry::ID id, H
static Histogram* knownHistograms[Telemetry::HistogramCount] = {0};
Histogram *h = knownHistograms[id];
if (h) {
*ret = h;
return NS_OK;
}
const TelemetryHistogram &p = gHistograms[id];
- nsresult rv = HistogramGet(p.name, p.min, p.max, p.bucketCount, p.histogramType, &h);
+ nsresult rv = HistogramGet(p.id, p.min, p.max, p.bucketCount, p.histogramType, &h);
if (NS_FAILED(rv))
return NS_ERROR_FAILURE;
*ret = knownHistograms[id] = h;
return NS_OK;
}
bool
--- a/toolkit/components/telemetry/Telemetry.h
+++ b/toolkit/components/telemetry/Telemetry.h
@@ -38,17 +38,17 @@
#ifndef Telemetry_h__
#define Telemetry_h__
namespace mozilla {
namespace Telemetry {
enum ID {
-#define HISTOGRAM(name, a, b, c, d, e, f) name,
+#define HISTOGRAM(name, a, b, c, d, e) name,
#include "TelemetryHistograms.h"
#undef HISTOGRAM
HistogramCount
};
/**
--- a/toolkit/components/telemetry/TelemetryHistograms.h
+++ b/toolkit/components/telemetry/TelemetryHistograms.h
@@ -37,14 +37,14 @@
* ***** END LICENSE BLOCK ***** */
/**
* This file lists Telemetry histograms collected by Firefox.
* Format is HISTOGRAM(id, histogram name, minium, maximum, bucket count,
* histogram kind, human-readable description for about:telemetry)
*/
-HISTOGRAM(CYCLE_COLLECTOR, "nsCycleCollector::Collect (ms)", 1, 10000, 50, EXPONENTIAL, "Time spent on cycle collection")
-HISTOGRAM(TELEMETRY_PING, "Telemetry.ping (ms)", 1, 3000, 10, EXPONENTIAL, "Telemetry submission lag")
-HISTOGRAM(TELEMETRY_SUCCESS, "Telemetry.success (No, Yes)", 0, 1, 2, BOOLEAN, "Success rate of telemetry submissions")
-HISTOGRAM(MEMORY_JS_GC_HEAP, "Memory::explicit/js/gc-heap (MB)", 1024, 512 * 1024, 10, EXPONENTIAL, "Memory used by the JavaScript GC")
-HISTOGRAM(MEMORY_RESIDENT, "Memory::resident (MB)", 32 * 1024, 1024 * 1024, 10, EXPONENTIAL, "Resident memory reported by OS")
-HISTOGRAM(MEMORY_LAYOUT_ALL, "Memory::explicit/layout/all (MB)", 1024, 64 * 1024, 10, EXPONENTIAL, "Memory reported used by layout")
+HISTOGRAM(CYCLE_COLLECTOR, 1, 10000, 50, EXPONENTIAL, "Time(ms) spent on cycle collection")
+HISTOGRAM(TELEMETRY_PING, 1, 3000, 10, EXPONENTIAL, "Time(ms) taken to submit telemetry info")
+HISTOGRAM(TELEMETRY_SUCCESS, 0, 1, 2, BOOLEAN, "Success(No, Yes) rate of telemetry submissions")
+HISTOGRAM(MEMORY_JS_GC_HEAP, 1024, 512 * 1024, 10, EXPONENTIAL, "Memory(MB) used by the JavaScript GC")
+HISTOGRAM(MEMORY_RESIDENT, 32 * 1024, 1024 * 1024, 10, EXPONENTIAL, "Resident memory(MB) reported by OS")
+HISTOGRAM(MEMORY_LAYOUT_ALL, 1024, 64 * 1024, 10, EXPONENTIAL, "Memory(MB) reported used by layout")
--- a/toolkit/components/telemetry/tests/unit/test_TelemetryPing.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetryPing.js
@@ -67,18 +67,18 @@ function checkHistograms(request, respon
appBuildID: "2007010101",
platformBuildID: "2007010101"
};
for (let f in expected_info) {
do_check_eq(payload.info[f], expected_info[f]);
}
- const TELEMETRY_PING = "Telemetry.ping (ms)";
- const TELEMETRY_SUCCESS = "Telemetry.success (No, Yes)";
+ const TELEMETRY_PING = "TELEMETRY_PING";
+ const TELEMETRY_SUCCESS = "TELEMETRY_SUCCESS";
do_check_true(TELEMETRY_PING in payload.histograms)
// There should be one successful report from the previos telemetry ping
const expected_tc = {
range: [1, 2],
bucket_count: 3,
histogram_type: 2,
values: {0:0, 1:1, 2:0}