misc command line questions....

Questions about YourKit Java Profiler
Post Reply
Michael.Scaman
Posts: 34
Joined: Mon Feb 02, 2015 3:14 pm

misc command line questions....

Post by Michael.Scaman »

Question 1) Can I change the directory the snapshots are saved in?
mine go in /usr/share/tomcat/Snapshots but might be nice to aim the in the script

Question 2) Can you mark which snapshots appropriate to do after each start/stop
I see 3 snapshot commands
capture-memory-snapshot
capture-hprof-snapshot
capture-performance-snapshot

I want to make sure I am matching the correct with the correct

clear-cpu-data
start-cpu-sampling
start-cpu-tracing
stop-cpu-profiling
# question, then capture-performance-snapshot ?

clear-alloc-data
start-alloc-recording-all
start-alloc-recording-adaptive [alloc-sampled]
// record each 10th allocation, and all objects with size > 1M
stop-alloc-recording
# capture-memory-snapshot? or which?

clear-monitor-data
start-monitor-profiling
stop-monitor-profiling
# question, then capture-hprof-snapshot?

If that right?

Question 3) Is there one of these that has exceptions caught
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: misc command line questions....

Post by Anton Katilin »

Hi Michael,
Question 1) Can I change the directory the snapshots are saved in?
Snapshot directory is configurable, but this should be made when you run the profiled application:
https://www.yourkit.com/docs/java/help/snapshot_dir.jsp
Question 2) Can you mark which snapshots appropriate to do after each start/stop
clear-cpu-data
Please note that start implies clear, so explicit "clear-" before "start-" is not needed.
start-cpu-sampling
start-cpu-tracing
stop-cpu-profiling
# question, then capture-performance-snapshot ?
Yes.
clear-alloc-data
start-alloc-recording-all
start-alloc-recording-adaptive [alloc-sampled]
stop-alloc-recording
# capture-memory-snapshot?
Yes.
clear-monitor-data
start-monitor-profiling
stop-monitor-profiling
# question, then capture-hprof-snapshot?
No, this is again a performance snapshot.

Memory snapshot contains heap + everything a performance snapshot would contain. In other words, memory snapshot includes performance snapshot. If you don't need the heap, use a performance snapshot.

HPROF is a special, JVM supported format. It contains heap only:
https://www.yourkit.com/docs/java/help/ ... pshots.jsp
Question 3) Is there one of these that has exceptions caught
Any except for HPROF. Again, if you don't need the heap, performance snapshot is sufficient.

Best regards,
Anton
Michael.Scaman
Posts: 34
Joined: Mon Feb 02, 2015 3:14 pm

Re: misc command line questions....

Post by Michael.Scaman »

and another basic question.

so I can start the combination of things I want (at once)
let it run for some time
stop them (at once )

and then snap performance and memory?

or is there an advantage doing them one feature at a time?
Michael.Scaman
Posts: 34
Joined: Mon Feb 02, 2015 3:14 pm

Re: misc command line questions....

Post by Michael.Scaman »

And... what's the different between cpu tracing and cpu monitoring?

thanks
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: misc command line questions....

Post by Anton Katilin »

You can run different modes (CPU profiling, allocation recording, monitors, etc.) simultaneously by starting them one by one. If you capture a snapshot it will include all results available at the moment. Later you can stop them one by one too.
or is there an advantage doing them one feature at a time?
I wouldn't recommend combining CPU profiling, be it sampling or tracing, with other modes such as allocation recording, because their additional overhead may affect the CPU profiling result accuracy.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: misc command line questions....

Post by Anton Katilin »

cpu tracing and cpu monitoring
We don't use the term "cpu monitoring".

Instead, CPU sampling and CPU tracing are two available CPU profiling modes. You can use only one of them at a time (or none, meaning that CPU profiling is not running).

Please find description and comparison here:
https://www.yourkit.com/docs/java/help/cpu_intro.jsp
Michael.Scaman
Posts: 34
Joined: Mon Feb 02, 2015 3:14 pm

Re: misc command line questions....

Post by Michael.Scaman »

ok....



started cpu ran 15 min stopped... seems like a reasonable size
snapshotted perf
-rw-r--r-- 1 tomcat tomcat 13270358 Mar 13 16:23 Tomcat-2015-03-13.snapshot

started allocation adaptive
started monitor profiling
ran 15 min
stopped both
snapshotted memory then perf
-rw-r--r-- 1 tomcat tomcat 706920270 Mar 13 16:45 Tomcat-2015-03-13-1.snapshot
-rw-r--r-- 1 tomcat tomcat 43102673 Mar 13 16:45 Tomcat-2015-03-13-2.snapshot

Is there something I need to clear for the memory snapshot... or is watching it for 15 min asking for trouble seeing that it's 700Meg

thanks and sorry for all the questions

should I have cleared the cpu part before starting??
Michael.Scaman
Posts: 34
Joined: Mon Feb 02, 2015 3:14 pm

Re: misc command line questions....

Post by Michael.Scaman »

I stopped cpu profiling and cleared it

then started alloc adaptive and monitoring and still for a huge result.
memory snapshot is first and relatively small
performance snapshot is next and relatively large

-rw-r--r-- 1 tomcat tomcat 42939595 Mar 13 18:09 Tomcat-2015-03-13-1.snapshot
-rw-r--r-- 1 tomcat tomcat 726000631 Mar 13 18:09 Tomcat-2015-03-13.snapshot

just seeing if I'm doing something wrong causing it to conflate
both collected for 15 min
Michael.Scaman
Posts: 34
Joined: Mon Feb 02, 2015 3:14 pm

Re: misc command line questions....

Post by Michael.Scaman »

sorry for the confusion... the memory is first and always fairly large.... is that just the way it is?
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: misc command line questions....

Post by Anton Katilin »

Memory snapshot contains information about all objects in the heap. It may be comparable in size (but no equal, due to different formats and data layouts) to the size of the heap of the profiled application.

Performance snapshots are usually way smaller.

And, again, the memory snapshot "contains" the performance snapshot too. In other words, memory snapshot = heap + performance snapshot.

If you care about the snapshot sizes on disk please don't capture a memory snapshot unless you really need it.
Post Reply