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:
- How to Automate whole jprofile process without GUI intervention?
- When start the jprofiling, before 100 request submitted to client or after?
- I haven't found config.xml (/root/.jprofiler8) after installing jprofiler in Linux system. How to create it?
- 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?
Configure session using GUI as you suggested on yours reply (Session->Integration Wizards->New Remote Integration)
export session using GUI as you suggested on yours reply (Session->Export Session Settings).
Copy config.xml from window to Linux where jvm are running.
Run jpenable in linux system like below: jpenable --pid=8568 --noinput --offline --config=/home/myuser/config.xml --id=106
Run jpcontroller in Linux system like below and Save snapshot: jpcontroller 8568
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]