Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 30843e3b authored by Alec Mouri's avatar Alec Mouri
Browse files

Isolate statsd_write trace when reporting jank.

Prior benchmarks shows that this should take 2.6-2.7 micros, but there
exist traces showing that the current slice can take ~700 micros, and
even up to 8 milliseconds, which confounds with the debug log that is
also expected to be cheap. There is evidence that logd occasionally
causes preemption in flinger, so isolate the two calls so that the next
time a bad trace comes in we know what the cause is.

Bug: 144289346
Test: builds
Change-Id: I899e9f99107fad1f5e501b783ce57bfd12300b85
parent 5a1f5498
Loading
Loading
Loading
Loading
+5 −2
Original line number Original line Diff line number Diff line
@@ -1927,9 +1927,12 @@ void SurfaceFlinger::onMessageInvalidate(nsecs_t expectedVSyncTime) NO_THREAD_SA
                ATRACE_NAME("Jank detected");
                ATRACE_NAME("Jank detected");
                ALOGD("Detected janky event. Missed frames: %d", mMissedFrameJankCount);
                ALOGD("Detected janky event. Missed frames: %d", mMissedFrameJankCount);
                const int32_t jankyDurationMillis = jankDuration / (1000 * 1000);
                const int32_t jankyDurationMillis = jankDuration / (1000 * 1000);
                {
                    ATRACE_NAME("Pushing to statsd");
                    android::util::stats_write(android::util::DISPLAY_JANK_REPORTED,
                    android::util::stats_write(android::util::DISPLAY_JANK_REPORTED,
                                               jankyDurationMillis, mMissedFrameJankCount);
                                               jankyDurationMillis, mMissedFrameJankCount);
                }
                }
            }


            // We either reported a jank event or we missed the trace
            // We either reported a jank event or we missed the trace
            // window, so clear counters here.
            // window, so clear counters here.