Bug 1595482: change "responsiveness" field to "eventDelay" in profiler r=canaltinova
authorRandell Jesup <rjesup@wgate.com>
Mon, 18 Nov 2019 14:26:14 +0000
changeset 502416 9afdb269ce04e3673bddf950f96a2b7f1306b55a
parent 502415 abc0f2a2d5c6e62b3665de6dcaabd03f427fd623
child 502417 fcb6a78740f837e54e53ca967009b0690a1ad5e7
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscanaltinova
bugs1595482
milestone72.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 1595482: change "responsiveness" field to "eventDelay" in profiler r=canaltinova We want the profiler UI to be able to know if the data can be used for reconstructing the event delays, since it measures something different from the old 16ms event injection. Differential Revision: https://phabricator.services.mozilla.com/D52534
mozglue/baseprofiler/core/ProfileBufferEntry.cpp
mozglue/baseprofiler/core/ProfileBufferEntry.h
mozglue/baseprofiler/core/ProfiledThreadData.cpp
tools/profiler/core/ProfileBufferEntry.cpp
tools/profiler/core/ProfileBufferEntry.h
tools/profiler/core/ProfiledThreadData.cpp
tools/profiler/core/platform.cpp
tools/profiler/tests/xpcshell/test_responsiveness.js
--- a/mozglue/baseprofiler/core/ProfileBufferEntry.cpp
+++ b/mozglue/baseprofiler/core/ProfileBufferEntry.cpp
@@ -349,27 +349,27 @@ struct ProfileSample {
 };
 
 static void WriteSample(SpliceableJSONWriter& aWriter,
                         UniqueJSONStrings& aUniqueStrings,
                         const ProfileSample& aSample) {
   enum Schema : uint32_t {
     STACK = 0,
     TIME = 1,
-    RESPONSIVENESS = 2,
+    EVENT_DELAY = 2,
   };
 
   AutoArraySchemaWriter writer(aWriter, aUniqueStrings);
 
   writer.IntElement(STACK, aSample.mStack);
 
   writer.DoubleElement(TIME, aSample.mTime);
 
   if (aSample.mResponsiveness.isSome()) {
-    writer.DoubleElement(RESPONSIVENESS, *aSample.mResponsiveness);
+    writer.DoubleElement(EVENT_DELAY, *aSample.mResponsiveness);
   }
 }
 
 class EntryGetter {
  public:
   explicit EntryGetter(BlocksRingBuffer::Reader& aReader,
                        uint64_t aInitialReadPos = 0)
       : mBlockIt(aReader.At(
--- a/mozglue/baseprofiler/core/ProfileBufferEntry.h
+++ b/mozglue/baseprofiler/core/ProfileBufferEntry.h
@@ -318,21 +318,21 @@ class UniqueStacks {
 //   "name": "Foo",
 //   "tid": 42,
 //   "samples":
 //   {
 //     "schema":
 //     {
 //       "stack": 0,          /* index into stackTable */
 //       "time": 1,           /* number */
-//       "responsiveness": 2, /* number */
+//       "eventDelay": 2, /* number */
 //     },
 //     "data":
 //     [
-//       [ 1, 0.0, 0.0 ]      /* { stack: 1, time: 0.0, responsiveness: 0.0 } */
+//       [ 1, 0.0, 0.0 ]      /* { stack: 1, time: 0.0, eventDelay: 0.0 } */
 //     ]
 //   },
 //
 //   "markers":
 //   {
 //     "schema":
 //     {
 //       "name": 0,           /* index into stringTable */
--- a/mozglue/baseprofiler/core/ProfiledThreadData.cpp
+++ b/mozglue/baseprofiler/core/ProfiledThreadData.cpp
@@ -121,17 +121,17 @@ void StreamSamplesAndMarkers(const char*
   }
 
   aWriter.StartObjectProperty("samples");
   {
     {
       JSONSchemaWriter schema(aWriter);
       schema.WriteField("stack");
       schema.WriteField("time");
-      schema.WriteField("responsiveness");
+      schema.WriteField("eventDelay");
     }
 
     aWriter.StartArrayProperty("data");
     {
       aBuffer.StreamSamplesToJSON(aWriter, aThreadId, aSinceTime,
                                   aUniqueStacks);
     }
     aWriter.EndArray();
--- a/tools/profiler/core/ProfileBufferEntry.cpp
+++ b/tools/profiler/core/ProfileBufferEntry.cpp
@@ -702,27 +702,27 @@ struct ProfileSample {
 };
 
 static void WriteSample(SpliceableJSONWriter& aWriter,
                         UniqueJSONStrings& aUniqueStrings,
                         const ProfileSample& aSample) {
   enum Schema : uint32_t {
     STACK = 0,
     TIME = 1,
-    RESPONSIVENESS = 2,
+    EVENT_DELAY = 2,
   };
 
   AutoArraySchemaWriter writer(aWriter, aUniqueStrings);
 
   writer.IntElement(STACK, aSample.mStack);
 
   writer.DoubleElement(TIME, aSample.mTime);
 
   if (aSample.mResponsiveness.isSome()) {
-    writer.DoubleElement(RESPONSIVENESS, *aSample.mResponsiveness);
+    writer.DoubleElement(EVENT_DELAY, *aSample.mResponsiveness);
   }
 }
 
 class EntryGetter {
  public:
   explicit EntryGetter(BlocksRingBuffer::Reader& aReader,
                        uint64_t aInitialReadPos = 0)
       : mBlockIt(aReader.At(
--- a/tools/profiler/core/ProfileBufferEntry.h
+++ b/tools/profiler/core/ProfileBufferEntry.h
@@ -455,21 +455,21 @@ class UniqueStacks {
 //   "name": "Foo",
 //   "tid": 42,
 //   "samples":
 //   {
 //     "schema":
 //     {
 //       "stack": 0,          /* index into stackTable */
 //       "time": 1,           /* number */
-//       "responsiveness": 2, /* number */
+//       "eventDelay": 2,     /* number */
 //     },
 //     "data":
 //     [
-//       [ 1, 0.0, 0.0 ]      /* { stack: 1, time: 0.0, responsiveness: 0.0 } */
+//       [ 1, 0.0, 0.0 ]      /* { stack: 1, time: 0.0, eventDelay: 0.0 } */
 //     ]
 //   },
 //
 //   "markers":
 //   {
 //     "schema":
 //     {
 //       "name": 0,           /* index into stringTable */
--- a/tools/profiler/core/ProfiledThreadData.cpp
+++ b/tools/profiler/core/ProfiledThreadData.cpp
@@ -238,17 +238,17 @@ void StreamSamplesAndMarkers(const char*
   }
 
   aWriter.StartObjectProperty("samples");
   {
     {
       JSONSchemaWriter schema(aWriter);
       schema.WriteField("stack");
       schema.WriteField("time");
-      schema.WriteField("responsiveness");
+      schema.WriteField("eventDelay");
     }
 
     aWriter.StartArrayProperty("data");
     {
       aBuffer.StreamSamplesToJSON(aWriter, aThreadId, aSinceTime,
                                   aUniqueStacks);
     }
     aWriter.EndArray();
--- a/tools/profiler/core/platform.cpp
+++ b/tools/profiler/core/platform.cpp
@@ -2872,17 +2872,17 @@ void SamplerThread::Run() {
             // Suspend the thread and collect its stack data in the local
             // buffer.
             mSampler.SuspendAndSampleAndResumeThread(
                 lock, *registeredThread, now,
                 [&](const Registers& aRegs, const TimeStamp& aNow) {
                   DoPeriodicSample(lock, *registeredThread, *profiledThreadData,
                                    now, aRegs, samplePos, localProfileBuffer);
 
-                  // For "responsiveness", we want the input delay - but if
+                  // For "eventDelay", we want the input delay - but if
                   // there are no events in the input queue (or even if there
                   // are), we're interested in how long the delay *would* be for
                   // an input event now, which would be the time to finish the
                   // current event + the delay caused by any events already in
                   // the input queue (plus any High priority events).  Events at
                   // lower priorities (in a PrioritizedEventQueue) than Input
                   // count for input delay only for the duration that they're
                   // running, since when they finish, any queued input event
@@ -3049,29 +3049,29 @@ void SamplerThread::Run() {
                   // per queue per thread - so there would be a memory impact as
                   // well.
 
                   TimeDuration currentEventDelay;
                   TimeDuration currentEventRunning;
                   registeredThread->GetRunningEventDelay(
                       aNow, currentEventDelay, currentEventRunning);
 
-                  // Note: a different definition of responsiveness than the
-                  // 16ms event injection.
+                  // Note: eventDelay is a different definition of
+                  // responsiveness than the 16ms event injection.
 
                   // Don't suppress 0's for now; that can be a future
                   // optimization.  We probably want one zero to be stored
                   // before we start suppressing, which would be more
                   // complex.
                   unresponsiveDuration_ms =
                       Some(currentEventDelay.ToMilliseconds() +
                            currentEventRunning.ToMilliseconds());
                 });
 
-            // If we got responsiveness data, store it before the CompactStack.
+            // If we got eventDelay data, store it before the CompactStack.
             // Note: It is not stored inside the CompactStack so that it doesn't
             // get incorrectly duplicated when the thread is sleeping.
             if (unresponsiveDuration_ms.isSome()) {
               CorePS::CoreBlocksRingBuffer().PutObjects(
                   ProfileBufferEntry::Kind::UnresponsiveDurationMs,
                   *unresponsiveDuration_ms);
             }
 
--- a/tools/profiler/tests/xpcshell/test_responsiveness.js
+++ b/tools/profiler/tests/xpcshell/test_responsiveness.js
@@ -1,14 +1,14 @@
 /* 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/. */
 
 /**
- * Test that we can measure non-zero event delays (responsiveness)
+ * Test that we can measure non-zero event delays
  */
 
 add_task(async () => {
   if (!AppConstants.MOZ_GECKO_PROFILER) {
     return;
   }
   const entries = 10000;
   const interval = 1;
@@ -17,18 +17,18 @@ add_task(async () => {
 
   Services.profiler.StartProfiler(entries, interval, features, threads);
 
   await functionA();
 
   const profile = await Services.profiler.getProfileDataAsync();
   const [thread] = profile.threads;
   const { samples } = thread;
-  const message = "Responsiveness > 0 not found.";
-  let SAMPLE_STACK_SLOT = thread.samples.schema.responsiveness;
+  const message = "eventDelay > 0 not found.";
+  let SAMPLE_STACK_SLOT = thread.samples.schema.eventDelay;
 
   for (let i = 0; i < samples.data.length; i++) {
     if (samples.data[i][SAMPLE_STACK_SLOT] > 0) {
       Assert.ok(true, message);
       return;
     }
   }
   Assert.ok(false, message);