Bug 751316 - fix sending addon histograms in telemetry pings; r=taras

This commit is contained in:
Nathan Froyd 2012-05-02 22:23:23 -04:00
Родитель 97bec5048a
Коммит a781b0fda0
2 изменённых файлов: 20 добавлений и 2 удалений

Просмотреть файл

@ -276,8 +276,13 @@ TelemetryPing.prototype = {
let ahs = Telemetry.addonHistogramSnapshots;
let ret = {};
for (let name in ahs) {
ret[name] = this.convertHistogram(ahs[name]);
for (let addonName in ahs) {
addonHistograms = ahs[addonName];
packedHistograms = {};
for (let name in addonHistograms) {
packedHistograms[name] = this.packHistogram(addonHistograms[name]);
}
ret[addonName] = packedHistograms;
}
return ret;

Просмотреть файл

@ -19,6 +19,8 @@ const SERVER = "http://localhost:4444";
const IGNORE_HISTOGRAM = "test::ignore_me";
const IGNORE_HISTOGRAM_TO_CLONE = "MEMORY_HEAP_ALLOCATED";
const IGNORE_CLONED_HISTOGRAM = "test::ignore_me_also";
const ADDON_NAME = "Telemetry test addon";
const ADDON_HISTOGRAM = "addon-histogram";
const BinaryInputStream = Components.Constructor(
"@mozilla.org/binaryinputstream;1",
@ -64,6 +66,12 @@ function telemetryObserver(aSubject, aTopic, aData) {
const TelemetryPing = Cc["@mozilla.org/base/telemetry-ping;1"].getService(Ci.nsIObserver);
TelemetryPing.observe(histogramsFile, "test-save-histograms", gTestUUID);
TelemetryPing.observe(histogramsFile, "test-load-histograms", null);
Telemetry.registerAddonHistogram(ADDON_NAME, ADDON_HISTOGRAM, 1, 5, 6,
Telemetry.HISTOGRAM_LINEAR);
h1 = Telemetry.getAddonHistogram(ADDON_NAME, ADDON_HISTOGRAM);
h1.add(1);
telemetry_ping();
}
@ -199,6 +207,11 @@ function checkHistograms(request, response) {
do_check_true('MEMORY_JS_GC_HEAP' in payload.histograms); // UNITS_BYTES
do_check_true('MEMORY_JS_COMPARTMENTS_SYSTEM' in payload.histograms); // UNITS_COUNT
// We should have included addon histograms.
do_check_true("addonHistograms" in payload);
do_check_true(ADDON_NAME in payload.addonHistograms);
do_check_true(ADDON_HISTOGRAM in payload.addonHistograms[ADDON_NAME]);
do_check_true(("mainThread" in payload.slowSQL) &&
("otherThreads" in payload.slowSQL));
gFinished = true;