bug 1312778 - Ensure histogram recording is enabled before remote accumulation r=gfritzsche

There is a mechanism to selectively turn hgram recording off and on. This is
presently only used to throttle an otherwise-devastatingly-chatty hgram to only
contain accumulations from specific times (sync scroll).

This was only checked on the parent. This checks it on the child as well.

MozReview-Commit-ID: 4f0VXMHLaPW
This commit is contained in:
Chris H-C 2016-10-26 11:17:50 -04:00
Родитель 722080f8b5
Коммит 3bdd8a89d8
2 изменённых файлов: 19 добавлений и 0 удалений

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

@ -1399,6 +1399,11 @@ internal_RemoteAccumulate(mozilla::Telemetry::ID aId, uint32_t aSample)
if (XRE_IsParentProcess()) {
return false;
}
Histogram *h;
nsresult rv = internal_GetHistogramByEnumId(aId, &h, GeckoProcessType_Default);
if (NS_SUCCEEDED(rv) && !h->IsRecordingEnabled()) {
return true;
}
if (!gAccumulations) {
gAccumulations = new nsTArray<Accumulation>();
}
@ -1419,6 +1424,13 @@ internal_RemoteAccumulate(mozilla::Telemetry::ID aId,
if (XRE_IsParentProcess()) {
return false;
}
const HistogramInfo& th = gHistograms[aId];
KeyedHistogram* keyed
= internal_GetKeyedHistogramById(nsDependentCString(th.id()));
MOZ_ASSERT(keyed);
if (!keyed->IsRecordingEnabled()) {
return false;
}
if (!gKeyedAccumulations) {
gKeyedAccumulations = new nsTArray<KeyedAccumulation>();
}

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

@ -18,6 +18,9 @@ function run_child_test() {
let flagHist = Telemetry.getHistogramById("TELEMETRY_TEST_FLAG");
flagHist.add(1);
let countHist = Telemetry.getHistogramById("TELEMETRY_TEST_COUNT");
Telemetry.setHistogramRecordingEnabled("TELEMETRY_TEST_COUNT", false);
countHist.add();
Telemetry.setHistogramRecordingEnabled("TELEMETRY_TEST_COUNT", true);
countHist.add();
countHist.add();
let categHist = Telemetry.getHistogramById("TELEMETRY_TEST_CATEGORICAL");
@ -28,6 +31,10 @@ function run_child_test() {
flagKeyed.add("a", 1);
flagKeyed.add("b", 1);
let countKeyed = Telemetry.getKeyedHistogramById("TELEMETRY_TEST_KEYED_COUNT");
Telemetry.setHistogramRecordingEnabled("TELEMETRY_TEST_KEYED_COUNT", false);
countKeyed.add("a");
countKeyed.add("b");
Telemetry.setHistogramRecordingEnabled("TELEMETRY_TEST_KEYED_COUNT", true);
countKeyed.add("a");
countKeyed.add("b");
countKeyed.add("b");