diff options
author | Siva Velusamy <vsiva@google.com> | 2012-02-17 10:42:30 -0800 |
---|---|---|
committer | Siva Velusamy <vsiva@google.com> | 2012-02-17 10:44:02 -0800 |
commit | ec09fee41c98095ac862963d22e9d602504a999e (patch) | |
tree | 8152b6c5f938ec56ad04f362f9820c4e35bb37b3 /eclipse | |
parent | 8e054f9228c59c1371b93c104558c0c0e1436b6a (diff) | |
download | sdk-ec09fee41c98095ac862963d22e9d602504a999e.zip sdk-ec09fee41c98095ac862963d22e9d602504a999e.tar.gz sdk-ec09fee41c98095ac862963d22e9d602504a999e.tar.bz2 |
gltrace: Show wall time and thread time.
Extend the protobuf to include wall time and thread time.
Both durations are displayed in the function view.
Change-Id: I407255464469195f7e6cf1a4b526637cb7c02823
Diffstat (limited to 'eclipse')
6 files changed, 83 insertions, 15 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/GLProtoBuf.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/GLProtoBuf.java index 483795e..10ce07e 100644 --- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/GLProtoBuf.java +++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/GLProtoBuf.java @@ -1019,7 +1019,8 @@ public final class GLProtoBuf { @Override public Function findValueByNumber(int number) { return Function.valueOf(number); - }}; + } + }; private final int index; private final int value; @@ -2231,6 +2232,13 @@ public final class GLProtoBuf { public boolean hasFb() { return hasFb; } public com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.FrameBuffer getFb() { return fb_; } + // optional int32 threadtime = 8; + public static final int THREADTIME_FIELD_NUMBER = 8; + private boolean hasThreadtime; + private int threadtime_ = 0; + public boolean hasThreadtime() { return hasThreadtime; } + public int getThreadtime() { return threadtime_; } + private void initFields() { function_ = com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.Function.invalid; returnValue_ = com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.DataType.getDefaultInstance(); @@ -2279,6 +2287,9 @@ public final class GLProtoBuf { if (hasFb()) { output.writeMessage(7, getFb()); } + if (hasThreadtime()) { + output.writeInt32(8, getThreadtime()); + } } private int memoizedSerializedSize = -1; @@ -2316,6 +2327,10 @@ public final class GLProtoBuf { size += com.google.protobuf.CodedOutputStream .computeMessageSize(7, getFb()); } + if (hasThreadtime()) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(8, getThreadtime()); + } memoizedSerializedSize = size; return size; } @@ -2498,6 +2513,9 @@ public final class GLProtoBuf { if (other.hasFb()) { mergeFb(other.getFb()); } + if (other.hasThreadtime()) { + setThreadtime(other.getThreadtime()); + } return this; } @@ -2561,6 +2579,10 @@ public final class GLProtoBuf { setFb(subBuilder.buildPartial()); break; } + case 64: { + setThreadtime(input.readInt32()); + break; + } } } } @@ -2766,6 +2788,24 @@ public final class GLProtoBuf { return this; } + // optional int32 threadtime = 8; + public boolean hasThreadtime() { + return result.hasThreadtime(); + } + public int getThreadtime() { + return result.getThreadtime(); + } + public Builder setThreadtime(int value) { + result.hasThreadtime = true; + result.threadtime_ = value; + return this; + } + public Builder clearThreadtime() { + result.hasThreadtime = false; + result.threadtime_ = 0; + return this; + } + // @@protoc_insertion_point(builder_scope:android.gltrace.GLMessage) } diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/GLTraceOptionsDialog.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/GLTraceOptionsDialog.java index 633ecf5..b0e1b1f 100644 --- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/GLTraceOptionsDialog.java +++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/GLTraceOptionsDialog.java @@ -49,7 +49,7 @@ import java.util.List; /** Dialog displaying all the trace options before the user initiates tracing. */ public class GLTraceOptionsDialog extends TitleAreaDialog { private static final String TITLE = "OpenGL ES Trace Options"; - private static final String DEFAULT_MESSAGE = "Provide the application and activity to be traced. The application needs to have INTERNET permission for tracing."; + private static final String DEFAULT_MESSAGE = "Provide the application and activity to be traced."; private static final String PREF_APPNAME = "gl.trace.appname"; private static final String PREF_TRACEFILE = "gl.trace.destfile"; diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/TraceFileParserTask.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/TraceFileParserTask.java index d6d01d2..af0501b 100644 --- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/TraceFileParserTask.java +++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/TraceFileParserTask.java @@ -106,6 +106,7 @@ public class TraceFileParserTask implements IRunnableWithProgress { msg.hasFb(), msg.getContextId(), msg.getDuration(), + msg.getThreadtime(), StateTransformFactory.getTransformsFor(msg)); addProperties(c, msg); diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/DurationMinimap.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/DurationMinimap.java index 2c81f3e..a6802c9 100644 --- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/DurationMinimap.java +++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/DurationMinimap.java @@ -308,7 +308,7 @@ public class DurationMinimap extends Canvas { resetColor = true; } - long duration = c.getDuration(); + long duration = c.getWallDuration(); if (c.getFunction() == Function.eglSwapBuffers) { // egl swap buffers typically takes very little time, but since // it is a significant call, we explicitly size it to the max length diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/GLFunctionTraceViewer.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/GLFunctionTraceViewer.java index debd086..1a1f388 100644 --- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/GLFunctionTraceViewer.java +++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/GLFunctionTraceViewer.java @@ -374,14 +374,23 @@ public class GLFunctionTraceViewer extends EditorPart implements ISelectionProvi tvc.setLabelProvider(labelProvider); TreeColumn column = tvc.getColumn(); column.setText("Function"); - column.setWidth(700); + column.setWidth(500); - // column showing the GL function duration + // column showing the GL function duration (wall clock time) tvc = new TreeViewerColumn(mFrameTreeViewer, SWT.NONE); tvc.setLabelProvider(labelProvider); column = tvc.getColumn(); - column.setText("Duration"); + column.setText("Wall Time (ns)"); column.setWidth(150); + column.setAlignment(SWT.RIGHT); + + // column showing the GL function duration (thread time) + tvc = new TreeViewerColumn(mFrameTreeViewer, SWT.NONE); + tvc.setLabelProvider(labelProvider); + column = tvc.getColumn(); + column.setText("Thread Time (ns)"); + column.setWidth(150); + column.setAlignment(SWT.RIGHT); mFrameTreeViewer.setContentProvider(new GLFrameContentProvider()); @@ -394,9 +403,10 @@ public class GLFunctionTraceViewer extends EditorPart implements ISelectionProvi @Override public void controlResized(ControlEvent e) { int w = mFrameTreeViewer.getTree().getClientArea().width; - if (w > 100) { + if (w > 200) { + mFrameTreeViewer.getTree().getColumn(2).setWidth(100); mFrameTreeViewer.getTree().getColumn(1).setWidth(100); - mFrameTreeViewer.getTree().getColumn(0).setWidth(w - 100); + mFrameTreeViewer.getTree().getColumn(0).setWidth(w - 200); } } }); @@ -537,11 +547,19 @@ public class GLFunctionTraceViewer extends EditorPart implements ISelectionProvi return c.getFunction().toString(); } case 1: - return Integer.toString(c.getDuration()); + return formatDuration(c.getWallDuration()); + case 2: + return formatDuration(c.getThreadDuration()); default: return Integer.toString(c.getContextId()); } } + + private String formatDuration(int time) { + // Max duration is in the 10s of milliseconds, so xx,xxx,xxx ns + // So we require a format specifier that is 10 characters wide + return String.format("%,10d", time); //$NON-NLS-1$ + } } private static class GLCallFilter extends ViewerFilter { diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/model/GLCall.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/model/GLCall.java index 6daae6e..5d11a84 100644 --- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/model/GLCall.java +++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/model/GLCall.java @@ -62,8 +62,11 @@ public class GLCall { /** GL Context identifier corresponding to the context of this call. */ private final int mContextId; - /** Duration of this call. */ - private final int mDuration; + /** Duration of this call (MONOTONIC/wall clock time). */ + private final int mWallDuration; + + /** Duration of this call (THREAD time). */ + private final int mThreadDuration; /** List of state transformations performed by this call. */ private final List<IStateTransform> mStateTransforms; @@ -72,7 +75,8 @@ public class GLCall { private SparseArray<Object> mProperties; public GLCall(int index, long startTime, long traceFileOffset, String displayString, - Image thumbnailImage, Function function, boolean hasFb, int contextId, int duration, + Image thumbnailImage, Function function, boolean hasFb, int contextId, + int wallTime, int threadTime, List<IStateTransform> stateTransforms) { mIndex = index; mStartTime = startTime; @@ -82,7 +86,8 @@ public class GLCall { mFunction = function; mHasFb = hasFb; mContextId = contextId; - mDuration = duration; + mWallDuration = wallTime; + mThreadDuration = threadTime; mStateTransforms = stateTransforms; } @@ -118,8 +123,12 @@ public class GLCall { return mStartTime; } - public int getDuration() { - return mDuration; + public int getWallDuration() { + return mWallDuration; + } + + public int getThreadDuration() { + return mThreadDuration; } public List<IStateTransform> getStateTransformations() { |