Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 82291

Summary: (Plat) Documentation fix for document "An introduction to profiling Java applications"
Product: z_Archived Reporter: Dave Smith <smith>
Component: HyadesAssignee: Nellie Chau <nelliec>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 Keywords: Documentation
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   
Whiteboard: closed460

Description Dave Smith CLA 2005-01-05 17:38:18 EST
Brian_Howell@PlayStation.Sony.Com was trying to follow the instructions in the  
Hyades document "An introduction to profiling Java applications" and reported 
the following:

From "An Introduction to Profiling Java Applications"
Section 3.5  "Attaching to a local Java Application"

I am using Linux Fecora Core 3 and j2sdk1.4.2_04

1. Change to eclipse home directory
2.   eclipse -data profile
This works, opens up eclipse in preparation to profile a second workbench.

3.  java -XrunpiAgent:server=enabled -classpath "%CLASSPATH%;startup.jar"
org.eclipse.core.launcher.Main

I am running Fedora Core 3 linux so this was changed to:
 java -XrunpiAgent:server=enabled -classpath "$CLASSPATH:startup.jar"
org.eclipse.core.launcher.Main

It looks like it wants to run but second eclipse never launches.

did a ps -ef | grep eclipse

devuser    3723  3499  0 12:22 pts/1    00:00:00 eclipse -data profile
devuser    3724  3723  0 12:22 pts/1    00:00:05 /home/devuser/j2sdk1.4.2
_04/bin/java -cp /home/devuser/eclipse/startup.jar
org.eclipse.core.launcher.Main -os linux -ws gtk -arch x86 -showsplash
/home/devuser/eclipse/eclipse -showsplash 600 -exitdata
/home/devuser/eclipse/eclipse -exitdata 10800f -data profile -vm
/home/devuser/j2sdk1.4.2_04/bin/java -vmargs -cp
/home/devuser/eclipse/startup.jar org.eclipse.core.launcher.Main

Noticed what eclipse -data profile command produced from above

Did this command instead (this worked)
/home/devuser/j2sdk1.4.2_04/bin/java -XrunpiAgent:server=enabled  -cp
/home/devuser/eclipse/startup.jar org.eclipse.core.launcher.Main -os linux
-ws gtk -arch x86 -showsplash /home/devuser/eclipse/eclipse -showsplash 600
-exitdata /home/devuser/eclipse/eclipse -exitdata 10800f -data workspacenew
-vm /home/devuser/j2sdk1.4.2_04/bin/java -vmargs -cp
/home/devuser/eclipse/startup.jar org.eclipse.core.launcher.Main

All I did is copy the output from the ps command, add the
-XrunpiAgent:server=enabled part and changed the -data profile part to
-data workspacenew  (or leave it out and use default workspace provided it
is not called profile).

New workbench came up.
Was able to see agent Unknown[PID:4022] from configuration in Attach Java
Process.

There has got to be an easier way but this allowed me to continue in the
tutorial at least for now.
Comment 1 Dave Smith CLA 2005-01-05 18:19:05 EST
I was able to start the workbench to be profiled with the following command on 
Linux:

eclipse -vmargs -XrunpiAgent:server=enabled

I propose to change list item 3 in section 3.5 to the following:

3. The Java Profiling Agent is invoked by specifying the JVM argument -
XrunpiAgent:server=enabled on the java command to start the application to be 
profiled.  For example:  java -XrunpiAgent:server=enabled javaApp .  In our 
case we want to profile an instance of the Eclipse workbench and we will use 
the eclipse program to start the workbench.
Navigate to the home directory of the Eclipse workbench and run the following 
command to start a second workbench with the default workspace: 

eclipse -vmargs -XrunpiAgent:server=enabled

where 
-vmargs is how to specify JVM arguments to the JVM used to run Eclipse
-XrunpiAgent 
invokes the Java Profiling Agent 
:server=enabled 
Specifies the mode of the Java profiling agent. Enabled mode will allow the 
Java application to run normally with the Java profiling agent running in the 
background. If the mode is changed to controlled, then the application will be 
locked (i.e. not executed) until it is attached to. 
 
For more details on the -XrunpiAgent argument, type java -XrunpiAgent:help in a 
console window.
Note: This command is case-sensitive on most platforms. The profiling agent is 
installed as part of the Hyades Data Collection Engine. Ensure that the bin 
directory of the Hyades Data Collection Engine is in the PATH environment 
variable on Windows systems and the lib directory is in the LD_LIBRARY_PATH 
environment variable on Linux systems.
Comment 2 Nellie Chau CLA 2005-01-31 14:13:19 EST
Fixed.
Comment 3 Paul Slauenwhite CLA 2009-06-30 09:34:35 EDT
As of TPTP 4.6.0, TPTP is in maintenance mode and focusing on improving quality by resolving relevant enhancements/defects and increasing test coverage through test creation, automation, Build Verification Tests (BVTs), and expanded run-time execution. As part of the TPTP Bugzilla housecleaning process (see http://wiki.eclipse.org/Bugzilla_Housecleaning_Processes), this enhancement/defect is verified/closed by the Project Lead since this originator of this enhancement/defect has an inactive Bugzilla account and considered to be fixed. If this enhancement/defect is still unresolved and reproducible in the latest TPTP release (http://www.eclipse.org/tptp/home/downloads/), please re-open.