Bug 1728423 - Migrate display list building time metric to glean. r=chutten,miko
authorJeff Muizelaar <jmuizelaar@mozilla.com>
Wed, 22 Sep 2021 20:36:04 +0000
changeset 592975 baafe21d97806a810ef459846d0e5dcb66974b17
parent 592974 08253569af6658a6f021c1cbf9c7785dccab530b
child 592976 4d0431cd591b7a324192fc17a8f82d8bc0de1f7d
push id38816
push userccozmuta@mozilla.com
push dateThu, 23 Sep 2021 03:42:47 +0000
treeherdermozilla-central@56c35cc1a87f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschutten, miko
bugs1728423
milestone94.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 1728423 - Migrate display list building time metric to glean. r=chutten,miko Differential Revision: https://phabricator.services.mozilla.com/D124124
gfx/metrics.yaml
layout/base/nsLayoutUtils.cpp
toolkit/components/glean/metrics_index.py
new file mode 100644
--- /dev/null
+++ b/gfx/metrics.yaml
@@ -0,0 +1,27 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# This file defines the metrics that are recorded by the Glean SDK. They are
+# automatically converted to platform-specific code at build time using the
+# `glean_parser` PyPI package.
+
+---
+$schema: moz://mozilla.org/schemas/glean/metrics/2-0-0
+
+paint:
+  build_displaylist_time:
+    type: timing_distribution
+    description: >
+      The time to build a Gecko display list.
+    bugs:
+      - https://bugzilla.mozilla.org/show_bug.cgi?id=1728423
+    data_reviews:
+      - https://bugzilla.mozilla.org/show_bug.cgi?id=1728423
+    data_sensitivity:
+      - technical
+    notification_emails:
+      - gfx-telemetry-alerts@mozilla.com
+      - mwoodrow@mozilla.com
+    expires: never
+    telemetry_mirror: PAINT_BUILD_DISPLAYLIST_TIME
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -29,16 +29,17 @@
 #include "LayoutLogging.h"
 #include "MobileViewportManager.h"
 #include "mozilla/AccessibleCaretEventHub.h"
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/BasicEvents.h"
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/DisplayPortUtils.h"
 #include "mozilla/GeckoBindings.h"
+#include "mozilla/glean/GleanMetrics.h"
 #include "mozilla/dom/AnonymousContent.h"
 #include "mozilla/dom/BrowserChild.h"
 #include "mozilla/dom/CanvasUtils.h"
 #include "mozilla/dom/Document.h"
 #include "mozilla/dom/DocumentInlines.h"
 #include "mozilla/dom/DOMRect.h"
 #include "mozilla/dom/DOMStringList.h"
 #include "mozilla/dom/Element.h"
@@ -3091,16 +3092,17 @@ void nsLayoutUtils::PaintFrame(gfxContex
       NS_ASSERTION(aRenderingContext, "need a rendering context");
     }
   }
 
   nsPresContext* presContext = aFrame->PresContext();
   PresShell* presShell = presContext->PresShell();
 
   TimeStamp startBuildDisplayList = TimeStamp::Now();
+  auto dlTimerId = mozilla::glean::paint::build_displaylist_time.Start();
 
   const bool buildCaret = !(aFlags & PaintFrameFlags::HideCaret);
 
   // Note that isForPainting here does not include the PaintForPrinting builder
   // mode; that's OK because there is no point in using retained display lists
   // for a print destination.
   const bool isForPainting = (aFlags & PaintFrameFlags::WidgetLayers) &&
                              aBuilderMode == nsDisplayListBuilderMode::Painting;
@@ -3378,19 +3380,17 @@ void nsLayoutUtils::PaintFrame(gfxContex
     builder->IncrementPresShellPaintCount(presShell);
   }
 
   MOZ_ASSERT(updateState != PartialUpdateResult::Failed);
   builder->Check();
 
   const double geckoDLBuildTime =
       (TimeStamp::Now() - startBuildDisplayList).ToMilliseconds();
-
-  Telemetry::Accumulate(Telemetry::PAINT_BUILD_DISPLAYLIST_TIME,
-                        geckoDLBuildTime);
+  mozilla::glean::paint::build_displaylist_time.StopAndAccumulate(std::move(dlTimerId));
 
   bool consoleNeedsDisplayList =
       (gfxUtils::DumpDisplayList() || gfxEnv::DumpPaint()) &&
       builder->IsInActiveDocShell();
 #ifdef MOZ_DUMP_PAINTING
   FILE* savedDumpFile = gfxUtils::sDumpPaintFile;
 #endif
 
--- a/toolkit/components/glean/metrics_index.py
+++ b/toolkit/components/glean/metrics_index.py
@@ -6,16 +6,17 @@
 
 # The list of all Glean metrics.yaml files, relative to the top src dir.
 # New additions should be added to the bottom of the list.
 metrics_yamls = [
     "toolkit/components/glean/metrics.yaml",
     "toolkit/components/glean/tests/test_metrics.yaml",
     "toolkit/mozapps/update/metrics.yaml",
     "browser/base/content/metrics.yaml",
+    "gfx/metrics.yaml",
 ]
 
 # The list of all Glean pings.yaml files, relative to the top src dir.
 # New additions should be added to the bottom of the list.
 pings_yamls = [
     "toolkit/components/glean/pings.yaml",
     "toolkit/components/glean/tests/test_pings.yaml",
     "toolkit/mozapps/update/pings.yaml",