Bug 1518490 Part 3/3: Send XUL load duration and module load duration via untrusted modules ping r=aklotz
authorCarl Corcoran <ccorcoran@mozilla.com>
Tue, 15 Jan 2019 22:30:54 +0000
changeset 514081 1b1fe5815dffcacf40731336a114a8c2fcc2adf7
parent 514080 1b8f7dd09d842bf97fa58840d48904a7f38eb4ac
child 514082 79f7656b35eb2d612ff56302b1e299a55d885b9b
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaklotz
bugs1518490
milestone66.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 1518490 Part 3/3: Send XUL load duration and module load duration via untrusted modules ping r=aklotz This patch: - Adds two new fields to the untrusted modules ping - Updates documentation for the untrusted modules ping: - Documents these 2 new fields - Documents the new XUL ModuleTrustFlags bitfield value - Adds a "version history" section - Corrects documentation for ModuleTrustFlags (JIT, keyboard layouts) Differential Revision: https://phabricator.services.mozilla.com/D16013
toolkit/components/telemetry/docs/data/untrusted-modules-ping.rst
toolkit/components/telemetry/other/UntrustedModules.cpp
--- a/toolkit/components/telemetry/docs/data/untrusted-modules-ping.rst
+++ b/toolkit/components/telemetry/docs/data/untrusted-modules-ping.rst
@@ -9,16 +9,17 @@ were loaded into the Firefox process.
 
     {
       "type": "untrustedModules",
       ... common ping data
       "clientId": <UUID>,
       "environment": { ... },
       "payload": {
         "structVersion": <number>, // See below
+        "xulLoadDurationMS": <number>, // Time spent loading xul.dll, in milliseconds (introduced in Firefox 66)
         "errorModules": <number>, // Number of modules that failed to be evaluated
         "events": [ ... ]
         "combinedStacks": { ... },
       }
     }
 
 payload.structVersion
 ---------------------
@@ -42,16 +43,17 @@ A maximum of 50 events are captured.
       "processUptimeMS": <number>, // Number of milliseconds since app startup
       "isStartup": <boolean>, // See below
       "threadID": <unsigned integer>, // Thread ID where the event occurred
       "threadName": <string>, // If available, the name of the thread
       "modules": [
         {
           "moduleName": <string>, // See below
           "loaderName": <string>, // See below
+          "loadDurationMS" : <number>, // Optional. Time spent loading this module, in milliseconds (introduced in Firefox 66)
           "baseAddress": <string>, // Base address where the module was loaded, e.g. "0x7ffc01260000"
           "fileVersion": <string>, // The module file version, e.g. "1.10.2.6502"
           "moduleTrustFlags": <unsigned integer> // See below
         },
         ... Additional modules
       ]
     }
 
@@ -80,20 +82,22 @@ This is treated as a path and is modifie
 payload.events[...].modules[...].moduleTrustFlags
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 This is a bitfield indicating whether various attributes apply to the module.
 
 * ``1`` if the module is digitally signed by Mozilla
 * ``2`` if the module is digitally signed by Microsoft
 * ``4`` if the module's version info indicates it's a Microsoft module
 * ``8`` if the module is located in the Firefox application directory
-* ``16`` if the module has the same location and version information as the Firefox executable
-* ``32`` if the module is located in the system directory
-* ``64`` if the module is a known keyboard layout DLL
-* ``128`` if the module is located in the Windows Side-by-side directory
+* ``0x10`` if the module has the same location and version information as the Firefox executable
+* ``0x20`` if the module is located in the system directory
+* ``0x40`` if the module is a known keyboard layout DLL
+* ``0x80`` if the module is an internally-recognized JIT module
+* ``0x100`` if the module is located in the Windows Side-by-side directory (introduced in Firefox 66)
+* ``0x200`` if the module is the XPCOM module, xul.dll (introduced in Firefox 66)
 
 payload.combinedStacks
 ----------------------
 This object holds stack traces that correspond to events in ``payload.events``.
 
 .. code-block:: js
 
     "combinedStacks": {
@@ -120,8 +124,16 @@ Notes
 ~~~~~
 * The client id is submitted with this ping.
 * The :doc:`Telemetry Environment <../data/environment>` is submitted in this ping.
 * String fields within ``payload`` are limited in length to 260 characters.
 * This ping is only enabled on Nightly builds of Firefox Desktop for Windows.
 * This ping is sent once daily.
 * Only events occurring on the main browser process are recorded.
 * If there are no events to report, this ping is not sent.
+
+Version History
+~~~~~~~~~~~~~~~
+- Firefox 65: Initial support (`bug 1435827 <https://bugzilla.mozilla.org/show_bug.cgi?id=1435827>`_).
+- Firefox 66:
+
+   - Added Windows Side-by-side directory trust flag (`bug 1514694 <https://bugzilla.mozilla.org/show_bug.cgi?id=1514694>`_).
+   - Added module load times (``xulLoadDurationMS``, ``loadDurationMS``) and xul.dll trust flag (`bug 1518490 <https://bugzilla.mozilla.org/show_bug.cgi?id=1518490>`_).
--- a/toolkit/components/telemetry/other/UntrustedModules.cpp
+++ b/toolkit/components/telemetry/other/UntrustedModules.cpp
@@ -135,16 +135,24 @@ static bool ModuleInfoToJSObj(JSContext*
     return false;
   }
 
   if (!AddLengthLimitedStringProp(cx, modObj, "moduleName",
                                   aModInfo.mFilePathClean)) {
     return false;
   }
 
+  if (aModInfo.mLoadDurationMS.isSome()) {
+    jsval.setNumber(aModInfo.mLoadDurationMS.value());
+    if (!JS_DefineProperty(cx, modObj, "loadDurationMS", jsval,
+                           JSPROP_ENUMERATE)) {
+      return false;
+    }
+  }
+
   jsval.setNumber((uint32_t)aModInfo.mTrustFlags);
   if (!JS_DefineProperty(cx, modObj, "moduleTrustFlags", jsval,
                          JSPROP_ENUMERATE)) {
     return false;
   }
 
   aRet.set(modObj);
   return true;
@@ -240,16 +248,24 @@ nsresult GetUntrustedModuleLoadEventsJSV
   }
 
   jsval.setNumber((uint32_t)kUntrustedModuleLoadEventsTelemetryVersion);
   if (!JS_DefineProperty(cx, mainObj, "structVersion", jsval,
                          JSPROP_ENUMERATE)) {
     return NS_ERROR_FAILURE;
   }
 
+  if (aData.mXULLoadDurationMS.isSome()) {
+    jsval.setNumber(aData.mXULLoadDurationMS.value());
+    if (!JS_DefineProperty(cx, mainObj, "xulLoadDurationMS", jsval,
+                           JSPROP_ENUMERATE)) {
+      return NS_ERROR_FAILURE;
+    }
+  }
+
   JS::RootedObject eventsArray(cx);
   if (!VectorToJSArray(cx, &eventsArray, aData.mEvents,
                        &ModuleLoadEventToJSArray)) {
     return NS_ERROR_FAILURE;
   }
 
   if (!JS_DefineProperty(cx, mainObj, "events", eventsArray,
                          JSPROP_ENUMERATE)) {