Skip to content

Commit e6c966c

Browse files
mikejurkaAndroid (Google) Code Review
authored andcommitted
Merge "Add frame counter to dumpGfxInfo"
2 parents 78b0d9f + a3fabff commit e6c966c

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.
@@ -513,7 +520,7 @@ static abstract class GlRenderer extends HardwareRenderer {
513520
GL mGl;
514521
HardwareCanvas mCanvas;
515522

516-
int mFrameCount;
523+
long mFrameCount;
517524
Paint mDebugPaint;
518525

519526
static boolean sDirtyRegions;
@@ -591,6 +598,11 @@ void dumpGfxInfo(PrintWriter pw) {
591598
}
592599
}
593600

601+
@Override
602+
long getFrameCount() {
603+
return mFrameCount;
604+
}
605+
594606
/**
595607
* Indicates whether this renderer instance can track and update dirty regions.
596608
*/
@@ -1056,13 +1068,13 @@ boolean draw(View view, View.AttachInfo attachInfo, HardwareDrawCallbacks callba
10561068
callbacks.onHardwarePostDraw(canvas);
10571069
canvas.restoreToCount(saveCount);
10581070
view.mRecreateDisplayList = false;
1059-
1071+
mFrameCount++;
10601072
if (mDebugDirtyRegions) {
10611073
if (mDebugPaint == null) {
10621074
mDebugPaint = new Paint();
10631075
mDebugPaint.setColor(0x7fff0000);
10641076
}
1065-
if (dirty != null && (mFrameCount++ & 1) == 0) {
1077+
if (dirty != null && (mFrameCount & 1) == 0) {
10661078
canvas.drawRect(dirty, mDebugPaint);
10671079
}
10681080
}

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)