Bug 1555101 - Raise the phase limit for GC telemetry to 73 r=chutten,jonco
authorPaul Bone <pbone@mozilla.com>
Wed, 12 Jun 2019 06:43:43 +0000
changeset 479990 69e31119cd489a611246119fb1109d4012b4e43f
parent 479989 5c4e6eca7339058730338c825461809a6ef9648c
child 479991 5bfd0011c6e36abf95f1b7e9bbd8fe08b46564e1
child 479998 77abd82e2ee91a8957f59d8b738feabbe3f7100f
push id36197
push useraciure@mozilla.com
push dateTue, 25 Jun 2019 09:39:03 +0000
treeherdermozilla-central@5bfd0011c6e3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschutten, jonco
bugs1555101
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1555101 - Raise the phase limit for GC telemetry to 73 r=chutten,jonco Differential Revision: https://phabricator.services.mozilla.com/D33136
js/src/gc/GenerateStatsPhases.py
toolkit/components/telemetry/other/GCTelemetry.jsm
toolkit/components/telemetry/tests/browser/browser_TelemetryGC.js
--- a/js/src/gc/GenerateStatsPhases.py
+++ b/js/src/gc/GenerateStatsPhases.py
@@ -46,16 +46,22 @@
 #    | B |   | C |   | D |
 #    +---+   +---+   +---+
 #              |       |
 #              v       v
 #            +---+   +---+
 #            | E |   | E'|
 #            +---+   +---+
 
+# NOTE: If you add new phases here the current next phase kind number can be
+# found at the end of js/src/gc/StatsPhasesGenerated.inc
+# You must also update
+# toolkit/components/telemetry/other/GCTelemetry.jsm and
+# toolkit/components/telemetry/tests/browser/browser_TelemetryGC.js
+
 import re
 import collections
 
 
 class PhaseKind():
     def __init__(self, name, descr, bucket, children=[]):
         self.name = name
         self.descr = descr
--- a/toolkit/components/telemetry/other/GCTelemetry.jsm
+++ b/toolkit/components/telemetry/other/GCTelemetry.jsm
@@ -100,24 +100,27 @@ class GCData {
   entries() {
     return {
       random: this.randomlySelected.filter(e => e !== null),
       worst: this.worst.filter(e => e !== null),
     };
   }
 }
 
-// If you adjust any of the constants here (slice limit, number of keys, etc.)
-// make sure to update the JSON schema at:
-// https://github.com/mozilla-services/mozilla-pipeline-schemas/blob/master/telemetry/main.schema.json
+// NOTE: If you adjust any of the constants here (slice limit, number of
+// keys, etc.) make sure to update the JSON schema at:
+// https://github.com/mozilla-services/mozilla-pipeline-schemas/blob/dev/templates/include/telemetry/gcItem.1.schema.json
 // You should also adjust browser_TelemetryGC.js.
 const MAX_GC_KEYS = 24;
 const MAX_SLICES = 4;
 const MAX_SLICE_KEYS = 12;
-const MAX_PHASES = 65;
+// Phases are 0-based, so we need one more than the maximum reported in
+// StatsPhasesGenerated.inc. Phase 0 is probably never used by telemetry,
+// but lets allow it anyway.
+const MAX_PHASES = 73;
 const LOGGER_NAME = "Toolkit.Telemetry";
 
 function limitProperties(name, obj, count, log) {
   // If there are too many properties delete all/most of them. We don't
   // expect this ever to happen.
   let num_properties = Object.keys(obj).length;
   if (num_properties > count) {
     for (let key of Object.keys(obj)) {
--- a/toolkit/components/telemetry/tests/browser/browser_TelemetryGC.js
+++ b/toolkit/components/telemetry/tests/browser/browser_TelemetryGC.js
@@ -11,16 +11,18 @@
  * telemetry/main.schema.json                                                    *
  *                                                                               *
  * Otherwise, pings may be dropped by the telemetry backend!                     *
  *                                                                               *
  ********************************************************************************/
 
 const {GCTelemetry} = ChromeUtils.import("resource://gre/modules/GCTelemetry.jsm");
 
+const MAX_PHASES = 73;
+
 function check(entries) {
   const FIELDS = ["random", "worst"];
 
   // Check that all FIELDS are in |entries|.
   for (let f of FIELDS) {
     ok(f in entries, `${f} found in entries`);
   }
 
@@ -47,17 +49,18 @@ function check(entries) {
 
       ok("slices_list" in gc, "slices_list field present");
       ok(Array.isArray(gc.slices_list), "slices_list is an array");
       ok(gc.slices_list.length > 0, "slices_list array non-empty");
       ok(gc.slices_list.length <= 4, "slices_list array is not too long");
 
       ok("totals" in gc, "totals field present");
       is(typeof(gc.totals), "object", "totals is an object");
-      ok(Object.keys(gc.totals).length <= 65, "totals array is not too long");
+      ok(Object.keys(gc.totals).length <= MAX_PHASES,
+          "totals array is not too long");
 
       // Make sure we don't skip any big objects.
       for (let key in gc) {
         if (key != "slices_list" && key != "totals") {
           isnot(typeof(gc[key]), "object", `${key} property should be primitive`);
         }
       }