Overview

This is a simple example to illustrate an end-to-end trace of a simple RMI-IIOP program. The example consists of three parts: an interface (IService), a server (Server), and a client (Client). The function of the interface is twofolds: to inform a client of what services to expect, and to inform a server of what services are to be implemented. In this case, the server provides a "hello" service and an "add" service.

About Instrumentation

Two types of instrumentation exist: the transport instrumentation to intercept IIOP requests using predefined hooks, and entry/exit instrumentation. As can be seen in the source code of the client and server, entry/exit instrumentation is done manually by inserting the probes at the beginning and the end of each function. These should be replaced with real probes.

Installation

Open a workbench, switch to the Java perspective, and choose New -> Example -> Distributed Trace Sample" -> "Simple RMI Client Server". Then, choose "Next", followed by "Finish". The program should be installed under the project rmi-iiop.

Compilation

The compilation is most done automatically by the workbench, except for the stubs and ties. A sample stub and tie have already been included in the sample code, and should therefore be compiled automatically as well. Should there be a need for regenerating the stub and the tie, a user must do so manually. Although the commands for generating them are often VM-dependent, one could in general use rmic -iiop -poa org.eclipse.hyades.execution.trace.sample.Server Of course, the class path needs to be set correctly, and must contain the following plugins: org.eclipse.hyades.execution.correlation org.eclipse.hyades.execution.remote

Execution

A name service is required for the bootstrap process. ALthough this command is usually vendor-specific, one could in general use tnameserv -ORBInitailPort 6502
Choose the "Run" -> "Run" -> "Java Application" -> "Server" configuration, and click "Run". Choose the "Profile" -> "Attach" -> "Java Process" -> "Unknown" -> "Distributed Trace Profiler", and double-click on the agent to move it to the "Selected agents" window. Click "Next", and then optionally check the "Send profiling data to a file" box. If this box is checked, a filemame will be required for storing the profiling data. Otherwise, the profiling data will simply be print to the standout output. Finally, click "Finish", at which point the message Please attach to the server agent and press [Enter] to start profiling... should be seen in the console. Right-click on the agent in the "Profiling Monitor" window, and then choose "Start Monitoring" from the context menu. Move the focus back to the "Console" window, and press "Enter" to continue. At this point, an additional message RMI-IIOP Sample Server ready... should be displayed in the console. If you chose to use the standard output for the profiling data, program output and profiling data will be interleaved.

Launch and profile the client in a nearly identical fashion. The output from the client program should be

Please attach to the client agent and press [Enter] to start profiling... Greetings from the server: Hello [localhost_name]! Addition: 5 + 17 = 22 where [localhost_name] is the name of the machine on which the code was running.


Cleanup

The client terminates after a signle invocation, and therefore does not require a manual termination. The server continues to run, and therefore must be terminated explicitly. To do this, in the profiling or debug perspective, right-click on the Server process, and choose terminate.

Limitations

Due to the limited amount of information about requests in the org.omg.PortableInterceptor.ServerRequestInfo interface, and due to the need to keep the framework sufficiently generic, some class types during the IIOP transport cannot be determined properly. These classes are shown as javax.rmi.CORBA.Tie, but should really be _<classname>_Tie. Consequently, any relevant statistics are wrong. Another piece of information missing is the method signatures during the IIOP transport, and they are left out.

Sample Traces

