aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSiva Velusamy <vsiva@google.com>2012-09-21 12:49:59 -0700
committerSiva Velusamy <vsiva@google.com>2012-09-21 12:57:32 -0700
commit91c8d33d2ee8eea628e340200cb962c90e7af43a (patch)
tree18aa0d0f75a26c21a37a0144885fae8c5652577a
parente5762ef6945caff26742d5429f99ed288ee84855 (diff)
downloadsdk-91c8d33d2ee8eea628e340200cb962c90e7af43a.zip
sdk-91c8d33d2ee8eea628e340200cb962c90e7af43a.tar.gz
sdk-91c8d33d2ee8eea628e340200cb962c90e7af43a.tar.bz2
gltrace: Do not save thumbnail images in memory
These were originally saved with the idea that if the trace file itself was overwritten after it was parsed, we could display the thumbnail image atleast since we don't have access to the full image anymore. However, this hasn't turned out to be a common case, but it just uses up memory for large traces. Change-Id: I1152e23f29563f47b6818b89c5a50bf5ce2a5084
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/ProtoBufUtils.java25
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/TraceFileParserTask.java22
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/GLFunctionTraceViewer.java9
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/model/GLCall.java12
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/model/GLTrace.java4
5 files changed, 5 insertions, 67 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/ProtoBufUtils.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/ProtoBufUtils.java
index 8671ca3..d08b726 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/ProtoBufUtils.java
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/ProtoBufUtils.java
@@ -78,29 +78,4 @@ public class ProtoBufUtils {
return new Image(display, imageData);
}
-
- /**
- * Obtains the image stored in provided protocol buffer message scaled to the
- * provided dimensions.
- */
- public static Image getScaledImage(Display display, GLMessage glMsg, int width, int height) {
- if (!glMsg.hasFb()) {
- return null;
- }
-
- ImageData imageData = null;
- try {
- imageData = getImageData(glMsg);
- } catch (Exception e) {
- GlTracePlugin.getDefault().logMessage(
- "Unexpected error while retrieving framebuffer image: " + e);
- return null;
- }
-
- if (imageData == null) {
- return null;
- }
-
- return new Image(display, imageData.scaledTo(width, height));
- }
}
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 f525657..b90c004 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
@@ -27,8 +27,6 @@ import com.android.ide.eclipse.gltrace.state.transforms.StateTransformFactory;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
import java.io.File;
import java.io.FileNotFoundException;
@@ -48,10 +46,6 @@ public class TraceFileParserTask implements IRunnableWithProgress {
private static final GLMessageFormatter sGLMessageFormatter =
new GLMessageFormatter(GLAPISpec.getSpecs());
- private final Display mDisplay;
- private final int mThumbHeight;
- private final int mThumbWidth;
-
private String mTraceFilePath;
private RandomAccessFile mFile;
@@ -63,33 +57,20 @@ public class TraceFileParserTask implements IRunnableWithProgress {
/**
* Construct a GL Trace file parser.
* @param path path to trace file
- * @param thumbDisplay display to use to create thumbnail images
- * @param thumbWidth width of thumbnail images
- * @param thumbHeight height of thumbnail images
*/
- public TraceFileParserTask(String path, Display thumbDisplay, int thumbWidth,
- int thumbHeight) {
+ public TraceFileParserTask(String path) {
try {
mFile = new RandomAccessFile(path, "r"); //$NON-NLS-1$
} catch (FileNotFoundException e) {
throw new IllegalArgumentException(e);
}
- mDisplay = thumbDisplay;
- mThumbWidth = thumbWidth;
- mThumbHeight = thumbHeight;
-
mTraceFilePath = path;
mGLCalls = new ArrayList<GLCall>();
mGLContextIds = new TreeSet<Integer>();
}
private void addMessage(int index, long traceFileOffset, GLMessage msg, long startTime) {
- Image previewImage = null;
- if (mDisplay != null) {
- previewImage = ProtoBufUtils.getScaledImage(mDisplay, msg, mThumbWidth, mThumbHeight);
- }
-
String formattedMsg;
try {
formattedMsg = sGLMessageFormatter.formatGLMessage(msg);
@@ -101,7 +82,6 @@ public class TraceFileParserTask implements IRunnableWithProgress {
startTime,
traceFileOffset,
formattedMsg,
- previewImage,
msg.getFunction(),
msg.hasFb(),
msg.getContextId(),
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 03d6f68..50ee717 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
@@ -105,12 +105,6 @@ public class GLFunctionTraceViewer extends EditorPart implements ISelectionProvi
private static final String DEFAULT_FILTER_MESSAGE = "Filter list of OpenGL calls. Accepts Java regexes.";
private static final String NEWLINE = System.getProperty("line.separator"); //$NON-NLS-1$
- /** Width of thumbnail images of the framebuffer. */
- private static final int THUMBNAIL_WIDTH = 50;
-
- /** Height of thumbnail images of the framebuffer. */
- private static final int THUMBNAIL_HEIGHT = 50;
-
private static Image sExpandAllIcon;
private static String sLastExportedToFolder;
@@ -231,8 +225,7 @@ public class GLFunctionTraceViewer extends EditorPart implements ISelectionProvi
public void setInput(Shell shell, String tracePath) {
ProgressMonitorDialog dlg = new ProgressMonitorDialog(shell);
- TraceFileParserTask parser = new TraceFileParserTask(mFilePath, shell.getDisplay(),
- THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT);
+ TraceFileParserTask parser = new TraceFileParserTask(mFilePath);
try {
dlg.run(true, true, parser);
} catch (InvocationTargetException e) {
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 aae91c0..f7841cb 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
@@ -21,8 +21,6 @@ import com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.Function;
import com.android.ide.eclipse.gltrace.state.transforms.IStateTransform;
import com.android.sdklib.util.SparseArray;
-import org.eclipse.swt.graphics.Image;
-
import java.util.Collections;
import java.util.List;
@@ -60,9 +58,6 @@ public class GLCall {
/** Flag indicating whether the original protobuf message included FB data. */
private final boolean mHasFb;
- /** Thumbnail image of the framebuffer if available. */
- private final Image mThumbnailImage;
-
/** Full string representation of this call. */
private final String mDisplayString;
@@ -88,12 +83,11 @@ 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,
+ Function function, boolean hasFb, int contextId,
int wallTime, int threadTime) {
mIndex = index;
mStartTime = startTime;
mTraceFileOffset = traceFileOffset;
- mThumbnailImage = thumbnailImage;
mDisplayString = displayString;
mFunction = function;
mHasFb = hasFb;
@@ -126,10 +120,6 @@ public class GLCall {
return mHasFb;
}
- public Image getThumbnailImage() {
- return mThumbnailImage;
- }
-
public long getStartTime() {
return mStartTime;
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/model/GLTrace.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/model/GLTrace.java
index 2c4772e..7667644 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/model/GLTrace.java
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/model/GLTrace.java
@@ -82,14 +82,14 @@ public class GLTrace {
}
if (isTraceFileModified()) {
- return c.getThumbnailImage();
+ return null;
}
RandomAccessFile file;
try {
file = new RandomAccessFile(mTraceFileInfo.getPath(), "r"); //$NON-NLS-1$
} catch (FileNotFoundException e1) {
- return c.getThumbnailImage();
+ return null;
}
GLMessage m = null;