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

Commit b2d332e9 authored by Shai Barack's avatar Shai Barack
Browse files

Check loggability before constructing logged string

These allocations are small but they accumulate on vsyncs.
In some long allocation profiles I've seen, these amounted to almost 1%
of Java heap allocations.

Bug: 184951839
Test: N/A these logs aren't tested
Flag: EXEMPT refactor
Change-Id: I2201c1faf37e1a8b186a646af50694ea0c813962
parent 253fcdae
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -1552,15 +1552,19 @@ public final class Choreographer {
                // Otherwise, messages that predate the vsync event will be handled first.
                long now = System.nanoTime();
                if (timestampNanos > now) {
                    if (DEBUG_JANK) {
                        Log.w(TAG, "Frame time is " + ((timestampNanos - now) * 0.000001f)
                                + " ms in the future!  Check that graphics HAL is generating vsync "
                                + "timestamps using the correct timebase.");
                    }
                    timestampNanos = now;
                }

                if (mHavePendingVsync) {
                    if (DEBUG_JANK) {
                        Log.w(TAG, "Already have a pending vsync event.  There should only be "
                                + "one at a time.");
                    }
                } else {
                    mHavePendingVsync = true;
                }