Here are two sample traces produced from the a client and a server. The server trace is as follows: <?xml version="1.0"?> <TRACE> <agentCreate agentId="d3fbc56b-bd31-4d28-88bd-a344aff21854" processIdRef="40aa9f98-ce86-47fe-a026-d94123c460fb" nodeIdRef="d3fbc56b-bd31-4d28-88bd-a344aff21854" agentName="Distributed Trace Profiler" time="1064348580.203" /> <traceStart traceId="1233733286" agentIdRef="d3fbc56b-bd31-4d28-88bd-a344aff21854" time="1064348630.141" /> <threadStart threadId="1" time="1064348630.141" /> <classDef classId="1" name="org.eclipse.hyades.execution.trace.sample.Server" threadIdRef="1" time="1064348630.141" /> <objAlloc objId="1" threadIdRef="1" time="1064348630.141" classIdRef="1" /> <methodDef name="main" signature="([Ljava.lang.String;)V" classIdRef="1" methodId="1" /> <parameterDef parameterId="1" type="[Ljava.lang.String;" methodIdRef="1" index="0" name="args" /> <methodEntry objIdRef="1" methodIdRef="1" threadIdRef="1" time="1064348630.156" ticket="1" sequenceCounter="1"> <parameter parameterIdRef="1"> <arrayElement index="0" value="RMI-IIOP" /> <arrayElement index="1" value="Server" /> </parameter> </methodEntry> <objAlloc objId="2" threadIdRef="1" time="1064348630.344" classIdRef="1" /> <methodDef name="Server" signature="()" classIdRef="1" methodId="2" /> <methodEntry objIdRef="2" methodIdRef="2" threadIdRef="1" time="1064348630.344" ticket="2" sequenceCounter="2" /> <methodExit objIdRef="2" methodIdRef="2" threadIdRef="1" time="1064348630.344" ticket="3" sequenceCounter="2" /> <classDef classId="2" name="javax.naming.InitialContext" threadIdRef="1" time="1064348630.406" /> <objAlloc objId="3" threadIdRef="1" time="1064348630.406" classIdRef="2" /> <methodDef name="rebind" signature="(Ljava.lang.String;Lcom.ibm.org.omg.CORBA._ObjectStub;)V" classIdRef="2" methodId="3" /> <parameterDef parameterId="2" type="Ljava.lang.String;" methodIdRef="3" index="0" /> <parameterDef parameterId="3" type="Lcom.ibm.org.omg.CORBA._ObjectStub;" methodIdRef="3" index="1" /> <methodEntry objIdRef="3" methodIdRef="3" threadIdRef="1" time="1064348630.422" ticket="4" sequenceCounter="3"> <parameter parameterIdRef="2" value="RMI-IIOPSampleServer" /> <parameter parameterIdRef="3" value="com.ibm.org.omg.CORBA._ObjectStub:IOR:0000000000000048524d493a6f72672e65636c697073652e6879616465732e657865637574696f6e2e74726163652e73616d706c652e49536572766963653a30303030303030303030303030303030000000000100000000000000c2000102000000000c392e32362e3135372e39320007200000000000674c4d424900000015c0e4c9f8001a000a0953616d706c65504f41004b39303930383433323640392e32362e3135372e3932236f72672e65636c697073652e6879616465732e657865637574696f6e2e74726163652e73616d706c652e5f5365727665725f5469650000000003000000010000001800000000000100010000000100010020000101000000000049424d0a00000008000000001310000500000026000000020002" /> </methodEntry> <classDef classId="3" name="org.omg.CosNaming._NamingContextExtStub" threadIdRef="1" time="1064348630.469" /> <objAlloc objId="4" threadIdRef="1" time="1064348630.469" classIdRef="3" /> <methodDef name="rebind" signature="()" classIdRef="3" methodId="4" /> <methodCall objIdRef="4" methodIdRef="4" threadIdRef="1" time="1064348630.469" ticket="5" sequenceCounter="3" /> <methodReturn objIdRef="4" methodIdRef="4" threadIdRef="1" time="1064348630.500" ticket="6" sequenceCounter="3" /> <methodExit objIdRef="3" methodIdRef="3" threadIdRef="1" time="1064348630.500" ticket="7" sequenceCounter="3"> <parameter parameterIdRef="2" value="RMI-IIOPSampleServer" /> <parameter parameterIdRef="3" value="com.ibm.org.omg.CORBA._ObjectStub:IOR:0000000000000048524d493a6f72672e65636c697073652e6879616465732e657865637574696f6e2e74726163652e73616d706c652e49536572766963653a30303030303030303030303030303030000000000100000000000000c2000102000000000c392e32362e3135372e39320007200000000000674c4d424900000015c0e4c9f8001a000a0953616d706c65504f41004b39303930383433323640392e32362e3135372e3932236f72672e65636c697073652e6879616465732e657865637574696f6e2e74726163652e73616d706c652e5f5365727665725f5469650000000003000000010000001800000000000100010000000100010020000101000000000049424d0a00000008000000001310000500000026000000020002" /> </methodExit> <threadStart threadId="2" time="1064348658.266" /> <classDef classId="4" name="javax.rmi.CORBA.Tie" threadIdRef="2" time="1064348658.266" /> <objAlloc objId="5" threadIdRef="2" time="1064348658.266" classIdRef="4" /> <methodDef name="_is_a" signature="()" classIdRef="4" methodId="5" /> <methodReceive objIdRef="5" methodIdRef="5" threadIdRef="2" time="1064348658.266" ticket="8" sequenceCounter="1" remoteNodeIdRef="699358b4-2fc9-4105-a791-8584208abe89" remoteProcessIdRef="4bf8aaa4-6e66-46da-be9d-899438947e6f" remoteAgentIdRef="699358b4-2fc9-4105-a791-8584208abe89" remoteThreadIdRef="1" remoteTicket="5" remoteSequenceCounter="2" /> <methodReply objIdRef="5" methodIdRef="5" threadIdRef="2" time="1064348658.266" ticket="9" sequenceCounter="1" /> <threadStart threadId="3" time="1064348658.312" /> <methodDef name="hello" signature="()" classIdRef="4" methodId="6" /> <methodReceive objIdRef="5" methodIdRef="6" threadIdRef="3" time="1064348658.312" ticket="10" sequenceCounter="1" remoteNodeIdRef="699358b4-2fc9-4105-a791-8584208abe89" remoteProcessIdRef="4bf8aaa4-6e66-46da-be9d-899438947e6f" remoteAgentIdRef="699358b4-2fc9-4105-a791-8584208abe89" remoteThreadIdRef="1" remoteTicket="9" remoteSequenceCounter="3" /> <methodDef name="hello" signature="(Ljava.lang.String;)Ljava.lang.String;" classIdRef="1" methodId="7" /> <parameterDef parameterId="4" type="Ljava.lang.String;" methodIdRef="7" index="0" name="name" /> <methodEntry objIdRef="2" methodIdRef="7" threadIdRef="3" time="1064348658.312" ticket="11" sequenceCounter="2"> <parameter parameterIdRef="4" value="qiyanli" /> </methodEntry> <methodExit objIdRef="2" methodIdRef="7" threadIdRef="3" time="1064348658.312" ticket="12" sequenceCounter="2"> <parameter parameterIdRef="4" value="qiyanli" /> <returnValue value="Hello qiyanli!" /> </methodExit> <methodReply objIdRef="5" methodIdRef="6" threadIdRef="3" time="1064348658.312" ticket="13" sequenceCounter="2" /> <methodDef name="add" signature="()" classIdRef="4" methodId="8" /> <methodReceive objIdRef="5" methodIdRef="8" threadIdRef="2" time="1064348658.328" ticket="14" sequenceCounter="2" remoteNodeIdRef="699358b4-2fc9-4105-a791-8584208abe89" remoteProcessIdRef="4bf8aaa4-6e66-46da-be9d-899438947e6f" remoteAgentIdRef="699358b4-2fc9-4105-a791-8584208abe89" remoteThreadIdRef="1" remoteTicket="13" remoteSequenceCounter="4" /> <methodDef name="add" signature="(II)Ljava.lang.Long;" classIdRef="1" methodId="9" /> <parameterDef parameterId="5" type="I" methodIdRef="9" index="0" name="x" /> <parameterDef parameterId="6" type="I" methodIdRef="9" index="1" name="y" /> <methodEntry objIdRef="2" methodIdRef="9" threadIdRef="2" time="1064348658.328" ticket="15" sequenceCounter="3"> <parameter parameterIdRef="5" value="5" /> <parameter parameterIdRef="6" value="17" /> </methodEntry> <methodExit objIdRef="2" methodIdRef="9" threadIdRef="2" time="1064348658.328" ticket="16" sequenceCounter="3"> <parameter parameterIdRef="5" value="5" /> <parameter parameterIdRef="6" value="17" /> <returnValue value="22" /> </methodExit> <methodReply objIdRef="5" methodIdRef="8" threadIdRef="2" time="1064348658.328" ticket="17" sequenceCounter="3" /> The corresponding client trace is as follows: <?xml version="1.0"?> <TRACE> <agentCreate agentId="699358b4-2fc9-4105-a791-8584208abe89" processIdRef="4bf8aaa4-6e66-46da-be9d-899438947e6f" nodeIdRef="699358b4-2fc9-4105-a791-8584208abe89" agentName="Distributed Trace Profiler" time="1064348640.391" /> <traceStart traceId="1348519621" agentIdRef="699358b4-2fc9-4105-a791-8584208abe89" time="1064348657.953" /> <threadStart threadId="1" time="1064348657.953" /> <classDef classId="1" name="org.eclipse.hyades.execution.trace.sample.Client" threadIdRef="1" time="1064348657.953" /> <objAlloc objId="1" threadIdRef="1" time="1064348657.953" classIdRef="1" /> <methodDef name="main" signature="([Ljava.lang.String;)V" classIdRef="1" methodId="1" /> <parameterDef parameterId="1" type="[Ljava.lang.String;" methodIdRef="1" index="0" name="args" /> <methodEntry objIdRef="1" methodIdRef="1" threadIdRef="1" time="1064348657.969" ticket="1" sequenceCounter="1"> <parameter parameterIdRef="1"></parameter> </methodEntry> <classDef classId="2" name="javax.naming.InitialContext" threadIdRef="1" time="1064348658.188" /> <objAlloc objId="2" threadIdRef="1" time="1064348658.188" classIdRef="2" /> <methodDef name="lookup" signature="(Ljava.lang.String;)Ljava.lang.Object;" classIdRef="2" methodId="2" /> <parameterDef parameterId="2" type="Ljava.lang.String;" methodIdRef="2" index="0" name="name" /> <methodEntry objIdRef="2" methodIdRef="2" threadIdRef="1" time="1064348658.188" ticket="2" sequenceCounter="2"> <parameter parameterIdRef="2" value="RMI-IIOPSampleServer" /> </methodEntry> <classDef classId="3" name="org.omg.CosNaming._NamingContextExtStub" threadIdRef="1" time="1064348658.219" /> <objAlloc objId="3" threadIdRef="1" time="1064348658.219" classIdRef="3" /> <methodDef name="resolve" signature="()" classIdRef="3" methodId="3" /> <methodCall objIdRef="3" methodIdRef="3" threadIdRef="1" time="1064348658.234" ticket="3" sequenceCounter="2" /> <methodReturn objIdRef="3" methodIdRef="3" threadIdRef="1" time="1064348658.234" ticket="4" sequenceCounter="2" /> <classDef classId="4" name="org.eclipse.hyades.execution.trace.sample._IService_Stub" threadIdRef="1" time="1064348658.250" /> <objAlloc objId="4" threadIdRef="1" time="1064348658.250" classIdRef="4" /> <methodDef name="_is_a" signature="()" classIdRef="4" methodId="4" /> <methodCall objIdRef="4" methodIdRef="4" threadIdRef="1" time="1064348658.250" ticket="5" sequenceCounter="2" /> <methodReturn objIdRef="4" methodIdRef="4" threadIdRef="1" time="1064348658.266" ticket="6" sequenceCounter="2" remoteNodeIdRef="d3fbc56b-bd31-4d28-88bd-a344aff21854" remoteProcessIdRef="40aa9f98-ce86-47fe-a026-d94123c460fb" remoteAgentIdRef="d3fbc56b-bd31-4d28-88bd-a344aff21854" remoteThreadIdRef="2" remoteTicket="9" remoteSequenceCounter="1" /> <methodExit objIdRef="2" methodIdRef="2" threadIdRef="1" time="1064348658.281" ticket="7" sequenceCounter="2"> <parameter parameterIdRef="2" value="RMI-IIOPSampleServer" /> <returnValue value="aced0005737200386f72672e65636c697073652e6879616465732e657865637574696f6e2e74726163652e73616d706c652e5f49536572766963655f53747562906aeac43350c59b020000787200146a617661782e726d692e434f5242412e537475620f188e25fbc0101b03000078707a0000011a00000048524d493a6f72672e65636c697073652e6879616465732e657865637574696f6e2e74726163652e73616d706c652e49536572766963653a30303030303030303030303030303030000000000100000000000000c2000102000000000c392e32362e3135372e39320007200000000000674c4d424900000015c0e4c9f8001a000a0953616d706c65504f41004b39303930383433323640392e32362e3135372e3932236f72672e65636c697073652e6879616465732e657865637574696f6e2e74726163652e73616d706c652e5f5365727665725f5469650000000003000000010000001800000000000100010000000100010020000101000000000049424d0a0000000800000000131000050000002600000002000278" /> </methodExit> <methodDef name="hello" signature="(Ljava.lang.String;)Ljava.lang.String;" classIdRef="4" methodId="5" /> <parameterDef parameterId="3" type="Ljava.lang.String;" methodIdRef="5" index="0" name="name" /> <methodEntry objIdRef="4" methodIdRef="5" threadIdRef="1" time="1064348658.312" ticket="8" sequenceCounter="3"> <parameter parameterIdRef="3" value="qiyanli" /> </methodEntry> <methodDef name="hello" signature="()" classIdRef="4" methodId="6" /> <methodCall objIdRef="4" methodIdRef="6" threadIdRef="1" time="1064348658.312" ticket="9" sequenceCounter="3" /> <methodReturn objIdRef="4" methodIdRef="6" threadIdRef="1" time="1064348658.312" ticket="10" sequenceCounter="3" remoteNodeIdRef="d3fbc56b-bd31-4d28-88bd-a344aff21854" remoteProcessIdRef="40aa9f98-ce86-47fe-a026-d94123c460fb" remoteAgentIdRef="d3fbc56b-bd31-4d28-88bd-a344aff21854" remoteThreadIdRef="3" remoteTicket="13" remoteSequenceCounter="2" /> <methodExit objIdRef="4" methodIdRef="5" threadIdRef="1" time="1064348658.328" ticket="11" sequenceCounter="3"> <parameter parameterIdRef="3" value="qiyanli" /> <returnValue value="Hello qiyanli!" /> </methodExit> <methodDef name="add" signature="(II)Ljava.lang.Long;" classIdRef="4" methodId="7" /> <parameterDef parameterId="4" type="I" methodIdRef="7" index="0" name="x" /> <parameterDef parameterId="5" type="I" methodIdRef="7" index="1" name="y" /> <methodEntry objIdRef="4" methodIdRef="7" threadIdRef="1" time="1064348658.328" ticket="12" sequenceCounter="4"> <parameter parameterIdRef="4" value="5" /> <parameter parameterIdRef="5" value="17" /> </methodEntry> <methodDef name="add" signature="()" classIdRef="4" methodId="8" /> <methodCall objIdRef="4" methodIdRef="8" threadIdRef="1" time="1064348658.328" ticket="13" sequenceCounter="4" /> <methodReturn objIdRef="4" methodIdRef="8" threadIdRef="1" time="1064348658.344" ticket="14" sequenceCounter="4" remoteNodeIdRef="d3fbc56b-bd31-4d28-88bd-a344aff21854" remoteProcessIdRef="40aa9f98-ce86-47fe-a026-d94123c460fb" remoteAgentIdRef="d3fbc56b-bd31-4d28-88bd-a344aff21854" remoteThreadIdRef="2" remoteTicket="17" remoteSequenceCounter="3" /> <methodExit objIdRef="4" methodIdRef="7" threadIdRef="1" time="1064348658.359" ticket="15" sequenceCounter="4"> <parameter parameterIdRef="4" value="5" /> <parameter parameterIdRef="5" value="17" /> <returnValue value="22" /> </methodExit> <methodExit objIdRef="1" methodIdRef="1" threadIdRef="1" time="1064348658.359" ticket="16" sequenceCounter="1"> <parameter parameterIdRef="1"></parameter> </methodExit>