|
Lines 32-37
Link Here
|
| 32 |
import org.eclipse.emf.common.util.EList; |
32 |
import org.eclipse.emf.common.util.EList; |
| 33 |
import org.eclipse.emf.common.util.URI; |
33 |
import org.eclipse.emf.common.util.URI; |
| 34 |
import org.eclipse.hyades.loaders.trace.TraceUtils; |
34 |
import org.eclipse.hyades.loaders.trace.TraceUtils; |
|
|
35 |
import org.eclipse.hyades.loaders.util.BinaryLoader; |
| 35 |
import org.eclipse.hyades.loaders.util.LoadersUtils; |
36 |
import org.eclipse.hyades.loaders.util.LoadersUtils; |
| 36 |
import org.eclipse.hyades.models.hierarchy.TRCAgentProxy; |
37 |
import org.eclipse.hyades.models.hierarchy.TRCAgentProxy; |
| 37 |
import org.eclipse.hyades.models.hierarchy.TRCCollectionMode; |
38 |
import org.eclipse.hyades.models.hierarchy.TRCCollectionMode; |
|
Lines 91-96
Link Here
|
| 91 |
import org.eclipse.tptp.platform.jvmti.client.internal.controlproviders.TIProcessControlProvider.TIProcessStateModifier; |
92 |
import org.eclipse.tptp.platform.jvmti.client.internal.controlproviders.TIProcessControlProvider.TIProcessStateModifier; |
| 92 |
import org.eclipse.tptp.platform.jvmti.client.internal.launcher.util.AgentControllerDelegate; |
93 |
import org.eclipse.tptp.platform.jvmti.client.internal.launcher.util.AgentControllerDelegate; |
| 93 |
import org.eclipse.tptp.platform.jvmti.client.internal.launcher.util.RunCommand; |
94 |
import org.eclipse.tptp.platform.jvmti.client.internal.launcher.util.RunCommand; |
|
|
95 |
import org.eclipse.tptp.platform.jvmti.client.internal.launcher.util.SetOutputFormatCommand; |
| 94 |
import org.eclipse.tptp.trace.ui.internal.launcher.core.AnalysisType; |
96 |
import org.eclipse.tptp.trace.ui.internal.launcher.core.AnalysisType; |
| 95 |
import org.eclipse.tptp.trace.ui.internal.launcher.core.AnalysisTypeManager; |
97 |
import org.eclipse.tptp.trace.ui.internal.launcher.core.AnalysisTypeManager; |
| 96 |
import org.eclipse.tptp.trace.ui.internal.launcher.core.DataCollectorManager; |
98 |
import org.eclipse.tptp.trace.ui.internal.launcher.core.DataCollectorManager; |
|
Lines 136-141
Link Here
|
| 136 |
private static final String CMD_APPLY_FILTERS = "applyFilters"; |
138 |
private static final String CMD_APPLY_FILTERS = "applyFilters"; |
| 137 |
private static final String CMD_APPLY_OPTIONS = "applyOptions"; |
139 |
private static final String CMD_APPLY_OPTIONS = "applyOptions"; |
| 138 |
private static final String CMD_COLLECT_DATA = "CollectData"; |
140 |
private static final String CMD_COLLECT_DATA = "CollectData"; |
|
|
141 |
private static final String CMD_SET_OUTPUT_FORMAT = "setOutputFormat"; |
| 139 |
|
142 |
|
| 140 |
/** Elements required to construct agent commands */ |
143 |
/** Elements required to construct agent commands */ |
| 141 |
private static final String ELEMENT_FILTER = "Filter"; |
144 |
private static final String ELEMENT_FILTER = "Filter"; |
|
Lines 145-150
Link Here
|
| 145 |
|
148 |
|
| 146 |
/** Attributes required to construct agent commands */ |
149 |
/** Attributes required to construct agent commands */ |
| 147 |
private static final String ATTRIBUTE_IID = "iid"; |
150 |
private static final String ATTRIBUTE_IID = "iid"; |
|
|
151 |
|
| 148 |
|
152 |
|
| 149 |
/** The executable that's run */ |
153 |
/** The executable that's run */ |
| 150 |
protected static final String EXEC_JAVA = "java.exe"; |
154 |
protected static final String EXEC_JAVA = "java.exe"; |
|
Lines 732-747
Link Here
|
| 732 |
return null; |
736 |
return null; |
| 733 |
} |
737 |
} |
| 734 |
|
738 |
|
|
|
739 |
static class SetOutputFormatHandler implements ICommandHandler { |
| 740 |
|
| 741 |
private final Object lock = new Object(); |
| 742 |
|
| 743 |
private String format = SetOutputFormatCommand.XML_FORMAT; |
| 744 |
|
| 745 |
public String getFormat() { |
| 746 |
return format; |
| 747 |
} |
| 748 |
|
| 749 |
public Object getLock() { |
| 750 |
return lock; |
| 751 |
} |
| 752 |
|
| 753 |
public void incomingCommand(INode node, ICommandElement command) { |
| 754 |
String commandStr = new String(((CommandFragment) command) |
| 755 |
.getCommandData()); |
| 756 |
if (Constants.TPTP_DEBUG) |
| 757 |
System.out.println("The Agent response - " + commandStr); |
| 758 |
TPTPXMLParse ParseObj = new TPTPXMLParse(); |
| 759 |
ParseObj.setParser(commandStr); |
| 760 |
Hashtable CommandHash = ParseObj.getHashTable(); |
| 761 |
if (CommandHash.containsKey(SetOutputFormatCommand.FORMAT_ELEMENT)) { |
| 762 |
format = (String) CommandHash.get(SetOutputFormatCommand.FORMAT_ELEMENT); |
| 763 |
} else { |
| 764 |
format = SetOutputFormatCommand.XML_FORMAT; |
| 765 |
} |
| 766 |
|
| 767 |
synchronized(lock) { |
| 768 |
lock.notifyAll(); |
| 769 |
} |
| 770 |
} |
| 771 |
} |
| 772 |
|
| 735 |
public static void configureDataProcessor(ILaunchConfiguration launchConfiguration, TRCAgentProxy agentProxy, ICollector tiAgent) throws CoreException |
773 |
public static void configureDataProcessor(ILaunchConfiguration launchConfiguration, TRCAgentProxy agentProxy, ICollector tiAgent) throws CoreException |
| 736 |
{ |
774 |
{ |
| 737 |
/* Start the data collection process */ |
775 |
/* Start the data collection process */ |
| 738 |
ACDataProcessorAdapter dataProcessor = (ACDataProcessorAdapter) LoadersUtils.locateDataProcessor(agentProxy); |
|
|
| 739 |
|
776 |
|
| 740 |
if (dataProcessor == null) |
777 |
ACDataProcessorAdapter dataProcessor; |
| 741 |
{ |
778 |
SetOutputFormatHandler handler = new SetOutputFormatHandler(); |
| 742 |
dataProcessor = new ACDataProcessorAdapter(agentProxy); |
779 |
// Possible enhancement: let user choose the format from UI |
| 743 |
LoadersUtils.registerDataProcessor(agentProxy, dataProcessor); |
780 |
SetOutputFormatCommand command = new SetOutputFormatCommand(SetOutputFormatCommand.BINARY_FORMAT); |
| 744 |
} |
781 |
|
|
|
782 |
synchronized(handler.getLock()) { |
| 783 |
try { |
| 784 |
tiAgent.sendCommand(command.buildCommand(), handler); |
| 785 |
handler.getLock().wait(); |
| 786 |
} catch (InactiveAgentException e) { |
| 787 |
e.printStackTrace(); |
| 788 |
} catch (NotConnectedException e) { |
| 789 |
e.printStackTrace(); |
| 790 |
} catch (InterruptedException e) { |
| 791 |
e.printStackTrace(); |
| 792 |
} |
| 793 |
} |
| 794 |
|
| 795 |
if (SetOutputFormatCommand.XML_FORMAT.equals(handler.getFormat())) { |
| 796 |
dataProcessor = (ACDataProcessorAdapter) LoadersUtils.locateDataProcessor(agentProxy); |
| 797 |
if (dataProcessor == null) |
| 798 |
{ |
| 799 |
dataProcessor = new ACDataProcessorAdapter(agentProxy); |
| 800 |
LoadersUtils.registerDataProcessor(agentProxy, dataProcessor); |
| 801 |
} |
| 802 |
} else { // Binary format |
| 803 |
dataProcessor = new BFDataProcessorAdapter(agentProxy); |
| 804 |
} |
| 745 |
|
805 |
|
| 746 |
/* Does the data need to be forwarded to a file? */ |
806 |
/* Does the data need to be forwarded to a file? */ |
| 747 |
boolean isProfileToLaunch = launchConfiguration == null ? agentProxy.isToProfileFile() : launchConfiguration.getAttribute(IProfileLaunchConfigurationConstants.ATTR_PROFILE_TO_FILE, false); |
807 |
boolean isProfileToLaunch = launchConfiguration == null ? agentProxy.isToProfileFile() : launchConfiguration.getAttribute(IProfileLaunchConfigurationConstants.ATTR_PROFILE_TO_FILE, false); |
|
Lines 1477-1482
Link Here
|
| 1477 |
super(agentProxy); |
1537 |
super(agentProxy); |
| 1478 |
processAlive = true; |
1538 |
processAlive = true; |
| 1479 |
enabled = true; |
1539 |
enabled = true; |
|
|
1540 |
BinaryLoader bfLoader = this; |
| 1541 |
bfLoader.setLoadXml(true); |
| 1480 |
} |
1542 |
} |
| 1481 |
|
1543 |
|
| 1482 |
public void incomingData(byte[] buffer, int length, InetAddress peer) |
1544 |
public void incomingData(byte[] buffer, int length, InetAddress peer) |
|
Lines 1495-1501
Link Here
|
| 1495 |
super.incommingData(buffer, length, peer); |
1557 |
super.incommingData(buffer, length, peer); |
| 1496 |
} |
1558 |
} |
| 1497 |
|
1559 |
|
| 1498 |
private void preIncomingData() |
1560 |
protected void preIncomingData() |
| 1499 |
{ |
1561 |
{ |
| 1500 |
if (!processAlive) |
1562 |
if (!processAlive) |
| 1501 |
activity++; |
1563 |
activity++; |
|
Lines 1527-1532
Link Here
|
| 1527 |
} |
1589 |
} |
| 1528 |
} |
1590 |
} |
| 1529 |
|
1591 |
|
|
|
1592 |
public static class BFDataProcessorAdapter extends ACDataProcessorAdapter { |
| 1593 |
|
| 1594 |
public BFDataProcessorAdapter(TRCAgentProxy agentProxy) { |
| 1595 |
super(agentProxy); |
| 1596 |
BinaryLoader bfLoader = this; |
| 1597 |
bfLoader.setLoadXml(false); |
| 1598 |
} |
| 1599 |
|
| 1600 |
protected void loadEventHook(byte[] buffer, int offset, int length) { |
| 1601 |
loadEvent(buffer, offset, length); |
| 1602 |
} |
| 1603 |
|
| 1604 |
} |
| 1605 |
|
| 1530 |
|
1606 |
|
| 1531 |
/** |
1607 |
/** |
| 1532 |
* A dummy command handler that doesn't do anything in response to a command |
1608 |
* A dummy command handler that doesn't do anything in response to a command |
|
Lines 1688-1692
Link Here
|
| 1688 |
} |
1764 |
} |
| 1689 |
} |
1765 |
} |
| 1690 |
|
1766 |
|
| 1691 |
|
|
|
| 1692 |
} |
1767 |
} |