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 – View All Attachments for
Bug 159817
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
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.
Obsolete attachments are hidden. To view all attachments (including obsolete)
click here
.
Attachment #63391
Java Profiler command line support for TPTP 4.4.
text/html
2007-04-10 13:18:19 EDT
18.50 KB
no flags
Details
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <!-- /********************************************************************** * Copyright (c) 2000, 2007 IBM Corporation. * All rights reserved. This content * is 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 * $Id: teprofsa.htm,v 1.13 2007/04/06 01:39:36 jkubasta Exp $ * * Contributors: * IBM - Initial contribution **********************************************************************/ --> <html> <head> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <title>Profiling an application in stand-alone mode</title> <link rel="stylesheet" type="text/css" href="../css/book.css" > </head> <body> <h1>Profiling an application in stand-alone mode</h1> <p> <img src="../images/ngwin.gif" alt="The following information applies to Windows." border="0"> <img src="../images/nglinux.gif" alt="The following information applies to Linux." border="0"> You can profile an application in stand-alone mode (that is, from the command line), without having the the Test and Performance Tools Platform installed. However, you do need to have the Agent Controller installed on the machine where the application to be profiled resides.<br> </p> <p>You can profile an application in stand-alone mode by invoking the Java Profiling Agent, which is a library that attaches to a Java virtual machine (JVM) to capture and record the behavior of your Java application. The output from the agent is in the form of XML fragments.</p> <p><b> <a href="#Stand-alone_profiling_for_Java_1.4_and_lower_java_virtual_machines_"> Using the profiler with Java 1.4 (or lower) virtual machines</a></b><br> <b> <a href="#Stand-alone_profiling_for_Java_1.5_and_higher_java_virtual_machines"> Using the profiler with Java 5.0 (or higher) virtual machines</a></b><br> <b><a href="#Format_of_the_Class_Filter_file">Format of the Class Filter file</a></b><br> <b><a href="#Java_Profiling_Agent_Control">Controlling the Java Profiling Agent</a></b><br> <b><a href="#Java_Profiling_Notes">Notes</a></b> </p> <h2><b> <a name="Stand-alone_profiling_for_Java_1.4_and_lower_java_virtual_machines_"> Using the profiler with Java 1.4 (or lower) virtual machines</a></b></h2> <p>Use the -<samp>Xrun</samp> Java option to invoke the Java Profiling Agent:</p> <p><samp> -XrunpiAgent:agent_parm[,agent_parm]*</samp></p> <p>For example, to profile PerformanceExample.java, using filters that are defined in the file myFilters.txt, and directing the data from the profiling session to a file called PEProfilingData, you would type the following on a command line:<br> <samp>java -XrunpiAgent:server=standalone,filters=myFilters.txt,file=PEProfilingData.trcxml PerformanceExample</samp></p> <dl> <dt>Note:<span style="font-weight: 400"> If you want to start WebSphere Application Server Version 6 (WAS) in profiling mode from the command line, you have to perform the following steps:</span></dt> </dl> <ol> <li>Go to <profile root>/config/cells/<nodename>Cell/nodes/<nodename>/servers/server1</li> <li>Edit the jvmEntries element in the server.xml file. In that element, there is an attribute called genericJvmArguments. Append <tt>-XrunpiAgent:server=enabled</tt> to the attribute value.</li> <li>Restart WAS.<br> </li> </ol> <dl> <dt> </dt> <dt>By augmenting the <em>-XrunpiAgent</em> parameter you can specify several different modes to run the profiling agent in. The parameter <samp>agent_parm</samp> can take one of the following values:</dt> </dl> <ul> <li><strong>server=[standalone | enabled | controlled | application]</strong><br> <dl> <dt><strong>standalone</strong></dt> <dd>The profiling agent runs in a headless mode, which means it is not possible to interact with it from the workbench. Configuration information is provided using configuration files and profiling data is stored in a file directly by the profiling agent. The profiling file can then be imported into the workbench at a later date.<br> </dd> <dd>The Java Profiling Agent is manually attached to a JVM instance and generates profiling data to an output file. The default output file is called trace.trcxml, but you can specify a different file name using the file= <em>filename </em>parameter. When this option is selected, the Java Profiling Agent produces an enclosing traceRoot element to form a complete and valid XML document.<br> </dd> <dt><strong>enabled</strong> (This is the default.)</dt> <dd>The profiling agent runs in the background of the JVM without consuming resources until it is connected to by the workbench and asked to start monitoring. Data is then streamed over the agent's data channel and consumed by the workbench. That is, the Java Profiling Agent is loaded, allows the application to run normally, but produces no profiling data until a client attaches to the agent to give it instructions. When this option is selected, the Java Profiling Agent produces only XML fragments instead of a complete XML document.<br> </dd> <dt><strong>controlled</strong> </dt> <dd>The profiling agent preempts the JVM from initialization (the agent is loaded but it blocks the application from running) until it is attached to from the workbench and given instructions to start monitoring by a client. That is, when the profiling agent is launched in controlled mode, it will appear to hang the JVM until asked to start monitoring and it will produce only XML fragments instead of a complete XML document.<br> </dd> <dt><strong>application</strong> </dt> <dd>The Java Profiling Agent is loaded, runs in the background, and allows the application to run normally as in enabled mode. </dd> <dd>It only produces profiling data when two conditions are satisfied. First, the application must have requested that the profiling agent start profiling using <em>org.eclipse.hyades.collection.profiler.Profiler</em> and second, the test client of the workbench must have attached to the Java Profiling Agent and started monitoring.<br></dd> <dd><strong>Note:</strong> All profiling is controlled by the application, using the <em>org.eclipse.hyades.collection.profiler.Profiler</em> class.<br> <br> </dd> </dl> </li> <li><strong>profile=<em>profile file</em></strong><br> This option is only applicable when <tt>server=standalone</tt>. This file specifies the options with which you want the profiler to run when in standalone mode. The options specified in this file are usually set in the profiling configurations window when the user launches a Java process from the workbench; the use of this file is an equivalent way of specifying options when running in standalone mode.<br> The file can be loaded in one of two ways. <ul> <li> Specify the <tt>profile=<em>filename</em></tt> option, for example <pre>-XrunpiAgent:server=standalone,profile=<profile_filename></pre> </li> <li>Name the profile options file <tt>jvmpi.pro</tt> and put in the directory where the Java process is launched. The profiler will recognize the existence of this file and will launch the process as if the user had specified <tt>-XrunpiAgent:server=standalone,profile=./jvmpi.pro</tt> as a VM argument. </li> </ul> See <a href="../ref/rsaproffilt.htm">Stand-alone profile filter options</a> for a list of valid options for the profile file. <li><strong>filters=<em>filename</em></strong><br> Used only when <samp>server=standalone</samp> is specified.<br> Specifies the name of the file that contains the initial class filter definitions to be used during the profiling session. The default file name is filters.txt in the current directory. See below for information about the file format. </li> <li><strong>file=</strong><em><strong>filename</strong></em><br> Used only when <samp>server=standalone</samp> is specified.<br> Specifies the name of a file that the profiling data will be written to. The default is trace.trcxml in the current directory. </li> <li><strong>help</strong><br> Displays a list of available agent options to STDOUT.</li> </ul> <h2><b> <a name="Stand-alone_profiling_for_Java_1.5_and_higher_java_virtual_machines"> Using the profiler with Java 5.0 (or higher) virtual machines</a></b></h2> <div id="main_content"> <p>Use the -<samp>agentlib</samp> Java option to invoke the Java Profiling Agent:</p> <p class="Code">-agentlib:JPIBootLoader=JPIAgent[:[help]|[<option>=<value>,...]];<profiler>[:<option>=<value>,...]</p> <p>The command line is structured as follows:</p> <dl> <dt><i>JPIBootLoader</i> is the library that loads the profiling agent.</dt> <dt> </dt> <dt><i>JPIAgent</i> is the Java 5.0+ profiling agent. By augmenting the <em>JPIAgent</em> part of the command line with additional options, you can control the behavior of the profiling agent. The following options are supported:</dt> </dl> <ul> <li><strong>server=[standalone | enabled | controlled]</strong><br> <dl> <dt><strong>standalone</strong></dt> <dd>The profiling agent runs in a headless mode, which means it is not possible to interact with it from the workbench. Configuration information is provided as part of the command lineand profiling data is stored in a file directly by the profiling agent. The profiling file can then be imported into the workbench at a later date.<br> </dd> <dd>The Java Profiling Agent is manually attached to a JVM instance and generates profiling data to an output file. The default output file is called trace.trcxml, but you can specify a different file name using the file= <em>filename </em>parameter. When this option is selected, the Java Profiling Agent produces an enclosing traceRoot element to form a complete and valid XML document.<br> </dd> <dt><strong>enabled</strong> (This is the default.)</dt> <dd>The profiling agent runs in the background of the JVM without consuming resources until it is connected to by the workbench and asked to start monitoring. Data is then streamed over the agent's data channel and consumed by the workbench. This mode allows the application to run normally, but produces no profiling data until a client attaches to the agent to give it instructions. When this option is selected, the Java Profiling Agent produces only XML fragments instead of a complete XML document.<br> </dd> <dt><strong>controlled</strong> </dt> <dd>The profiling agent preempts the JVM from initialization (the agent is loaded but it blocks the application from running) until it is attached to from the workbench and given instructions to start monitoring by a client. That is, when the profiling agent is launched in controlled mode, it will appear to hang the JVM until asked to start monitoring and it will produce only XML fragments instead of a complete XML document.<br> </dd> </dl> </li> <li><strong>filters=<em>filename</em></strong><br> Used only when <samp>server=standalone</samp> is specified.<br> Specifies the name of the file that contains the initial class filter definitions to be used during the profiling session. The default file name is filters.txt in the current directory. See below for information about the file format. </li> <li><strong>file=</strong><em><strong>filename</strong></em><br> Used only when <samp>server=standalone</samp> is specified.<br> Specifies the name of a file that the profiling data will be written to. The default is trace.trcxml in the current directory. </li> <li><strong>help</strong><br> Displays a list of available agent options to STDOUT.</li> </ul> <dl> <dt><Profiler> is the name of the Profiler Library to load. Some of the available profilers support additional profiler-specific options, as described below:</dt> <ul type="disc"> <li><strong>CGProf</strong><br> Execution time analysis. Supports the following options:<p><i><b>execdetails=[true | false]</b></i> : whether to collect execution flow/call-graph information (<samp>true</samp>) or not (<samp>false</samp>). Default is <samp>false</samp>.</li> <li><strong>HeapProf</strong><br> Object allocation/heap analysis. Supports the following options:<p><b><i> allocsites</i></b><i><b>=[true | false]</b></i> : whether to collect object allocation site information (<samp>true</samp>) or not (<samp>false</samp>). Default is <samp>false</samp>.</li> <li><strong>ThreadProf</strong><br> Thread analysis.</li> </ul> </dl> <p>To run the Java Profiling Agent in standalone mode on Windows, perform the following steps:</p> <ol> <li>Set <code>TPTP_AC_HOME=<<Agent Controller Home>></code></li> <li>Set <code>JAVA_PROFILER_HOME=%TPTP_AC_HOME%\plugins\org.eclipse.tptp.javaprofiler</code></li> <li>Set <code>PATH=%JAVA_PROFILER_HOME%;%PATH%;%TPTP_AC_HOME%\bin</code></li> <li>Set <code>PATH=%PATH%;%JAVA_HOME%\bin</code></li> <li>Execute the Java application with the <samp>-agentlib</samp> parameter as described above</li> </ol> </div> <p> </p> <p>To run the Java Profiling Agent in standalone mode on Linux, perform the following steps:</p> <ol> <li>Set <code>TPTP_AC_HOME=<<Agent Controller Home>></code> </li> <li>Set <code>JAVA_PROFILER_HOME=%TPTP_AC_HOME%/plugins/org.eclipse.tptp.javaprofiler</code> </li> <li>Add the following directories to <code>LD_LIBRARY_PATH:</code> </li> </ol> <p class="Code">%JAVA_PROFILER_HOME%:%TPTP_AC_HOME%/lib<br> </p> <ol start="4"> <li>Execute the Java application with the <samp>-agentlib</samp> parameter as described above. </li> </ol> <div id="main_content"> <blockquote> <p><b>Note<br> <br> </b>On Linux, make sure to surround the entire –agentlib argument with single quotes. Otherwise, the Linux shell may interpret the semicolon (;) preceding the profiler name as a command terminator and the Java application will not be executed.</p> </blockquote> </div> <p>Examples</p> <p><b>Profiling the "HelloWorld" Java application with the CPU Profiler in standalone mode, writing results into log.trcxml:</b></p> <p class="Code">java -agentlib:JPIBootLoader=JPIAgent:server=standalone,file=log.trcxml;CGProf HelloWorld</p> <p><b>Profiling the "HelloWorld" Java application with the Heap Profiler in standalone mode, using filters defined in myFilter.txt, and collecting information about the source locations were objects are allocated:</b></p> <p class="Code">java -agentlib:JPIBootLoader=JPIAgent:server=standalone,filters=myFilter.txt;HeapProf:allocsites=true HelloWorld</p> <h2><a name="Format_of_the_Class_Filter_file"> Format of the Class Filter file</a></h2> <p>The filter file should specify three fields, <em>package/class</em>, <em>method</em>, and <em>mode</em> in the following format:<br> <tt>package/class method mode</tt><br> <br> where: </p> <blockquote> <dl> <dt><strong>package/class</strong> </dt> <dd>This field is used to specify a pattern for a package or a class name. The pattern should be specified as a string with no embedded blanks. The string may contain a single asterisk (*) either at the beginning of the string or trailing the string, e.g. <tt>*.mypackage</tt> or <tt>org.mycompany.*</tt>. The * matches zero or more characters, thus making the pattern a generic prefix or suffix pattern. A sole * can also be specified to represent all strings.</dd> <dt><strong>method</strong> </dt> <dd>This field is used to specify a pattern for the method name. The pattern should be specified as a string with no embedded blanks and with the same specification rules as the <em>class</em> field.</dd> <dt><strong>mode</strong></dt> <dd>This field specifies whether the package or class that matches the pattern is to be included or excluded from profiling. The value for mode is either INCLUDE or EXCLUDE.</dd> </dl> </blockquote> <p>Filter patterns are processed in the order that they are specified until the <em>first</em> pattern match succeeds. If the class name does not match any of the specified filter patterns, the default is to INCLUDE the class.</p> <h2><a name="Java_Profiling_Agent_Control"> Controlling the Java Profiling Agent</a></h2> <p>When the Java Profiling Agent is started with the <samp>server=enabled</samp> or <samp>server=controlled</samp> parameter, communication with the agent is done using the client workbench by means of the Agent Controller on the host machine.</p> <h2><a name="Java_Profiling_Notes">Notes</a></h2> <ul> <li>If you do not specify a filter definition file name on the command line, the Java Profiling Agent tries to read the filters from the file named filters.txt in the current directory. If the file filters.txt does not exist, no filters will be used during the profiling session. If you name your filters file filters.txt and place it in the current directory, you do not need to specify the filters parameter on the command line for your filters to be used by the profiling agent.</li> <li>If you do not specify an output file for the profiling data, it will be saved in the file trace.trcxml</li> <li>You do not have to specify an extension for the output file. It automatically gets the extension .trcxml</li> <li>You do not have to specify the extension for your Java application. It can be a .class file.</li> </ul> <p> </p> <p><strong>Related concepts</strong><br> <a href="../concepts/ceproftl.htm">Overview of the Profiling Tool</a><br> <a href="../concepts/cemonitr.htm">Profiling resources</a><br> </p> <p><strong>Related tasks</strong><br> <a href="../tasks/tprofas400.htm">Profiling an application in standalone mode on AS/400</a><br> <a href="teprlaun.htm">Launching or attaching a Java process</a><br> <a href="../tasks/tuseprmnvw.htm">Using the Profiling monitor view</a><br> </p> <br> <p class="copyright">(C) Copyright IBM Corporation 2000, 2006. All Rights Reserved.</p> <br> </body></html>
Attachment #64509
Updates based on Guru's and Paul's comments
text/html
2007-04-21 11:26:31 EDT
28.52 KB
no flags
Details
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <html> <head> <!-- /********************************************************************** * Copyright (c) 2005 - 2007 Intel Corporation. * All rights reserved. This content is 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 * $Id$ * * Contributors: * Intel - Initial contribution **********************************************************************/ --> <style type="text/css"></style> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"></style> <title>Getting Started with Agent Controller - Linux</title> </head> <body> <h1><strong>Getting Started with Agent Controller - Linux</strong></h1> <h3>Contents</h3> <p align="left" style="margin-left: 20px; margin-top: 0px; margin-bottom: 0px"> <a href="#Overview">Overview</a></p> <p align="left" style="margin-left: 20px; margin-top: 0px; margin-bottom: 0px"> <a href="#Prerequisites">Prerequisites</a></p> <p align="left" style="margin-left: 20px; margin-top: 0px; margin-bottom: 0px"> <a href="#Notation">Notation</a></p> <p align="left" style="margin-left: 20px; margin-top: 0px; margin-bottom: 0px"> <a href="#Installation">Installing Agent Controller</a></p> <p align="left" style="margin-left: 20px; margin-top: 0px; margin-bottom: 0px"> <a href="#Setting_Up_Agent_Controller">Setting Up Agent Controller</a></p> <p align="left" style="margin-left: 20px; margin-top: 0px; margin-bottom: 0px"> <a href="#Configure_Agent_Controller">Configuring Agent Controller</a></p> <p align="left" style="margin-left: 20px; margin-top: 0px; margin-bottom: 0px"> <a href="#Start_Agent_Controller">Starting Agent Controller</a></p> <p align="left" style="margin-left: 20px; margin-top: 0px; margin-bottom: 0px"> <a href="#Stop_Agent_Controller">Stopping Agent Controller</a></p> <p align="left" style="margin-left: 20px; margin-top: 0px; margin-bottom: 0px"> <a href="#queryversion">Querying Agent Controller version information</a></p> <p align="left" style="margin-left: 20px; margin-top: 0px; margin-bottom: 0px"> <a href="#Checking_Agent_Controller_Installation">Checking Agent Controller Installation</a></p> <p align="left" style="margin-left: 20px; margin-top: 0px; margin-bottom: 0px"> <a href="#serverlog">Server Logging</a></p> <p align="left" style="margin-left: 20px; margin-top: 0px; margin-bottom: 0px"> <a href="#javaprof">Profiling a Java Application</a></p> <p align="left" style="margin-left: 20px; margin-top: 0px; margin-bottom: 0px"> <a href="#Invocation_from_the_Eclipse_Workbench">Invocation of the Java Profiler from the Eclipse Workbench</a></p> <p align="left" style="margin-left: 20px; margin-top: 0px; margin-bottom: 0px"> <a href="#Invocation_of_the_Java_Profiler_from_the_Command_Line">Invocation of the Java Profiler from the Command Line</a></p> <p align="left" style="margin-left: 20px; margin-top: 0px; margin-bottom: 0px"> <a href="#Java_14">Using the Java Profiler with Java 1.4 (or lower) Virtual Machines</a></p> <p align="left" style="margin-left: 20px; margin-top: 0px; margin-bottom: 0px"> <a href="#Java_15">Using the Java Profiler with Java 1.5 (or higher) Virtual Machines</a></p> <p align="left" style="margin-left: 20px; margin-top: 0px; margin-bottom: 0px"> <a href="#Format_of_the_Class_Filter_file">Format of the Class Filter File</a></p> <p align="left" style="margin-left: 20px; margin-top: 0px; margin-bottom: 0px"> <a href="#Java_Profiling_Agent_Control">Controlling the Java Profiling Agent</a></p> <p align="left" style="margin-left: 20px; margin-top: 0px; margin-bottom: 0px"> <a href="#Notes_about_the_Java_Profiler">Notes about the Java Profiler</a></p> <p align="left" style="margin-left: 20px; margin-top: 0px; margin-bottom: 0px"> <a href="#uninstall">Uninstalling Agent Controller</a></p> <h2><a name="Overview">Overview</a></h2> <p>This document explains the installation and configuration steps required to use the standalone Agent Controller. To profile a Java application on a remote machine or run a TPTP test on a remote machine, you must first install a standalone Agent Controller on that remote machine. To profile a Java application locally or run a TPTP test locally, you have the option of installing a standalone Agent Controller on the local machine or using the Integrated Agent Controller. If using the Integrated Agent Controller, there is no need to install and configure the standalone Agent Controller when using the Profiling and Logging perspective and Test perspective locally. For more information, see <a href="../../../../org.eclipse.tptp.platform.agentcontroller.doc.user/concepts/ac/ciacintro.html">Integrated Agent Controller</a> </p> <h2><a name="Prerequisites">Prerequisites</a></h2> <ul> <li>Install the Java runtime (JRE) or Java development kit (JDK) 1.5 or 1.4.x<br> </li> <li>Remove or <a href="#uninstall">uninstall</a> all prior versions of Agent Controller.</li> <li>The Agent Controller is compiled using <tt>libstdc++-libc6.2-2.so.3</tt> shared library. Ensure that this shared library exists under the <tt>/usr/lib</tt> directory. If it does not exist, you have to install the RPM package <tt>compat-libstdc++</tt> that comes with the operating system installation media.</li> </ul> <h3><a name="Notation">Notation</a></h3> <p><<tt>install-dir</tt>> = The absolute directory path where the Agent Controller has been unzipped. For example: <tt>/opt/tptpAC</tt></p> <h3><a name="Installation">Installing Agent Controller</a></h3> <p>Download one of the Linux Agent Controller Runtime packages from the TPTP Download page. Install it by simply creating a directory and unzipping the package contents into that directory.</p> <h2><a name="Setting_Up_Agent_Controller">Setting Up Agent Controller</a></h2> <p>After a normal installation, you still need to configure the Agent Controller before you can start it. </p> <h3><a name="Configure_Agent_Controller">Configuring Agent Controller</a></h3> <ol> <li>Ensure that the files in the <tt><install-dir>/bin</tt> and <tt><install-dir>/lib</tt> directory are executable.</li> <li>Run <tt>SetConfig.sh</tt> script from a command shell in the <tt> <install-dir>/bin</tt> directory to generate the configuration file for the Agent Controller. The script requires that a Java Virtual Machine (JVM) be present in the PATH environment variable. Follow the prompts and enter the required parameters as appropriate. The configuration file <tt> <install-dir>/config/serviceconfig.xml</tt> will be generated based on your inputs.<br> </li> <li>Add <tt><install-dir>/bin</tt> directory to the PATH environment variable.</li> <li>Add <tt><install-dir>/lib</tt> directory to the LD_LIBRARY_PATH environment variable.</li> </ol> <p>If you want to make changes to the configuration file that was generated in step 1, you may run the <tt>SetConfig.sh</tt> script again or you may manually edit the file according to the rules outlined in the document <a href="http://help.eclipse.org/help32/topic/org.eclipse.tptp.platform.agentcontroller.doc.user/ref/ac/r_config_ovw.html"> Agent Controller configuration files</a>. The Agent Controller must be restarted for the changes to take effect.</p> <h3><a name="Start_Agent_Controller">Starting Agent Controller</a></h3> <p>Start the Agent Controller by changing your working directory to <tt> <install-dir>/bin</tt> and running <tt>ACStart.sh</tt>.</p> <p><b>Note:</b> The Agent Controller may also be started using <tt>RAStart.sh</tt>, in support of backward compatibility.</p> <h3><a name="Stop_Agent_Controller">Stopping Agent Controller</a></h3> <p>Stop the Agent Controller by changing your working directory to <tt> <install-dir>/bin</tt> and running <tt>ACStop.sh</tt>.</p> <p><b>Note:</b> The Agent Controller may also be stopped using <tt>RAStop.sh</tt>, in support of backward compatibility.</p> <h2><a name="queryversion"></a>Querying Agent Controller Version Information</h2> <p>To display the version of Agent Controller, change your working directory to <install-dir>/bin in a command shell and run the following command:</p> <blockquote> <p><tt>ACServer -v</tt><br> or<br><tt>ACServer -version</tt></p> </blockquote> <p>The Agent Controller will display its version and terminate.</p> <p><b>Note:</b> The Agent Controller version may also be queried using <tt>RAServer</tt>, in support of backward compatibility.</p> <h2><a name="Checking_Agent_Controller_Installation"></a>Checking Agent Controller Installation</h2> <p>If desired, you can verify proper operation of your Agent Controller installation by executing the SampleClient application provided with the runtime package.</p> <p>Perform the following steps:</p> <ol> <li><a href="#Start_Agent_Controller">Start the Agent Controller</a>.</li> <li>Open a command prompt window</li> <li>Go to the <tt><install-dir>/bin</tt> directory</li> <li>Enter the following at the command prompt:<br><br> <tt>SampleClient</tt><br> </li> <li>Observe the console output for SampleClient. It should be similar to the following example:</li> </ol> <blockquote> <p><tt>------------------- SampleClient Console Output --------------------------------<br><br>Connected to the Agent Controller on "localhost" at port number #####<br> <br>The Time Collector Agent ID: ###<br><br>Established a data channel with the agent.<br> <br>Sending 5 Hello messages over data channel to TimeCollector ...<br><br>Start the TimeCollector ...<br> <br>Incoming data: Hello from Time Collector Agent - Count 0<br><br>Incoming data: Hello from Time Collector Agent - Count 1<br> <br>Incoming data: Hello from Time Collector Agent - Count 2<br><br>Incoming data: Hello from Time Collector Agent - Count 3<br> <br>Incoming data: Hello from Time Collector Agent - Count 4<br><br><br>Stop the TimeCollector ...<br> <br>Incoming data: Hello from Time Collector Agent - Count 5<br><br>Incoming data: Hello from Time Collector Agent - Count 6<br> <br>Incoming data: Hello from Time Collector Agent - Count 7<br><br>Incoming data: Hello from Time Collector Agent - Count 8<br> <br>Incoming data: Hello from Time Collector Agent - Count 9<br><br>Incoming data: Hello from Time Collector Agent - Count 10<br> <br>All finished<br>Press any key to exit...</tt></p> </blockquote> <p><b>Note:</b> The above port number and Agent ID values will typically be 10006 and 103 respectively, depending on Agent Controller configuration settings and the number of times that the SampleClient application runs.</p> <p>Refer to the Agent Controller build <tt> readme.txt</tt> file for detailed information on the SampleClient functionality. </p> <h2><a name="serverlog"></a>Server Logging</h2> All server log entries will be placed in <tt><install-dir>/config/servicelog.log</tt> . <h2><a name="javaprof"></a>Profiling a Java Application</h2> <p>You can profile an application by invoking the Java Profiling Agent, which is a library that attaches to a Java Virtual Machine (JVM) to capture and record the behavior of your Java application. The output from the agent is in the form of XML fragments. <b>The format of this fragment is described in the document titled</b> "<a href="http://www.eclipse.org/tptp/platform/documents/resources/profilingspec/XML4Profiling.htm">Event Specification for the Java Profiler</a>".<br> </p> <p>You can invoke the Java Profiling Agent from the Eclipse workbench or in standalone mode from the command line.<br> </p> <h3><a name="Invocation_from_the_Eclipse_Workbench">Invocation of the Java Profiler from the Eclipse Workbench</a></h3> <p>From the Eclipse workbench, you can launch and profile applications in the current Eclipse workbench's workspace or external Java applications located in the file system. To invoke the Java Profiler from the Eclipse workbench, you must have the Test and Performance Tools Platform installed. To profile a Java application locally, you can use the Integrated Agent Controller or a local installation of the Agent Controller. To profile a remote Java application, you must also have the Agent Controller installed on the machine where the application to be profiled resides.</p> <p>To launch the Java Profile, from the Profiling and Logging Perspective of the Eclipse workbench use the <b>Run > Open Profile Dialog...</b> menu or the <b>Profile</b> toolbar button. The Profile wizard will open. Simply follow the wizard to profile an application. </p> <h3><a name="Invocation_of_the_Java_Profiler_from_the_Command_Line">Invocation of the Java Profiler from the Command Line</a></h3> <p>To launch the Java profiler from the command line, you do not need to have the Test and Performance Tools Platform installed but you do need to have the Agent Controller installed on the machine where the application to be profiled resides.</p> <h3><a name="Java_14">Using the Java Profiler with Java 1.4 (or lower) Virtual Machines</h3> <p>Use the <tt>-Xrun</tt> Java option to invoke the Java Profiling Agent, as follows:</p> <pre> -XrunpiAgent[:agent_parm[,agent_parm]*]<br></pre> <p>For example, to profile PerformanceExample.java, using filters that are defined in the file myFilters.txt, and direct the data from the profiling session to a file called PEProfilingData, type the following on a command line:</p> <pre> java -XrunpiAgent:server=standalone,filters=myFilters.txt,file=PEProfilingData.trcxml PerformanceExample</pre> <p>Note that it is also possible to start WebSphere Application Server (WAS) Version 6 in profiling mode from the command line. To do so, perform the following steps:</p> <ol> <li>Go to <tt><profile root>/config/cells/<nodename>Cell/nodes/<nodename>/servers/server1</tt></li> <li>Edit the jvmEntries element in the server.xml file. Specifically, append <tt>-XrunpiAgent:server=enabled</tt> to the genericJvmArguments attribute value.</li> <li>Restart WAS.</li> </ol> <p>By augmenting the <tt>-XrunpiAgent</tt> parameter, you can specify several different modes in which to run the profiling agent. The parameter <tt>agent_parm</tt> can take one of the following values:</p> <p></p> <ul> <li><strong>server=[standalone | enabled | controlled | applicationControlled]</strong> <dl> <dt><strong>standalone</strong></dt> <dd>The Java Profiler is manually attached to a JVM instance and generates a stand-alone trace to a specified file based on the options and filters given on the command line. When this option is selected, the Java Profiler produces the enclosing traceRoot element to form a complete and valid XML document.</dd> <dt><strong>enabled</strong></dt> <dd>The Java Profiler is loaded, allows the application to run normally, but produces no trace until a Eclipse workbench attaches to the agent to give it instructions. When this option is selected, the Java Profiler only produces XML fragments instead of a complete XML document.</dd> <dt><strong>controlled</strong></dt> <dd>The Java Profiler is loaded, and the application is blocked from running until a client gives it instructions to continue. When this option is selected, the Java Profiler only produces XML fragments instead of a complete XML document.</dd> <dt><strong>applicationControlled</strong></dt> <dd>Profiling operations are controlled by the TPTP "Profiler" java class. The pluginconfig.xml file must be modified to use this mode. The pluginconfig.xml is located in the following directory: <pre><install-dir>/plugins/org.eclipse.tptp.platform.collection.framework_<version>/config/pluginconfig.xml</pre> The following modification is required: <pre><Agent client="DYNAMIC" configuration="default" dataChannelSize="64M" name="Java Profiling Agent" type="Profiler"/></pre> should be modified to <pre><Agent client="HEADLESS" configuration="default" dataChannelSize="64M" name="Java Profiling Agent" type="Profiler" logFile="<some_dir>/profile.trcxml"/></pre> Note that the Agent client attribute has been changed to "HEADLESS" and that the "logFile" attribute has been added.<br> The hcframe.jar file should also be included in the user's class path when profiling an application under this mode. For example: <pre> java -XrunpiAgent:server=applicationControlled -classpath .:<install-dir>/plugins/org.eclipse.tptp.platform.collection.framework_<version>/hcframe.jar TestClass</pre> </dd> </dl> </li> <li><strong>filters=filename</strong></li> </ul> <blockquote> <blockquote> <p><b>Note</b>: This parameter is only used when server=standalone is specified.</p> </blockquote> <p>Specifies the name of the file that contains the initial class filter definitions to be used during the trace. The default is filters.txt in the current directory. </p> <p>The format of the file is as follows: </p> </blockquote> <pre> <classpattern> <methodpattern> <mode> where:<br></pre> <blockquote> <dl> <dt><strong>classpattern</strong></dt> <dd>is a string with no embedded blanks. The string may contain a single "*" either at the beginning of the string or at the end of the string. The "*" will match zero or more characters, thus making the pattern a generic prefix or suffix pattern. A single "*" can also be specified to represent all strings.</dd> <dt><strong>methodpattern</strong></dt> <dd>is a string with no embedded blanks. The string may contain a single "*" either at the beginning of the string or at the end of the string. The "*" will match zero or more characters, thus making the pattern a generic prefix or suffix pattern. A single "*" can also be specified to represent all strings.</dd> <dt><strong>mode</strong></dt> <dd>is one of INCLUDE or EXCLUDE. Filter patterns are processed in the order that they are specified until the first pattern match succeeds. If the class name does not match any of the specified filter patterns, the default is to INCLUDE the class.</dd> </dl> </blockquote> <ul> <li><strong>file=filename</strong><br> <blockquote> <p><b>Note</b>: This parameter is only used when server=standalone is specified.</p> </blockquote> Specifies the name of a file where the trace will be written. The default is <tt> trace.trcxml</tt> in the current directory.</li> </ul> <ul> <li><strong>help</strong><br> Displays a list of available agent options to standard out.</li> </ul> <h3><a name="Java_15">Using the Java Profiler with Java 1.5 (or higher) Virtual Machines</a></h3> <p>Use the -<samp>agentlib</samp> Java option to invoke the Java Profiling Agent:</p> <p class="Code">-agentlib:JPIBootLoader=JPIAgent[:[help]|[<option>=<value>,...]];<profiler>[:<option>=<value>,...]</p> <p>The command line is structured as follows:</p> <dl> <dt><i>JPIBootLoader</i> is the library that loads the profiling agent.</dt> <dt> </dt> <dt><i>JPIAgent</i> is the Java 5.0+ profiling agent. By augmenting the <em>JPIAgent</em> part of the command line with additional options, you can control the behavior of the profiling agent. The following options are supported:</dt> </dl> <ul> <li><strong>server=[standalone | enabled | controlled]</strong><br> <dl> <dt><strong>standalone</strong></dt> <dd>The profiling agent runs in a headless mode, which means it is not possible to interact with it from the workbench. Configuration information is provided as part of the command lineand profiling data is stored in a file directly by the profiling agent. The profiling file can then be imported into the workbench at a later date.<br> </dd> <dd>The Java Profiling Agent is manually attached to a JVM instance and generates profiling data to an output file. The default output file is called trace.trcxml, but you can specify a different file name using the file= <em>filename </em>parameter. When this option is selected, the Java Profiling Agent produces an enclosing traceRoot element to form a complete and valid XML document.<br> </dd> <dt><strong>enabled</strong> (This is the default.)</dt> <dd>The profiling agent runs in the background of the JVM without consuming resources until it is connected to by the workbench and asked to start monitoring. Data is then streamed over the agent's data channel and consumed by the workbench. This mode allows the application to run normally, but produces no profiling data until a client attaches to the agent to give it instructions. When this option is selected, the Java Profiling Agent produces only XML fragments instead of a complete XML document.<br> </dd> <dt><strong>controlled</strong> </dt> <dd>The profiling agent preempts the JVM from initialization (the agent is loaded but it blocks the application from running) until it is attached to from the workbench and given instructions to start monitoring by a client. That is, when the profiling agent is launched in controlled mode, it will appear to hang the JVM until asked to start monitoring and it will produce only XML fragments instead of a complete XML document.<br> </dd> </dl> </li> <li><strong>filters=<em>filename</em></strong><br> Used only when <samp>server=standalone</samp> is specified.<br> Specifies the name of the file that contains the initial class filter definitions to be used during the profiling session. The default file name is filters.txt in the current directory. See below for information about the file format. </li> <li><strong>file=</strong><em><strong>filename</strong></em><br> Used only when <samp>server=standalone</samp> is specified.<br> Specifies the name of a file that the profiling data will be written to. The default is trace.trcxml in the current directory. </li> <li><strong>help</strong><br> Displays a list of available agent options to STDOUT.</li> </ul> <dl> <dt><Profiler> is the name of the Profiler Library to load. Some of the available profilers support additional profiler-specific options, as described below:</dt> <ul type="disc"> <li><strong>CGProf</strong><br> Execution time analysis. Supports the following options:<p><i><b>execdetails=[true | false]</b></i> : whether to collect execution flow/call-graph information (<samp>true</samp>) or not (<samp>false</samp>). Default is <samp>false</samp>.</li> <li><strong>HeapProf</strong><br> Object allocation/heap analysis. Supports the following options:<p><b><i> allocsites</i></b><i><b>=[true | false]</b></i> : whether to collect object allocation site information (<samp>true</samp>) or not (<samp>false</samp>). Default is <samp>false</samp>.</li> <li><strong>ThreadProf</strong><br> Thread analysis.</li> </ul> </dl> <p>To run the Java Profiling Agent in standalone mode on Linux, perform the following steps:</p> <ol> <li>Set <code>TPTP_AC_HOME=<<Agent Controller Home>></code> </li> <li>Set <code>JAVA_PROFILER_HOME=%TPTP_AC_HOME%/plugins/org.eclipse.tptp.javaprofiler</code> </li> <li>Add the following directories to <code>LD_LIBRARY_PATH:</code> <p class="Code">%JAVA_PROFILER_HOME%:%TPTP_AC_HOME%/lib </p></li> <li>Execute the Java application with the <samp>-agentlib</samp> parameter as described above. </li> </ol> <p><b>Note</b>: Ensure you surround the entire -agentlib argument with single quotes. Otherwise, the Linux shell may interpret the semicolon (;) preceding the profiler name as a command terminator and the Java application will not be executed.</p> <h4>Examples</h4> <ol> <li>To profile the "HelloWorld" Java application with the CPU Profiler in standalone mode and write the results into log.trcxml:<br> <pre><tt>java -agentlib:JPIBootLoader=JPIAgent:server=standalone,file=log.trcxml;CGProf HelloWorld</tt></pre> </li> <li>To profile the "HelloWorld" Java application with the Heap Profiler in standalone mode, use the filters defined in myFilter.txt, and collect information about the source locations where objects are allocated:<br> <pre><tt>java -agentlib:JPIBootLoader=JPIAgent:server=standalone,filters=myFilter.txt;HeapProf:allocsites=true HelloWorld</tt></pre> </li> </ol> <h3><a name="Format_of_the_Class_Filter_file">Format of the Class Filter file</a></h3> <p>The filter file should specify three fields, <em>package/class</em>, <em>method</em>, and <em>mode</em> in the following format:<br> <tt>package/class method mode</tt><br> <br> where: </p> <blockquote> <dl> <dt><strong>package/class</strong> </dt> <dd>This field is used to specify a pattern for a package or a class name. The pattern should be specified as a string with no embedded blanks. The string may contain a single asterisk (*) either at the beginning of the string or trailing the string, e.g. <tt>*.mypackage</tt> or <tt>org.mycompany.*</tt>. The * matches zero or more characters, thus making the pattern a generic prefix or suffix pattern. A sole * can also be specified to represent all strings.</dd> <dt><strong>method</strong> </dt> <dd>This field is used to specify a pattern for the method name. The pattern should be specified as a string with no embedded blanks and with the same specification rules as the <em>class</em> field.</dd> <dt><strong>mode</strong></dt> <dd>This field specifies whether the package or class that matches the pattern is to be included or excluded from profiling. The value for mode is either INCLUDE or EXCLUDE.</dd> </dl> </blockquote> <p>Filter patterns are processed in the order that they are specified until the <em>first</em> pattern match succeeds. If the class name does not match any of the specified filter patterns, the default is to INCLUDE the class.</p> <h3><a name="Java_Profiling_Agent_Control">Controlling the Java Profiling Agent</a></h3> <p>When the Java Profiling Agent is started with the <samp>server=enabled</samp> or <samp>server=controlled</samp> parameter, communication with the agent is done using the client workbench by means of the Agent Controller on the host machine.</p> <h3><a name="Notes_about_the_Java_Profiler">Notes about the Java Profiler</a></h3> <ul> <li>If you do not specify a filter definition file name on the command line, the Java Profiling Agent tries to read the filters from the file named filters.txt in the current directory. If the file filters.txt does not exist, no filters will be used during the profiling session. If you name your filters file filters.txt and place it in the current directory, you do not need to specify the filters parameter on the command line for your filters to be used by the profiling agent.</li> <li>If you do not specify an output file for the profiling data, it will be saved in the file trace.trcxml</li> <li>You do not have to specify an extension for the output file. It automatically gets the extension .trcxml</li> <li>You do not have to specify the extension for your Java application. It can be a .class file.</li> </ul> <h2><a name="uninstall">Uninstalling Agent Controller</a></h2> <p>To uninstall the agent controller:</p> <ol> <li><a href="#Stop_Agent_Controller">Stop</a> the agent controller: </li> <li>Remove the <samp><install-dir></samp>.</li> <li>Remove the <tt><install-dir>/bin</tt> directory from the PATH environment variable, if necessary.</li> <li>Remove the <tt><install-dir>/lib</tt> directory from the LD_LIBRARY_PATH environment variable, if necessary.<br></li> </ol> <p> </p> <div class="runningfooter"><p><span style="font-size: 7pt;">Copyright (C) 2007 Intel Corporation. </span> </p> </div> </body> </html>