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 76860 Details for
Bug 148461
Dynamic discovery feature needs testing with the TPTP ARM tech preview
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]
Patch for Process listener
dynpatch.txt (text/plain), 13.48 KB, created by
Ashish Patel
on 2007-08-24 00:36:12 EDT
(
hide
)
Description:
Patch for Process listener
Filename:
MIME Type:
Creator:
Ashish Patel
Created:
2007-08-24 00:36:12 EDT
Size:
13.48 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.tptp.platform.instrumentation.ui >Index: src/org/eclipse/tptp/platform/instrumentation/ui/internal/launcher/deleg/application/InstrumentAttachDelegate.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.instrumentation.ui/src/org/eclipse/tptp/platform/instrumentation/ui/internal/launcher/deleg/application/InstrumentAttachDelegate.java,v >retrieving revision 1.1 >diff -u -r1.1 InstrumentAttachDelegate.java >--- src/org/eclipse/tptp/platform/instrumentation/ui/internal/launcher/deleg/application/InstrumentAttachDelegate.java 28 Jun 2007 15:18:28 -0000 1.1 >+++ src/org/eclipse/tptp/platform/instrumentation/ui/internal/launcher/deleg/application/InstrumentAttachDelegate.java 24 Aug 2007 04:37:49 -0000 >@@ -124,7 +124,7 @@ > > LoadersUtils.registerAgentListener(agentProxy, listener); > listener.setLaunchMode(InstrumentProcessListener.ATTACH_LAUNCH_MODE); >- listener.addAgentAttach(agent, agentProxy); >+ listener.setCollectionMode(agent, agentProxy); > process.addProcessListener(listener); > agent.addAgentListener(listener); > >Index: src/org/eclipse/tptp/platform/instrumentation/ui/internal/launcher/listener/InstrumentProcessListener.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.instrumentation.ui/src/org/eclipse/tptp/platform/instrumentation/ui/internal/launcher/listener/InstrumentProcessListener.java,v >retrieving revision 1.12 >diff -u -r1.12 InstrumentProcessListener.java >--- src/org/eclipse/tptp/platform/instrumentation/ui/internal/launcher/listener/InstrumentProcessListener.java 22 May 2007 18:57:27 -0000 1.12 >+++ src/org/eclipse/tptp/platform/instrumentation/ui/internal/launcher/listener/InstrumentProcessListener.java 24 Aug 2007 04:37:49 -0000 >@@ -20,6 +20,8 @@ > import java.util.ArrayList; > import java.util.HashMap; > import java.util.Iterator; >+import java.util.List; >+import java.util.Vector; > > import org.eclipse.core.resources.IResourceStatus; > import org.eclipse.core.resources.ResourcesPlugin; >@@ -36,8 +38,10 @@ > import org.eclipse.hyades.internal.execution.local.control.Agent; > import org.eclipse.hyades.internal.execution.local.control.AgentConfiguration; > import org.eclipse.hyades.internal.execution.local.control.AgentListener; >+import org.eclipse.hyades.internal.execution.local.control.AgentPeerListener; > import org.eclipse.hyades.internal.execution.local.control.InactiveAgentException; > import org.eclipse.hyades.internal.execution.local.control.InactiveProcessException; >+import org.eclipse.hyades.internal.execution.local.control.Node; > import org.eclipse.hyades.internal.execution.local.control.Process; > import org.eclipse.hyades.internal.execution.local.control.ProcessImpl; > import org.eclipse.hyades.internal.execution.local.control.ProcessListener; >@@ -51,15 +55,20 @@ > import org.eclipse.hyades.models.hierarchy.util.EMFUtil; > import org.eclipse.hyades.models.hierarchy.util.SaveUtil; > import org.eclipse.hyades.trace.ui.ProfileEvent; >+import org.eclipse.hyades.trace.ui.ProfileUIManager; > import org.eclipse.hyades.trace.ui.UIPlugin; >+import org.eclipse.hyades.trace.ui.internal.util.AttachConfigurationDetail; > import org.eclipse.hyades.trace.ui.internal.util.PDCoreUtil; > import org.eclipse.hyades.trace.ui.internal.util.TString; > import org.eclipse.hyades.trace.ui.internal.util.TraceMessages; > import org.eclipse.jface.dialogs.ErrorDialog; >+import org.eclipse.jface.preference.IPreferenceStore; > import org.eclipse.osgi.util.NLS; > import org.eclipse.swt.widgets.Display; > import org.eclipse.swt.widgets.Shell; >+import org.eclipse.tptp.platform.common.internal.CommonPlugin; > import org.eclipse.tptp.platform.common.ui.internal.CommonUIConstants; >+import org.eclipse.tptp.platform.common.ui.trace.internal.CommonUITraceConstants; > import org.eclipse.tptp.platform.instrumentation.ui.internal.InstrumentConstants; > import org.eclipse.tptp.platform.instrumentation.ui.internal.LogHelper; > import org.eclipse.tptp.platform.instrumentation.ui.internal.launcher.DummyDataProcessor; >@@ -75,7 +84,7 @@ > * @since TPTP 4.2 > */ > public class InstrumentProcessListener implements ProcessListener, >- AgentListener { >+ AgentListener, AgentPeerListener { > > public static final int ATTACH_LAUNCH_MODE = 0; > public static final int NORMAL_LAUNCH_MODE = 1; >@@ -130,13 +139,7 @@ > * @param process the trc process proxy > */ > public InstrumentProcessListener(TRCNode node, TRCProcessProxy process) { >- trcNode = node; >- trcProcessProxy = process; >- showAgents = new ArrayList(); >- fileList = new ArrayList(); >- agentProxyMap = new HashMap(); >- armAnlysisType = false; >- profileOnServer = false; >+ this(node, process, null); > } > > /** >@@ -156,6 +159,160 @@ > armAnlysisType = false; > } > >+ /* >+ * (non-Javadoc) >+ * @see org.eclipse.hyades.trace.ui.internal.piclient.PIProcessListener#peerWaiting(org.eclipse.hyades.internal.execution.local.control.Agent, org.eclipse.hyades.internal.execution.local.control.Agent) >+ */ >+ public synchronized void peerWaiting(Agent agent, Agent peer) { >+ /* >+ * Check if we're already attached to this agent. If so, >+ * don't try to attach again. >+ */ >+ if (!peer.isAttached() && trcProcessProxy != null && trcProcessProxy.getNode() != null) { >+ /* >+ * Find the TRCAgentProxy associated with the agent, in >+ * order to match the settings on the new TRCAgentProxy. >+ */ >+ TRCAgentProxy trcAgent = null; >+ Iterator iter = trcProcessProxy.getAgentProxies().iterator(); >+ while (iter.hasNext()) { >+ TRCAgentProxy agentProxy = (TRCAgentProxy)iter.next(); >+ Object obj = LoadersUtils.locateAgentInstance(agentProxy); >+ if (obj == agent) { >+ trcAgent = agentProxy; >+ break; >+ } >+ } >+ >+ /* >+ * Set the default project, monitor, and profile file. >+ */ >+ IPreferenceStore store = UIPlugin.getDefault().getPreferenceStore(); >+ String projectName = store.getString(CommonUITraceConstants.TRACE_PROJECT_NAME); >+ String monitorName = store.getString(CommonUITraceConstants.TRACE_MONITOR_NAME); >+ >+ // bug 95689: if agent is currently profile to file, the peer agent will also be profile to file. >+ String profileFile = (agent!=null? agent.getProfileFile():null); >+ String peerProfileFile = null; >+ if (profileFile!=null) { >+ >+ StringBuffer suffix = new StringBuffer().append("_"). >+ append(trcAgent.getProcessProxy().getNode().getName()).append("_"). >+ append(trcAgent.getProcessProxy().getPid()).append("_"). >+ append(trcAgent.getRuntimeId()).append(".trcxml"); //$NON-NLS-1$ >+ >+ int ext = profileFile.lastIndexOf(".trcxml"); //$NON-NLS-1$ >+ if (ext>0) { >+ peerProfileFile = new StringBuffer(profileFile.substring(0,ext)).append(suffix).toString(); >+ } >+ else { >+ peerProfileFile = new StringBuffer(profileFile).append(suffix).toString(); >+ } >+ } >+ >+ /* >+ * If the peer agent can be found, match the values on the >+ * newly discovered agent. >+ */ >+ if (trcAgent != null) { >+ TRCProcessProxy trcProcess = trcAgent.getProcessProxy(); >+ if (trcProcess != null) { >+ TRCNode trcNode = trcProcess.getNode(); >+ if (trcNode != null) { >+ TRCMonitor trcMonitor = trcNode.getMonitor(); >+ if (trcMonitor != null) { >+// IResource folder = HyadesUtil.getSelectionFolder(trcMonitor); >+ URI projectPath = trcMonitor.eResource().getURI(); >+ String fullProjectPath = projectPath.trimSegments(1).path(); >+ fullProjectPath = fullProjectPath.substring(fullProjectPath.indexOf('/', 1)); >+ fullProjectPath = fullProjectPath.replaceAll("%20", " "); >+ if (fullProjectPath != null) { >+ monitorName = trcMonitor.getName(); >+ projectName = fullProjectPath; >+ } >+ } >+ } >+ } >+ } >+ >+ try { >+ Node node = peer.getProcess().getNode(); >+ final String hostname = node.getName(); >+ String port = String.valueOf(node.getConnection().getPort()); >+ Vector agents = new Vector(); >+ agents.add(peer); >+ >+ /* >+ * Add Analysis Type >+ */ >+ LauncherUtility.associateAnalysisType(peer, InstrumentConstants.ARM_ANALYSIS_TYPE); >+ >+ /* >+ * Copy the agent options to the newly discovered >+ * agent. >+ */ >+ Vector options = new Vector(); >+ AgentConfiguration conf = agent.getConfiguration(); >+ for (int i=0;i<conf.size();++i) { >+ options.add(conf.getEntryAt(i)); >+ } >+ >+ /* >+ * Force the connection to be established before attaching. >+ * This will avoid the delay in re-establishing when start >+ * monitoring, which freezes the UI. >+ */ >+ PDCoreUtil.profileConnect(hostname, port); >+ >+ /* >+ * Attach to the newly discovered agent. >+ */ >+ AttachConfigurationDetail attachConfigurationDetail = new AttachConfigurationDetail(); >+ attachConfigurationDetail.setHostName(hostname); >+ attachConfigurationDetail.setAgents(agents); >+ attachConfigurationDetail.setOptions(options); >+ attachConfigurationDetail.setProject(projectName); >+ attachConfigurationDetail.setMonitor(monitorName); >+ attachConfigurationDetail.setPortNumber(port); >+ attachConfigurationDetail.setProfileFile(peerProfileFile); >+ attachConfigurationDetail.setSwitchPerspective(false); >+ >+ List trcAgents = PDCoreUtil.attach(attachConfigurationDetail); >+ >+ if (trcAgents != null) >+ { >+ for (int i = 0, agentsCount = trcAgents.size(); i < agentsCount; i++) >+ { >+ TRCAgentProxy currentAgentProxy = (TRCAgentProxy)trcAgents.get(i); >+ Object currentAgent = LoadersUtils.locateAgentInstance(currentAgentProxy); >+ if (currentAgent instanceof Agent) >+ { >+ /* Set Collection mode */ >+ setCollectionMode((Agent)currentAgent, currentAgentProxy); >+ >+ /* attach */ >+ PDCoreUtil.doAttach((Agent)currentAgent, currentAgentProxy); >+ } >+ } >+ >+ if (trcAgents.size() == 1) { >+ final Object obj = trcAgents.get(0); >+ if (obj instanceof TRCAgentProxy) { >+ Display.getDefault().syncExec(new Runnable() { >+ public void run() { >+ ProfileUIManager.getInstance().startMonitoring((TRCAgentProxy)obj); >+ } >+ }); >+ } >+ } >+ } >+ } >+ catch (Exception e) { >+ CommonPlugin.logError(e); >+ } >+ } >+ } >+ > /** > * Invoked when a process is exited. > * >@@ -341,7 +498,7 @@ > * > * @param agent The agent > */ >- public void addAgentAttach(Agent agent, TRCAgentProxy agentProxy) { >+ public void setCollectionMode(Agent agent, TRCAgentProxy agentProxy) { > agentProxy.setCollectionMode(TRCCollectionMode.HEAP_AND_EXECUTION_FULL_LITERAL); > agentProxy.getAgent().setCollectionMode(TRCCollectionMode.HEAP_AND_EXECUTION_FULL_LITERAL); > } >#P org.eclipse.hyades.trace.ui >Index: src/org/eclipse/tptp/trace/ui/internal/launcher/core/LauncherUtility.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.trace.ui/src/org/eclipse/tptp/trace/ui/internal/launcher/core/LauncherUtility.java,v >retrieving revision 1.25 >diff -u -r1.25 LauncherUtility.java >--- src/org/eclipse/tptp/trace/ui/internal/launcher/core/LauncherUtility.java 19 Jun 2007 22:18:47 -0000 1.25 >+++ src/org/eclipse/tptp/trace/ui/internal/launcher/core/LauncherUtility.java 24 Aug 2007 04:37:51 -0000 >@@ -1023,7 +1023,17 @@ > * @return The configuration entry that is associated with the agent. > */ > public static AgentConfigurationEntry associateAnalysisType(Agent agent, String id) >- { >+ { >+ String name = LauncherConstants.ANALYSIS_TYPE_ASSOCIATION + "(" + id + ")"; >+ String value = id; >+ >+ /* return existing analysis type if it exists */ >+ for (int i=0; agent != null && i < agent.getConfiguration().size(); i++) { >+ AgentConfigurationEntry entry = agent.getConfiguration().getEntryAt(i); >+ if (entry.getName().equals(name) && entry.getValue().equals(value)) >+ return entry; >+ } >+ > AgentConfigurationEntry entry = createAgentConfigurationEntry(LauncherConstants.ANALYSIS_TYPE_ASSOCIATION + "(" + id + ")", id); > if (agent != null) > agent.getConfiguration().addEntry(entry);
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 148461
:
75786
|
75798
|
76255
| 76860