Bug 1518044 - Use shared CONTENT_FRAME_TIME calculation for non-WebRender. r=jrmuizel
authorMatt Woodrow <mwoodrow@mozilla.com>
Mon, 07 Jan 2019 03:15:57 +0000
changeset 509785 dad482c7ff924d880604b1eba8f73437a823c069
parent 509784 39ab423f06ef236d72d25629bb462200ed8483ef
child 509786 89f55d26acaf0c33144c577029b7b58d490bec62
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1518044
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 1518044 - Use shared CONTENT_FRAME_TIME calculation for non-WebRender. r=jrmuizel This also results in us getting the CONTENT_FRAME_TIME profiler markers added for non-WR. Differential Revision: https://phabricator.services.mozilla.com/D15795
gfx/layers/ipc/CompositorBridgeParent.cpp
gfx/layers/ipc/LayerTransactionParent.cpp
--- a/gfx/layers/ipc/CompositorBridgeParent.cpp
+++ b/gfx/layers/ipc/CompositorBridgeParent.cpp
@@ -2472,16 +2472,27 @@ int32_t RecordContentFrameTime(
   if (!(aTxnId == VsyncId()) && aVsyncStart) {
     latencyMs = (aCompositeEnd - aVsyncStart).ToMilliseconds();
     latencyNorm = latencyMs / aVsyncRate.ToMilliseconds();
     fracLatencyNorm = lround(latencyNorm * 100.0);
     Telemetry::Accumulate(Telemetry::CONTENT_FRAME_TIME_VSYNC, fracLatencyNorm);
 
     // Record CONTENT_FRAME_TIME_REASON.
     //
+    // Note that deseralizing a layers update (RecvUpdate) can delay the receipt
+    // of the composite vsync message
+    // (CompositorBridgeParent::CompositeToTarget), since they're using the same
+    // thread. This can mean that compositing might start significantly late,
+    // but this code will still detect it as having successfully started on the
+    // right vsync (which is somewhat correct). We'd now have reduced time left
+    // in the vsync interval to finish compositing, so the chances of a missed
+    // frame increases. This is effectively including the RecvUpdate work as
+    // part of the 'compositing' phase for this metric, but it isn't included in
+    // COMPOSITE_TIME, and *is* included in CONTENT_FULL_PAINT_TIME.
+    //
     // Also of note is that when the root WebRenderBridgeParent decides to
     // skip a composite (due to the Renderer being busy), that won't notify
     // child WebRenderBridgeParents. That failure will show up as the
     // composite starting late (since it did), but it's really a fault of a
     // slow composite on the previous frame, not a slow
     // CONTENT_FULL_PAINT_TIME. It would be nice to have a separate bucket for
     // this category (scene was ready on the next vsync, but we chose not to
     // composite), but I can't find a way to locate the right child
--- a/gfx/layers/ipc/LayerTransactionParent.cpp
+++ b/gfx/layers/ipc/LayerTransactionParent.cpp
@@ -882,62 +882,19 @@ void LayerTransactionParent::DeallocShme
 
 bool LayerTransactionParent::IsSameProcess() const {
   return OtherPid() == base::GetCurrentProcId();
 }
 
 TransactionId LayerTransactionParent::FlushTransactionId(
     const VsyncId& aId, TimeStamp& aCompositeEnd) {
   if (mId.IsValid() && mPendingTransaction.IsValid() && !mVsyncRate.IsZero()) {
-    double latencyMs = (aCompositeEnd - mTxnStartTime).ToMilliseconds();
-    double latencyNorm = latencyMs / mVsyncRate.ToMilliseconds();
-    int32_t fracLatencyNorm = lround(latencyNorm * 100.0);
-    Telemetry::Accumulate(Telemetry::CONTENT_FRAME_TIME, fracLatencyNorm);
-
-    if (!(mTxnVsyncId == VsyncId()) && mVsyncStartTime) {
-      latencyMs = (aCompositeEnd - mVsyncStartTime).ToMilliseconds();
-      latencyNorm = latencyMs / mVsyncRate.ToMilliseconds();
-      fracLatencyNorm = lround(latencyNorm * 100.0);
-      Telemetry::Accumulate(Telemetry::CONTENT_FRAME_TIME_VSYNC,
-                            fracLatencyNorm);
-
-      // Record CONTENT_FRAME_TIME_REASON. See
-      // WebRenderBridgeParent::FlushTransactionIdsForEpoch for more details.
-      //
-      // Note that deseralizing a layers update (RecvUpdate) can delay the receipt
-      // of the composite vsync message
-      // (CompositorBridgeParent::CompositeToTarget), since they're using the same
-      // thread. This can mean that compositing might start significantly late,
-      // but this code will still detect it as having successfully started on the
-      // right vsync (which is somewhat correct). We'd now have reduced time left
-      // in the vsync interval to finish compositing, so the chances of a missed
-      // frame increases. This is effectively including the RecvUpdate work as
-      // part of the 'compositing' phase for this metric, but it isn't included in
-      // COMPOSITE_TIME, and *is* included in CONTENT_FULL_PAINT_TIME.
-      if (fracLatencyNorm < 200) {
-        // Success
-        Telemetry::AccumulateCategorical(
-            LABELS_CONTENT_FRAME_TIME_REASON::OnTime);
-      } else {
-        if (mTxnVsyncId == VsyncId() || aId == VsyncId() || mTxnVsyncId >= aId) {
-          // Vsync ids are nonsensical, possibly something got trigged from
-          // outside vsync?
-          Telemetry::AccumulateCategorical(
-              LABELS_CONTENT_FRAME_TIME_REASON::NoVsync);
-        } else if (aId - mTxnVsyncId > 1) {
-          // Composite started late (and maybe took too long as well)
-          Telemetry::AccumulateCategorical(
-              LABELS_CONTENT_FRAME_TIME_REASON::MissedComposite);
-        } else {
-          // Composite start on time, but must have taken too long.
-          Telemetry::AccumulateCategorical(
-              LABELS_CONTENT_FRAME_TIME_REASON::SlowComposite);
-        }
-      }
-    }
+    RecordContentFrameTime(mTxnVsyncId, mVsyncStartTime, mTxnStartTime, aId,
+                           aCompositeEnd, TimeDuration::FromMilliseconds(0),
+                           mVsyncRate, false, false);
   }
 
 #if defined(ENABLE_FRAME_LATENCY_LOG)
   if (mPendingTransaction.IsValid()) {
     if (mRefreshStartTime) {
       int32_t latencyMs =
           lround((aCompositeEnd - mRefreshStartTime).ToMilliseconds());
       printf_stderr(