Skip to content

Commit a3fabff

Browse files
committed
Add frame counter to dumpGfxInfo
Change-Id: I016f706e32cbdbce014795d8fc537b15c389dc7a
1 parent f9c1f99 commit a3fabff

File tree

3 files changed

+24
-7
lines changed

3 files changed

+24
-7
lines changed

core/java/android/view/HardwareRenderer.java

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,14 @@ public static boolean isAvailable() {
259259
* @param pw
260260
*/
261261
abstract void dumpGfxInfo(PrintWriter pw);
262-
262+
263+
/**
264+
* Outputs the total number of frames rendered (used for fps calculations)
265+
*
266+
* @return the number of frames rendered
267+
*/
268+
abstract long getFrameCount();
269+
263270
/**
264271
* Sets the directory to use as a persistent storage for hardware rendering
265272
* resources.
@@ -475,7 +482,7 @@ static abstract class GlRenderer extends HardwareRenderer {
475482
GL mGl;
476483
HardwareCanvas mCanvas;
477484

478-
int mFrameCount;
485+
long mFrameCount;
479486
Paint mDebugPaint;
480487

481488
static boolean sDirtyRegions;
@@ -552,6 +559,11 @@ void dumpGfxInfo(PrintWriter pw) {
552559
}
553560
}
554561

562+
@Override
563+
long getFrameCount() {
564+
return mFrameCount;
565+
}
566+
555567
/**
556568
* Indicates whether this renderer instance can track and update dirty regions.
557569
*/
@@ -1006,13 +1018,13 @@ boolean draw(View view, View.AttachInfo attachInfo, HardwareDrawCallbacks callba
10061018
callbacks.onHardwarePostDraw(canvas);
10071019
canvas.restoreToCount(saveCount);
10081020
view.mRecreateDisplayList = false;
1009-
1021+
mFrameCount++;
10101022
if (mDebugDirtyRegions) {
10111023
if (mDebugPaint == null) {
10121024
mDebugPaint = new Paint();
10131025
mDebugPaint.setColor(0x7fff0000);
10141026
}
1015-
if (dirty != null && (mFrameCount++ & 1) == 0) {
1027+
if (dirty != null && (mFrameCount & 1) == 0) {
10161028
canvas.drawRect(dirty, mDebugPaint);
10171029
}
10181030
}

core/java/android/view/WindowManagerImpl.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,13 @@ public void dumpGfxInfo(FileDescriptor fd) {
510510

511511
String name = root.getClass().getName() + '@' +
512512
Integer.toHexString(hashCode());
513-
pw.printf(" %s: %d views, %.2f kB (display lists)\n",
513+
pw.printf(" %s: %d views, %.2f kB (display lists)",
514514
name, info[0], info[1] / 1024.0f);
515+
HardwareRenderer renderer = root.getView().mAttachInfo.mHardwareRenderer;
516+
if (renderer != null) {
517+
pw.printf(", %d frames rendered", renderer.getFrameCount());
518+
}
519+
pw.printf("\n");
515520

516521
viewsCount += info[0];
517522
displayListsSize += info[1];

services/java/com/android/server/wm/WindowManagerService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public class WindowManagerService extends IWindowManager.Stub
149149
implements Watchdog.Monitor, WindowManagerPolicy.WindowManagerFuncs {
150150
static final String TAG = "WindowManager";
151151
static final boolean DEBUG = false;
152-
static final boolean DEBUG_ADD_REMOVE = false;
152+
static final boolean DEBUG_ADD_REMOVE = true;
153153
static final boolean DEBUG_FOCUS = false;
154154
static final boolean DEBUG_ANIM = false;
155155
static final boolean DEBUG_LAYOUT = false;
@@ -158,7 +158,7 @@ public class WindowManagerService extends IWindowManager.Stub
158158
static final boolean DEBUG_INPUT = false;
159159
static final boolean DEBUG_INPUT_METHOD = false;
160160
static final boolean DEBUG_VISIBILITY = false;
161-
static final boolean DEBUG_WINDOW_MOVEMENT = false;
161+
static final boolean DEBUG_WINDOW_MOVEMENT = true;
162162
static final boolean DEBUG_TOKEN_MOVEMENT = false;
163163
static final boolean DEBUG_ORIENTATION = false;
164164
static final boolean DEBUG_APP_ORIENTATION = false;

0 commit comments

Comments
 (0)