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 93130 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]
Handshaking protocol
org.eclipse.tptp.platform.jvmti.client_patch.txt (text/plain), 9.30 KB, created by
Stanislav Polevic
on 2008-03-21 09:50:18 EDT
(
hide
)
Description:
Handshaking protocol
Filename:
MIME Type:
Creator:
Stanislav Polevic
Created:
2008-03-21 09:50:18 EDT
Size:
9.30 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.tptp.platform.jvmti.client >Index: src/org/eclipse/tptp/platform/jvmti/client/internal/launcher/TIDelegateHelper.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.client/src/org/eclipse/tptp/platform/jvmti/client/internal/launcher/TIDelegateHelper.java,v >retrieving revision 1.67 >diff -u -r1.67 TIDelegateHelper.java >--- src/org/eclipse/tptp/platform/jvmti/client/internal/launcher/TIDelegateHelper.java 11 Mar 2008 12:10:31 -0000 1.67 >+++ src/org/eclipse/tptp/platform/jvmti/client/internal/launcher/TIDelegateHelper.java 21 Mar 2008 13:28:01 -0000 >@@ -32,6 +32,7 @@ > import org.eclipse.emf.common.util.EList; > import org.eclipse.emf.common.util.URI; > import org.eclipse.hyades.loaders.trace.TraceUtils; >+import org.eclipse.hyades.loaders.util.BinaryLoader; > import org.eclipse.hyades.loaders.util.LoadersUtils; > import org.eclipse.hyades.models.hierarchy.TRCAgentProxy; > import org.eclipse.hyades.models.hierarchy.TRCCollectionMode; >@@ -91,6 +92,7 @@ > import org.eclipse.tptp.platform.jvmti.client.internal.controlproviders.TIProcessControlProvider.TIProcessStateModifier; > import org.eclipse.tptp.platform.jvmti.client.internal.launcher.util.AgentControllerDelegate; > import org.eclipse.tptp.platform.jvmti.client.internal.launcher.util.RunCommand; >+import org.eclipse.tptp.platform.jvmti.client.internal.launcher.util.SetOutputFormatCommand; > import org.eclipse.tptp.trace.ui.internal.launcher.core.AnalysisType; > import org.eclipse.tptp.trace.ui.internal.launcher.core.AnalysisTypeManager; > import org.eclipse.tptp.trace.ui.internal.launcher.core.DataCollectorManager; >@@ -136,6 +138,7 @@ > private static final String CMD_APPLY_FILTERS = "applyFilters"; > private static final String CMD_APPLY_OPTIONS = "applyOptions"; > private static final String CMD_COLLECT_DATA = "CollectData"; >+ private static final String CMD_SET_OUTPUT_FORMAT = "setOutputFormat"; > > /** Elements required to construct agent commands */ > private static final String ELEMENT_FILTER = "Filter"; >@@ -145,6 +148,7 @@ > > /** Attributes required to construct agent commands */ > private static final String ATTRIBUTE_IID = "iid"; >+ > > /** The executable that's run */ > protected static final String EXEC_JAVA = "java.exe"; >@@ -732,16 +736,72 @@ > return null; > } > >+ static class SetOutputFormatHandler implements ICommandHandler { >+ >+ private final Object lock = new Object(); >+ >+ private String format = SetOutputFormatCommand.XML_FORMAT; >+ >+ public String getFormat() { >+ return format; >+ } >+ >+ public Object getLock() { >+ return lock; >+ } >+ >+ public void incomingCommand(INode node, ICommandElement command) { >+ String commandStr = new String(((CommandFragment) command) >+ .getCommandData()); >+ if (Constants.TPTP_DEBUG) >+ System.out.println("The Agent response - " + commandStr); >+ TPTPXMLParse ParseObj = new TPTPXMLParse(); >+ ParseObj.setParser(commandStr); >+ Hashtable CommandHash = ParseObj.getHashTable(); >+ if (CommandHash.containsKey(SetOutputFormatCommand.FORMAT_ELEMENT)) { >+ format = (String) CommandHash.get(SetOutputFormatCommand.FORMAT_ELEMENT); >+ } else { >+ format = SetOutputFormatCommand.XML_FORMAT; >+ } >+ >+ synchronized(lock) { >+ lock.notifyAll(); >+ } >+ } >+ } >+ > public static void configureDataProcessor(ILaunchConfiguration launchConfiguration, TRCAgentProxy agentProxy, ICollector tiAgent) throws CoreException > { > /* Start the data collection process */ >- ACDataProcessorAdapter dataProcessor = (ACDataProcessorAdapter) LoadersUtils.locateDataProcessor(agentProxy); > >- if (dataProcessor == null) >- { >- dataProcessor = new ACDataProcessorAdapter(agentProxy); >- LoadersUtils.registerDataProcessor(agentProxy, dataProcessor); >- } >+ ACDataProcessorAdapter dataProcessor; >+ SetOutputFormatHandler handler = new SetOutputFormatHandler(); >+ // Possible enhancement: let user choose the format from UI >+ SetOutputFormatCommand command = new SetOutputFormatCommand(SetOutputFormatCommand.XML_FORMAT); >+ >+ synchronized(handler.getLock()) { >+ try { >+ tiAgent.sendCommand(command.buildCommand(), handler); >+ handler.getLock().wait(); >+ } catch (InactiveAgentException e) { >+ e.printStackTrace(); >+ } catch (NotConnectedException e) { >+ e.printStackTrace(); >+ } catch (InterruptedException e) { >+ e.printStackTrace(); >+ } >+ } >+ >+ if (SetOutputFormatCommand.XML_FORMAT.equals(handler.getFormat())) { >+ dataProcessor = (ACDataProcessorAdapter) LoadersUtils.locateDataProcessor(agentProxy); >+ if (dataProcessor == null) >+ { >+ dataProcessor = new ACDataProcessorAdapter(agentProxy); >+ LoadersUtils.registerDataProcessor(agentProxy, dataProcessor); >+ } >+ } else { // Binary format >+ dataProcessor = new BFDataProcessorAdapter(agentProxy); >+ } > > /* Does the data need to be forwarded to a file? */ > boolean isProfileToLaunch = launchConfiguration == null ? agentProxy.isToProfileFile() : launchConfiguration.getAttribute(IProfileLaunchConfigurationConstants.ATTR_PROFILE_TO_FILE, false); >@@ -1477,6 +1537,8 @@ > super(agentProxy); > processAlive = true; > enabled = true; >+ BinaryLoader bfLoader = this; >+ bfLoader.setLoadXml(true); > } > > public void incomingData(byte[] buffer, int length, InetAddress peer) >@@ -1495,7 +1557,7 @@ > super.incommingData(buffer, length, peer); > } > >- private void preIncomingData() >+ protected void preIncomingData() > { > if (!processAlive) > activity++; >@@ -1527,6 +1589,20 @@ > } > } > >+ public static class BFDataProcessorAdapter extends ACDataProcessorAdapter { >+ >+ public BFDataProcessorAdapter(TRCAgentProxy agentProxy) { >+ super(agentProxy); >+ BinaryLoader bfLoader = this; >+ bfLoader.setLoadXml(false); >+ } >+ >+ protected void loadEventHook(byte[] buffer, int offset, int length) { >+ loadEvent(buffer, offset, length); >+ } >+ >+ } >+ > > /** > * A dummy command handler that doesn't do anything in response to a command >@@ -1688,5 +1764,4 @@ > } > } > >- > } >Index: src/org/eclipse/tptp/platform/jvmti/client/internal/launcher/util/SetOutputFormatCommand.java >=================================================================== >RCS file: src/org/eclipse/tptp/platform/jvmti/client/internal/launcher/util/SetOutputFormatCommand.java >diff -N src/org/eclipse/tptp/platform/jvmti/client/internal/launcher/util/SetOutputFormatCommand.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/platform/jvmti/client/internal/launcher/util/SetOutputFormatCommand.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,82 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 Intel Corporation. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Stanislav Polevic, Intel - Initial API and Implementation >+ * >+ * $Id: >+ *******************************************************************************/ >+package org.eclipse.tptp.platform.jvmti.client.internal.launcher.util; >+ >+import org.eclipse.tptp.platform.execution.util.internal.CommandElement; >+import org.eclipse.tptp.platform.jvmti.client.internal.TIConstants; >+ >+/** >+ * The run command is used to run agent. >+ */ >+public class SetOutputFormatCommand extends CommandElement { >+ >+ /** Output formats */ >+ public static final String BINARY_FORMAT = "binary"; >+ public static final String XML_FORMAT = "xml"; >+ >+ public static final String FORMAT_ELEMENT = "format"; >+ >+ private static final String SET_OUTPUT_FORMAT_COMMAND = "setOutputFormat"; >+ >+ >+ private final String outputFormat; >+ >+ >+ /** >+ * >+ */ >+ public SetOutputFormatCommand(String outputFormat) { >+ this.outputFormat = outputFormat; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.tptp.platform.execution.util.internal.CommandElement#getSize() >+ */ >+ public int getSize() { >+ return 0; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.tptp.platform.execution.util.internal.CommandElement#readFromBuffer(byte[], int) >+ */ >+ public int readFromBuffer(byte[] buffer, int offset) { >+ return 0; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.tptp.platform.execution.util.internal.CommandElement#writeToBuffer(byte[], int) >+ */ >+ public int writeToBuffer(byte[] buffer, int offset) { >+ return 0; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.tptp.platform.execution.util.internal.CommandElement#buildCommand() >+ */ >+ public String buildCommand() { >+ StringBuffer sbuf = new StringBuffer(); >+ sbuf.append("<"); >+ sbuf.append(SET_OUTPUT_FORMAT_COMMAND + " iid=\""); >+ sbuf.append(TIConstants.TI_AGENT_NAME + "\""); >+ sbuf.append("><"); >+ sbuf.append(FORMAT_ELEMENT); >+ sbuf.append(">"); >+ sbuf.append(outputFormat); >+ sbuf.append("</"); >+ sbuf.append(FORMAT_ELEMENT); >+ sbuf.append(">"); >+ sbuf.append("</" + SET_OUTPUT_FORMAT_COMMAND + ">"); >+ return sbuf.toString(); >+ } >+ >+}
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