Bug 1539907 - Don't write category labels for histograms when not recorded on target r=chutten
authorJan-Erik Rediger <jrediger@mozilla.com>
Fri, 05 Apr 2019 17:51:59 +0000
changeset 468216 3f5574c474ed44c5ea63dd0b1c1d5b2d9c8c998c
parent 468215 176a8c9d1b7b3aa8f5f2d4f4400d156d46d3e5fe
child 468217 e5ebda0bbbf19eb17eea05eecb2a0da26497a495
push id82449
push userjrediger@mozilla.com
push dateFri, 05 Apr 2019 17:55:05 +0000
treeherderautoland@3f5574c474ed [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschutten
bugs1539907
milestone68.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 1539907 - Don't write category labels for histograms when not recorded on target r=chutten The new histogram is used as a compile-time check. Differential Revision: https://phabricator.services.mozilla.com/D26330
toolkit/components/telemetry/Histograms.json
toolkit/components/telemetry/build_scripts/gen_histogram_data.py
toolkit/components/telemetry/build_scripts/gen_histogram_enum.py
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -7522,16 +7522,31 @@
     "n_values": 70,
     "labels": [
       "CommonLabel",
       "Label7",
       "Label8"
     ],
     "description": "a testing histogram; not meant to be touched"
   },
+  "TELEMETRY_TEST_CATEGORICAL_WIN_ONLY": {
+    "record_in_processes": ["main", "content"],
+    "alert_emails": ["telemetry-client-dev@mozilla.com"],
+    "bug_numbers": [1539907],
+    "expires_in_version": "never",
+    "kind": "categorical",
+    "n_values": 70,
+    "labels": [
+      "CommonLabel",
+      "Label7",
+      "Label8"
+    ],
+    "description": "a testing histogram used as a compile-time check; not meant to be touched",
+    "operating_systems": ["windows"]
+  },
   "TELEMETRY_TEST_KEYED_COUNT_INIT_NO_RECORD": {
     "record_in_processes": ["main", "content"],
     "alert_emails": ["telemetry-client-dev@mozilla.com"],
     "expires_in_version": "never",
     "kind": "count",
     "keyed": true,
     "description": "a testing histogram; not meant to be touched - initially not recording"
   },
--- a/toolkit/components/telemetry/build_scripts/gen_histogram_data.py
+++ b/toolkit/components/telemetry/build_scripts/gen_histogram_data.py
@@ -180,18 +180,22 @@ def write_histogram_static_asserts(outpu
         'flag': static_asserts_for_flag,
         'count': static_asserts_for_count,
         'enumerated': static_asserts_for_enumerated,
         'categorical': static_asserts_for_enumerated,
         'linear': static_asserts_for_linear,
         'exponential': static_asserts_for_exponential,
     }
 
+    target_os = buildconfig.substs["OS_TARGET"]
     for histogram in histograms:
         kind = histogram.kind()
+        if not histogram.record_on_os(target_os):
+            continue
+
         if kind not in table:
             raise Exception('Unknown kind "%s" for histogram "%s".' % (kind, histogram.name()))
         fn = table[kind]
         fn(output, histogram)
 
 
 def write_histogram_ranges(output, histograms):
     # This generates static data to avoid costly initialization of histograms
--- a/toolkit/components/telemetry/build_scripts/gen_histogram_enum.py
+++ b/toolkit/components/telemetry/build_scripts/gen_histogram_enum.py
@@ -87,16 +87,17 @@ def main(output, *filenames):
     else:
         print("  HistogramFirstUseCounter = 0,", file=output)
         print("  HistogramLastUseCounter = 0,", file=output)
         print("  HistogramUseCounterCount = 0", file=output)
     print("};", file=output)
 
     # Write categorical label enums.
     categorical = filter(lambda h: h.kind() == "categorical", all_histograms)
+    categorical = filter(lambda h: h.record_on_os(buildconfig.substs["OS_TARGET"]), categorical)
     enums = [("LABELS_" + h.name(), h.labels(), h.name()) for h in categorical]
     for name, labels, _ in enums:
         print("\nenum class %s : uint32_t {" % name, file=output)
         print("  %s" % ",\n  ".join(labels), file=output)
         print("};", file=output)
 
     print("\ntemplate<class T> struct IsCategoricalLabelEnum : FalseType {};", file=output)
     for name, _, _ in enums: