diff options
author | Romain Guy <romainguy@google.com> | 2012-05-21 13:55:15 -0700 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2012-05-21 13:55:15 -0700 |
commit | e2d7f182ff2db26723089206c7d01f6695bd3dfc (patch) | |
tree | b0bdf20a328c0263ed6c0d196f4f91ec0c3a70ab | |
parent | 13b907353f18215b52b5ceda24bbf520d91d72a1 (diff) | |
download | frameworks_base-e2d7f182ff2db26723089206c7d01f6695bd3dfc.zip frameworks_base-e2d7f182ff2db26723089206c7d01f6695bd3dfc.tar.gz frameworks_base-e2d7f182ff2db26723089206c7d01f6695bd3dfc.tar.bz2 |
Remove DEBUG_LATENCY flag
This flag was replaced with the more versatile and powerful systrace.
Change-Id: I2267698f86fe9ba9e1102856795ca641001fecd5
-rw-r--r-- | core/java/android/view/ViewDebug.java | 19 | ||||
-rw-r--r-- | core/java/android/view/ViewRootImpl.java | 129 |
2 files changed, 0 insertions, 148 deletions
diff --git a/core/java/android/view/ViewDebug.java b/core/java/android/view/ViewDebug.java index 2233ca9..dd671dc 100644 --- a/core/java/android/view/ViewDebug.java +++ b/core/java/android/view/ViewDebug.java @@ -69,25 +69,6 @@ public class ViewDebug { public static final boolean DEBUG_DRAG = false; /** - * Enables logging of factors that affect the latency and responsiveness of an application. - * - * Logs the relative difference between the time an event was created and the time it - * was delivered. - * - * Logs the time spent waiting for Surface.lockCanvas(), Surface.unlockCanvasAndPost() - * or eglSwapBuffers(). This is time that the event loop spends blocked and unresponsive. - * Ideally, drawing and animations should be perfectly synchronized with VSYNC so that - * dequeuing and queueing buffers is instantaneous. - * - * Logs the time spent in ViewRoot.performTraversals() and ViewRoot.performDraw(). - * @hide - */ - public static final boolean DEBUG_LATENCY = false; - - /** @hide */ - public static final String DEBUG_LATENCY_TAG = "ViewLatency"; - - /** * This annotation can be used to mark fields and methods to be dumped by * the view server. Only non-void methods with no arguments can be annotated * by this annotation. diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 449507d..512507b 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -217,8 +217,6 @@ public final class ViewRootImpl implements ViewParent, boolean mTraversalScheduled; int mTraversalBarrier; - long mLastTraversalFinishedTimeNanos; - long mLastDrawFinishedTimeNanos; boolean mWillDrawSoon; boolean mFitSystemWindowsRequested; boolean mLayoutRequested; @@ -986,18 +984,6 @@ public final class ViewRootImpl implements ViewParent, Debug.startMethodTracing("ViewAncestor"); } - final long traversalStartTime; - if (ViewDebug.DEBUG_LATENCY) { - traversalStartTime = System.nanoTime(); - if (mLastTraversalFinishedTimeNanos != 0) { - Log.d(ViewDebug.DEBUG_LATENCY_TAG, "Starting performTraversals(); it has been " - + ((traversalStartTime - mLastTraversalFinishedTimeNanos) * 0.000001f) - + "ms since the last traversals finished."); - } else { - Log.d(ViewDebug.DEBUG_LATENCY_TAG, "Starting performTraversals()."); - } - } - Trace.traceBegin(Trace.TRACE_TAG_VIEW, "performTraversals"); try { performTraversals(); @@ -1005,14 +991,6 @@ public final class ViewRootImpl implements ViewParent, Trace.traceEnd(Trace.TRACE_TAG_VIEW); } - if (ViewDebug.DEBUG_LATENCY) { - long now = System.nanoTime(); - Log.d(ViewDebug.DEBUG_LATENCY_TAG, "performTraversals() took " - + ((now - traversalStartTime) * 0.000001f) - + "ms."); - mLastTraversalFinishedTimeNanos = now; - } - if (mProfile) { Debug.stopMethodTracing(); mProfile = false; @@ -2013,18 +1991,6 @@ public final class ViewRootImpl implements ViewParent, return; } - final long drawStartTime; - if (ViewDebug.DEBUG_LATENCY) { - drawStartTime = System.nanoTime(); - if (mLastDrawFinishedTimeNanos != 0) { - Log.d(ViewDebug.DEBUG_LATENCY_TAG, "Starting draw(); it has been " - + ((drawStartTime - mLastDrawFinishedTimeNanos) * 0.000001f) - + "ms since the last draw finished."); - } else { - Log.d(ViewDebug.DEBUG_LATENCY_TAG, "Starting draw()."); - } - } - final boolean fullRedrawNeeded = mFullRedrawNeeded; mFullRedrawNeeded = false; @@ -2037,14 +2003,6 @@ public final class ViewRootImpl implements ViewParent, Trace.traceEnd(Trace.TRACE_TAG_VIEW); } - if (ViewDebug.DEBUG_LATENCY) { - long now = System.nanoTime(); - Log.d(ViewDebug.DEBUG_LATENCY_TAG, "performDraw() took " - + ((now - drawStartTime) * 0.000001f) - + "ms."); - mLastDrawFinishedTimeNanos = now; - } - if (mReportNextDraw) { mReportNextDraw = false; @@ -2208,19 +2166,8 @@ public final class ViewRootImpl implements ViewParent, int right = dirty.right; int bottom = dirty.bottom; - final long lockCanvasStartTime; - if (ViewDebug.DEBUG_LATENCY) { - lockCanvasStartTime = System.nanoTime(); - } - canvas = mSurface.lockCanvas(dirty); - if (ViewDebug.DEBUG_LATENCY) { - long now = System.nanoTime(); - Log.d(ViewDebug.DEBUG_LATENCY_TAG, "- lockCanvas() took " - + ((now - lockCanvasStartTime) * 0.000001f) + "ms"); - } - if (left != dirty.left || top != dirty.top || right != dirty.right || bottom != dirty.bottom) { attachInfo.mIgnoreDirtyState = true; @@ -2287,20 +2234,9 @@ public final class ViewRootImpl implements ViewParent, ? DisplayMetrics.DENSITY_DEVICE : 0); attachInfo.mSetIgnoreDirtyState = false; - final long drawStartTime; - if (ViewDebug.DEBUG_LATENCY) { - drawStartTime = System.nanoTime(); - } - mView.draw(canvas); drawAccessibilityFocusedDrawableIfNeeded(canvas); - - if (ViewDebug.DEBUG_LATENCY) { - long now = System.nanoTime(); - Log.d(ViewDebug.DEBUG_LATENCY_TAG, "- draw() took " - + ((now - drawStartTime) * 0.000001f) + "ms"); - } } finally { if (!attachInfo.mSetIgnoreDirtyState) { // Only clear the flag if it was not set during the mView.draw() call @@ -2308,11 +2244,6 @@ public final class ViewRootImpl implements ViewParent, } } } finally { - final long unlockCanvasAndPostStartTime; - if (ViewDebug.DEBUG_LATENCY) { - unlockCanvasAndPostStartTime = System.nanoTime(); - } - try { surface.unlockCanvasAndPost(canvas); } catch (IllegalArgumentException e) { @@ -2322,12 +2253,6 @@ public final class ViewRootImpl implements ViewParent, return false; } - if (ViewDebug.DEBUG_LATENCY) { - long now = System.nanoTime(); - Log.d(ViewDebug.DEBUG_LATENCY_TAG, "- unlockCanvasAndPost() took " - + ((now - unlockCanvasAndPostStartTime) * 0.000001f) + "ms"); - } - if (LOCAL_LOGV) { Log.v(TAG, "Surface " + surface + " unlockCanvasAndPost"); } @@ -3186,10 +3111,6 @@ public final class ViewRootImpl implements ViewParent, } private void deliverInputEvent(QueuedInputEvent q) { - if (ViewDebug.DEBUG_LATENCY) { - q.mDeliverTimeNanos = System.nanoTime(); - } - Trace.traceBegin(Trace.TRACE_TAG_VIEW, "deliverInputEvent"); try { if (q.mEvent instanceof KeyEvent) { @@ -3637,9 +3558,6 @@ public final class ViewRootImpl implements ViewParent, private void deliverKeyEventPostIme(QueuedInputEvent q) { final KeyEvent event = (KeyEvent)q.mEvent; - if (ViewDebug.DEBUG_LATENCY) { - q.mDeliverPostImeTimeNanos = System.nanoTime(); - } // If the view went away, then the event will not be handled. if (mView == null || !mAdded) { @@ -4162,11 +4080,6 @@ public final class ViewRootImpl implements ViewParent, public InputEvent mEvent; public InputEventReceiver mReceiver; public int mFlags; - - // Used for latency calculations. - public long mReceiveTimeNanos; - public long mDeliverTimeNanos; - public long mDeliverPostImeTimeNanos; } private QueuedInputEvent obtainQueuedInputEvent(InputEvent event, @@ -4205,12 +4118,6 @@ public final class ViewRootImpl implements ViewParent, InputEventReceiver receiver, int flags, boolean processImmediately) { QueuedInputEvent q = obtainQueuedInputEvent(event, receiver, flags); - if (ViewDebug.DEBUG_LATENCY) { - q.mReceiveTimeNanos = System.nanoTime(); - q.mDeliverTimeNanos = 0; - q.mDeliverPostImeTimeNanos = 0; - } - // Always enqueue the input event in order, regardless of its time stamp. // We do this because the application or the IME may inject key events // in response to touch events and we want to ensure that the injected keys @@ -4264,42 +4171,6 @@ public final class ViewRootImpl implements ViewParent, throw new IllegalStateException("finished input event out of order"); } - if (ViewDebug.DEBUG_LATENCY) { - final long now = System.nanoTime(); - final long eventTime = q.mEvent.getEventTimeNano(); - final StringBuilder msg = new StringBuilder(); - msg.append("Spent "); - msg.append((now - q.mReceiveTimeNanos) * 0.000001f); - msg.append("ms processing "); - if (q.mEvent instanceof KeyEvent) { - final KeyEvent keyEvent = (KeyEvent)q.mEvent; - msg.append("key event, action="); - msg.append(KeyEvent.actionToString(keyEvent.getAction())); - } else { - final MotionEvent motionEvent = (MotionEvent)q.mEvent; - msg.append("motion event, action="); - msg.append(MotionEvent.actionToString(motionEvent.getAction())); - msg.append(", historySize="); - msg.append(motionEvent.getHistorySize()); - } - msg.append(", handled="); - msg.append(handled); - msg.append(", received at +"); - msg.append((q.mReceiveTimeNanos - eventTime) * 0.000001f); - if (q.mDeliverTimeNanos != 0) { - msg.append("ms, delivered at +"); - msg.append((q.mDeliverTimeNanos - eventTime) * 0.000001f); - } - if (q.mDeliverPostImeTimeNanos != 0) { - msg.append("ms, delivered post IME at +"); - msg.append((q.mDeliverPostImeTimeNanos - eventTime) * 0.000001f); - } - msg.append("ms, finished at +"); - msg.append((now - eventTime) * 0.000001f); - msg.append("ms."); - Log.d(ViewDebug.DEBUG_LATENCY_TAG, msg.toString()); - } - if (q.mReceiver != null) { q.mReceiver.finishInputEvent(q.mEvent, handled); } else { |