diff options
author | Siva Velusamy <vsiva@google.com> | 2012-09-18 16:36:33 -0700 |
---|---|---|
committer | Siva Velusamy <vsiva@google.com> | 2012-09-18 16:36:33 -0700 |
commit | e0bff52b4831e4327ec353db58a6c70a6af44fa8 (patch) | |
tree | 15da97511ec4b7d2d64479683c586f4fd8b56c62 /eclipse/plugins | |
parent | 64ac5235c76639ba84157e25caf18d1a52e52a0d (diff) | |
download | sdk-e0bff52b4831e4327ec353db58a6c70a6af44fa8.zip sdk-e0bff52b4831e4327ec353db58a6c70a6af44fa8.tar.gz sdk-e0bff52b4831e4327ec353db58a6c70a6af44fa8.tar.bz2 |
gltrace: Better progress indicator
Use the percent of file parsed as an indicator rather than having
an indeterminate progress bar.
Change-Id: I7a904e007c6ec195cb0e0bb2de7483e3b585489b
Diffstat (limited to 'eclipse/plugins')
-rw-r--r-- | eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/TraceFileParserTask.java | 17 |
1 files changed, 16 insertions, 1 deletions
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 c3ea122..f525657 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 @@ -155,7 +155,15 @@ public class TraceFileParserTask implements IRunnableWithProgress { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - monitor.beginTask("Parsing OpenGL Trace File", IProgressMonitor.UNKNOWN); + long fileLength; + try { + fileLength = mFile.length(); + } catch (IOException e1) { + fileLength = 0; + } + + monitor.beginTask("Parsing OpenGL Trace File", + fileLength > 0 ? 100 : IProgressMonitor.UNKNOWN); List<GLFrame> glFrames = null; @@ -163,6 +171,7 @@ public class TraceFileParserTask implements IRunnableWithProgress { GLMessage msg = null; int msgCount = 0; long filePointer = mFile.getFilePointer(); + int percentParsed = 0; // counters that maintain some statistics about the trace messages long minTraceStartTime = Long.MAX_VALUE; @@ -180,6 +189,12 @@ public class TraceFileParserTask implements IRunnableWithProgress { if (monitor.isCanceled()) { throw new InterruptedException(); } + + if (fileLength > 0) { + int percentParsedNow = (int)((filePointer * 100) / fileLength); + monitor.worked(percentParsedNow - percentParsed); + percentParsed = percentParsedNow; + } } if (mGLContextIds.size() > 1) { |