Merge "Add frame counter to dumpGfxInfo"

This commit is contained in:
Michael Jurka
2012-04-02 09:45:36 -07:00
committed by Android (Google) Code Review
3 changed files with 24 additions and 7 deletions

View File

@@ -259,7 +259,14 @@ public abstract class HardwareRenderer {
* @param pw
*/
abstract void dumpGfxInfo(PrintWriter pw);
/**
* Outputs the total number of frames rendered (used for fps calculations)
*
* @return the number of frames rendered
*/
abstract long getFrameCount();
/**
* Sets the directory to use as a persistent storage for hardware rendering
* resources.
@@ -513,7 +520,7 @@ public abstract class HardwareRenderer {
GL mGl;
HardwareCanvas mCanvas;
int mFrameCount;
long mFrameCount;
Paint mDebugPaint;
static boolean sDirtyRegions;
@@ -591,6 +598,11 @@ public abstract class HardwareRenderer {
}
}
@Override
long getFrameCount() {
return mFrameCount;
}
/**
* Indicates whether this renderer instance can track and update dirty regions.
*/
@@ -1056,13 +1068,13 @@ public abstract class HardwareRenderer {
callbacks.onHardwarePostDraw(canvas);
canvas.restoreToCount(saveCount);
view.mRecreateDisplayList = false;
mFrameCount++;
if (mDebugDirtyRegions) {
if (mDebugPaint == null) {
mDebugPaint = new Paint();
mDebugPaint.setColor(0x7fff0000);
}
if (dirty != null && (mFrameCount++ & 1) == 0) {
if (dirty != null && (mFrameCount & 1) == 0) {
canvas.drawRect(dirty, mDebugPaint);
}
}

View File

@@ -510,8 +510,13 @@ public class WindowManagerImpl implements WindowManager {
String name = root.getClass().getName() + '@' +
Integer.toHexString(hashCode());
pw.printf(" %s: %d views, %.2f kB (display lists)\n",
pw.printf(" %s: %d views, %.2f kB (display lists)",
name, info[0], info[1] / 1024.0f);
HardwareRenderer renderer = root.getView().mAttachInfo.mHardwareRenderer;
if (renderer != null) {
pw.printf(", %d frames rendered", renderer.getFrameCount());
}
pw.printf("\n");
viewsCount += info[0];
displayListsSize += info[1];

View File

@@ -149,7 +149,7 @@ public class WindowManagerService extends IWindowManager.Stub
implements Watchdog.Monitor, WindowManagerPolicy.WindowManagerFuncs {
static final String TAG = "WindowManager";
static final boolean DEBUG = false;
static final boolean DEBUG_ADD_REMOVE = false;
static final boolean DEBUG_ADD_REMOVE = true;
static final boolean DEBUG_FOCUS = false;
static final boolean DEBUG_ANIM = false;
static final boolean DEBUG_LAYOUT = false;
@@ -158,7 +158,7 @@ public class WindowManagerService extends IWindowManager.Stub
static final boolean DEBUG_INPUT = false;
static final boolean DEBUG_INPUT_METHOD = false;
static final boolean DEBUG_VISIBILITY = false;
static final boolean DEBUG_WINDOW_MOVEMENT = false;
static final boolean DEBUG_WINDOW_MOVEMENT = true;
static final boolean DEBUG_TOKEN_MOVEMENT = false;
static final boolean DEBUG_ORIENTATION = false;
static final boolean DEBUG_APP_ORIENTATION = false;