Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 90070 Details for
Bug 209343
Binary Data Transfer Format for Profiling (Client-side)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
BF UI support
org.eclipse.hyades.trace.ui_patch.txt (text/plain), 8.14 KB, created by
Stanislav Polevic
on 2008-02-19 09:56:09 EST
(
hide
)
Description:
BF UI support
Filename:
MIME Type:
Creator:
Stanislav Polevic
Created:
2008-02-19 09:56:09 EST
Size:
8.14 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.hyades.trace.ui >Index: src/org/eclipse/hyades/trace/ui/internal/util/PDCoreUtil.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.trace.ui/src/org/eclipse/hyades/trace/ui/internal/util/PDCoreUtil.java,v >retrieving revision 1.49 >diff -u -r1.49 PDCoreUtil.java >--- src/org/eclipse/hyades/trace/ui/internal/util/PDCoreUtil.java 28 May 2007 19:33:07 -0000 1.49 >+++ src/org/eclipse/hyades/trace/ui/internal/util/PDCoreUtil.java 19 Feb 2008 14:31:28 -0000 >@@ -11,6 +11,9 @@ > **********************************************************************/ > package org.eclipse.hyades.trace.ui.internal.util; > >+import java.io.FileInputStream; >+import java.io.IOException; >+import java.io.InputStream; > import java.net.UnknownHostException; > import java.util.ArrayList; > import java.util.Date; >@@ -1202,4 +1205,52 @@ > ProfileUIManager.getInstance().startMonitoring(agentProxy); > } > } >+ >+ public static boolean isTBFFile(InputStream readStream) throws IOException { >+ byte[] magic = new byte[4]; >+ >+ if (readStream.read(magic) > 1) { >+ if ((magic[1] == 'T') && (magic[2] == 'B') && (magic[3] == 'F')) { >+ return true; >+ } >+ } >+ >+ return false; >+ } >+ >+ public static boolean isTBFFile(String fileName) throws IOException { >+ FileInputStream readStream = new FileInputStream(fileName); >+ boolean ret = isTBFFile(readStream); >+ >+ readStream.close(); >+ readStream = null; >+ >+ return ret; >+ } >+ >+ public static boolean isXMLFile(InputStream readStream) throws IOException { >+ byte[] magic = new byte[5]; >+ >+ if (readStream.read(magic) > 1) { >+ if ((magic[0] == '<') && >+ (magic[1] == '?') && >+ (magic[2] == 'x') && >+ (magic[2] == 'm') && >+ (magic[2] == 'l')) { >+ return true; >+ } >+ } >+ >+ return false; >+ } >+ >+ public static boolean isXMLFile(String fileName) throws IOException { >+ FileInputStream readStream = new FileInputStream(fileName); >+ boolean ret = isXMLFile(readStream); >+ >+ readStream.close(); >+ readStream = null; >+ >+ return ret; >+ } > } >Index: src/org/eclipse/hyades/trace/ui/internal/wizard/ImportTracePage1.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.trace.ui/src/org/eclipse/hyades/trace/ui/internal/wizard/ImportTracePage1.java,v >retrieving revision 1.60 >diff -u -r1.60 ImportTracePage1.java >--- src/org/eclipse/hyades/trace/ui/internal/wizard/ImportTracePage1.java 28 Jan 2008 16:33:09 -0000 1.60 >+++ src/org/eclipse/hyades/trace/ui/internal/wizard/ImportTracePage1.java 19 Feb 2008 14:31:28 -0000 >@@ -37,6 +37,7 @@ > import org.eclipse.hyades.execution.local.CommunicationDebug; > import org.eclipse.hyades.loaders.util.InvalidXMLException; > import org.eclipse.hyades.loaders.util.XMLLoader; >+import org.eclipse.hyades.loaders.util.binary.BinaryLoader; > import org.eclipse.hyades.models.hierarchy.TRCCollectionMode; > import org.eclipse.hyades.models.hierarchy.TRCMonitor; > import org.eclipse.hyades.models.hierarchy.util.MonitoredInputStream; >@@ -327,13 +328,13 @@ > try { > File log = new File(fInputLog); > >- if (!PDCoreUtil.isZipFile(fInputLog)) { >+ if (PDCoreUtil.isTBFFile(fInputLog)) { // TBF (binary) > InputStream readStream = new BufferedInputStream(new FileInputStream(log)); > logLength = log.length(); >- XMLLoader processor = getNewProcessor(); >+ XMLLoader processor = getNewProcessor(true); > processor.setCollectionMode(collectionMode); >- importFile(mon, processor, log, readStream, log.getAbsolutePath()); >- } else { >+ importFile(mon, processor, log, readStream, log.getAbsolutePath(), true); >+ } else if (PDCoreUtil.isZipFile(fInputLog)) { // Zipped XML > ZipFile zf = new ZipFile(log); > > Enumeration entries = zf.entries(); >@@ -344,12 +345,20 @@ > if (logLength < log.length()) > logLength = Long.MAX_VALUE; > >- XMLLoader processor = getNewProcessor(); >+ XMLLoader processor = getNewProcessor(false); > processor.setCollectionMode(collectionMode); >- importFile(mon, processor, log, zf.getInputStream(zipEntry), zipEntry.getName()); >+ importFile(mon, processor, log, zf.getInputStream(zipEntry), zipEntry.getName(), false); > if (CommunicationDebug.INSTANCE.debugUseEventMode) > processor.cleanUp(); > } >+ } else if (PDCoreUtil.isXMLFile(fInputLog)) { // XML >+ InputStream readStream = new BufferedInputStream(new FileInputStream(log)); >+ logLength = log.length(); >+ XMLLoader processor = getNewProcessor(false); >+ processor.setCollectionMode(collectionMode); >+ importFile(mon, processor, log, readStream, log.getAbsolutePath(), false); >+ } else { >+ throw new IOException("Invalid trace file format. Supported formats are XML and TBF (binary)"); > } > } catch (IOException e) { > fError = NLS.bind(TraceMessages.IMP_IOEXC, e.getMessage()); >@@ -359,8 +368,8 @@ > /** > * @return > */ >- private XMLLoader getNewProcessor() { >- XMLLoader processor = new XMLLoader(fMonitor); >+ private XMLLoader getNewProcessor(boolean binary) { >+ XMLLoader processor = binary ? new BinaryLoader(fMonitor) : new XMLLoader(fMonitor); > if (filterUI.getSelectedFilter() != null) { > processor.getContext().setImportFilter(filterUI.getSelectedFilter()); > processor.getContext().getFilterEngine().init(); >@@ -495,7 +504,7 @@ > FileDialog dlg = new FileDialog(sourceNameField.getShell()); > > dlg.setFilterPath(currentSource); >- dlg.setFilterExtensions(new String[] { "*.trcxml", "*.*" }); >+ dlg.setFilterExtensions(new String[] { "*.trcbin", "*.trcxml", "*.*" }); > dlg.open(); > > String fileName = dlg.getFileName(); >@@ -584,33 +593,36 @@ > } > } > >- private void importFile(IProgressMonitor mon, final XMLLoader processor, final File log, InputStream readStream, final String entryName) throws OutOfMemoryError { >+ private void importFile(IProgressMonitor mon, final XMLLoader processor, final File log, InputStream readStream, final String entryName, final boolean binary) throws OutOfMemoryError { > try { > if (!CommunicationDebug.INSTANCE.debugUseEventMode) { > > final MyBufferedInputStream inputStream = new MyBufferedInputStream(readStream,16*1024); >- inputStream.mark(1000); >- byte[] rootElement = new byte[1000]; >- rootElementRequired=false; >- try { >- int readBytes = inputStream.read(rootElement); >- String root = new String(rootElement,0,readBytes); >- root = root.toUpperCase(); >- if(root.indexOf("<TRACE>") !=-1 || root.indexOf("<COMMONBASEEVENTS ") !=-1 || root.indexOf("<COMMONBASEEVENTS>") !=-1) >- { >- rootElementRequired=false; >- } >- else >- { >- rootElementRequired=true; >+ if (!binary) { >+ inputStream.mark(1000); >+ byte[] rootElement = new byte[1000]; >+ rootElementRequired=false; >+ try { >+ int readBytes = inputStream.read(rootElement); >+ String root = new String(rootElement,0,readBytes); >+ root = root.toUpperCase(); >+ if(root.indexOf("<TRACE>") !=-1 || root.indexOf("<COMMONBASEEVENTS ") !=-1 || root.indexOf("<COMMONBASEEVENTS>") !=-1) >+ { >+ rootElementRequired=false; >+ } >+ else >+ { >+ rootElementRequired=true; >+ } >+ inputStream.reset(); >+ } catch (IOException e1) { >+ e1.printStackTrace(); > } >- inputStream.reset(); >- } catch (IOException e1) { >- e1.printStackTrace(); >+ >+ // TODO refuck it plz >+ if(rootElementRequired) >+ inputStream.addRootTRACEElement(); > } >- >- if(rootElementRequired) >- inputStream.addRootTRACEElement(); > final String jobName = MessageFormat.format(TraceWizardMessages.IMPORT_FILE, new String[] { "" + log.length(), log.getAbsolutePath() }); > final long entryLength = logLength == Long.MAX_VALUE ? log.length() * 10 : logLength; > Job job = new Job(jobName) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 209343
:
90067
|
90070
|
90455
|
90456
|
90762
|
93128
|
93129
|
93130
|
93131
|
93147
|
93149