5

I have Linux system where jprofiler installed.

I have to profile one running server and one client together which lying on same Linux system. I am sending 100+ different request from client to server.

My query is:

  1. How to Automate whole jprofile process without GUI intervention?
  2. When start the jprofiling, before 100 request submitted to client or after?
  3. I haven't found config.xml (/root/.jprofiler8) after installing jprofiler in Linux system. How to create it?
  4. How to create session without GUI?

To analyse the jprofiler output I will copy on window system and will use GUI jprofiler.

Thanks in advance,

Edit-1

I can automate profiling procedure step 4 and 5 from below. All below steps are correct or not?

  1. Configure session using GUI as you suggested on yours reply (Session->Integration Wizards->New Remote Integration)

  2. export session using GUI as you suggested on yours reply (Session->Export Session Settings).

  3. Copy config.xml from window to Linux where jvm are running.

  4. Run jpenable in linux system like below: jpenable --pid=8568 --noinput --offline --config=/home/myuser/config.xml --id=106

  5. Run jpcontroller in Linux system like below and Save snapshot: jpcontroller 8568

  6. Copy snapshot output from Linux system to window and open snapshot(Session-> Open Snapshot) using jprofiler for further analysis.

Edit-2

-agentpath VM parameter added in start script instead of using my step 4. Now, can I start my created session to use JProfiler GUI instead of using my step 5-6? I am receiving connection error when select and start my session.

Session -> Start Center -> Select and Start session (e.g. id="138" name="Remote application on linux1")

Also, I ran "netstat -a | grep 8849" on Linux system but didn't get any result/output.

Replaced and executed step 4 like below:

linux1:/var/opt# su myuser

myuser@linux1:/var/opt> java -Xmx2g -agentpath:/opt/jprofiler8/bin/linux-x64/libjprofilerti.so=offline,id=138,config=/home/myuser/.jprofiler8/config.xml -classpath /opt/jprofiler8/bin/agent.jar -jar /opt/myapp.jar

JProfiler> Offline profiling mode.

JProfiler> Protocol version 41

JProfiler> Using JVMTI

JProfiler> JVMTI version 1.1 detected.

JProfiler> 64-bit library

JProfiler> Using config file /home/myuser/.jprofiler8/config.xml (id: 138)

JProfiler> Listening on port: 8849.

JProfiler> Instrumenting native methods.

JProfiler> Can retransform classes.

JProfiler> Can retransform any class.

JProfiler> Native library initialized

JProfiler> VM initialized

JProfiler> Using dynamic instrumentation

JProfiler> Time measurement: elapsed time

JProfiler> CPU profiling enabled

SLF4J: Class path contains multiple SLF4J bindings.

MyApp started

But, I am able use JProfiler GUI if i followed below steps instead of using my step 1-2-3-4-5-6 and it's not offline:

Step 1: Go to Linux jprofiler

myuser@linux1:/opt/jprofiler8/bin> ./jpenable

Select a JVM:

myapp.jar [29389] [1]

myapp2.jar [29228] [2]

1 Please select the profiling mode:

GUI mode (attach with JProfiler GUI) [1, Enter]

Offline mode (use config file to set profiling settings) [2]

1 Please enter a profiling port

[31757]

You can now use the JProfiler GUI to connect on port 31757

Step 2: Go to window jprofiler

Session -> New session -> [Attach (Squire shape Button) -> Attach to profiled JVM (radio button) --> Host: linux1 --> Profilling port: 31757 --> OK]

Pawan Kumar
  • 51
  • 1
  • 1
  • 4

1 Answers1

3

You cannot create the triggers without a GUI. The idea is to configure the session locally on your desktop machine by invoking

Session->Integration Wizards->New Remote Integration

from the main menu. Select "Profile offline" in the "Startup mode step". The wizard will give you the VM parameter that you have to add on the remote side and create a new session on which you can configure triggers.

After that, export the session by invoking

Session->Export Session Settings

from the main menu and copy that config file to the remote server into the directory that you specified on the "Config synchronization" step of the wizard.

Ingo Kegel
  • 46,523
  • 10
  • 71
  • 102
  • I have to automate whole jprofiler procedure and its look like without GUI intervention (i.e. shell scripting) not possible. if GUI intervention really required then i am using similar to Edit-1. Is it ok? – Pawan Kumar Nov 05 '14 at 14:05
  • I'm not sure what you mean. The GUI is only required for configuring the session and exporting it to a config file. Profiling will then be fully unattended. – Ingo Kegel Nov 06 '14 at 09:01
  • Please have a look on edited part (i.e Edit-1) from my Query and suggest. Please note that all JVM process are running on linux system and no gui on it. – Pawan Kumar Nov 06 '14 at 12:25
  • The wizard in step one will give you an -agentpath VM parameter that you can add to your start script. If you do that, then you do not need step 4. Step 5 is rather manual. If you want to do things automatically you can use triggers. See http://resources.ej-technologies.com/jprofiler/help/doc/helptopics/config/triggers.html – Ingo Kegel Nov 06 '14 at 20:36
  • -agentpath VM parameter added in start script instead of using my step 4. Now, can I start my created session to use JProfiler GUI instead of using my step 5-6? I am receiving connection error when select and start my session. Session -> Start Center -> Select and Start session (e.g. id="138" name="Remote application on linux1"). Please find more detail on edited part (i.e Edit-2) from my Query and suggest. – Pawan Kumar Nov 10 '14 at 12:55
  • I ran "netstat -a | grep 8849" on Linux but didn't found any output/result. – Pawan Kumar Nov 11 '14 at 13:46
  • I don't understand, why do you want to connect with the JProfiler GUI when you do offline profiling? – Ingo Kegel Nov 11 '14 at 15:14