Introduction to Sun JDK basic performance Profiling Tools

Source: Internet
Author: User

The Sun JDK also publishes a number of profiling tools with the release, which are basically based on the JVM Mangeapi and Sun JVM Attach API implementations, so what features can be found in the instructions for the JVM Manage API. Let's take a look at:
First, functional tools
1. JPS: Lists the process ID and process name of all JVM processes and implements the principle visible sun JVM Attach API
2. Jinfo: Print JVM Boot internal information, such as startup parameters, JVM version, operating system information, etc., see the JVM Manage API OperatingSystem and runtime of the two beans, this feature is based on the JVM Manage API implementation. Most commonly used formats:

Jinfo PID

Jinfo support connection to remote JVM (remote service requires boot JSADEBUGD), practical application is not very useful
3. Jstat: A statistical tool for memory and garbage collection situations, the most commonly used format is:

Jstat-outputoptions Vmid [Interval[s|ms] [count]]

Jstat support connection to remote JVM (remote service requires boot JSTATD), practical application is not very useful
The outputoptions options you can use include:

classStatistics on the behavior of theclassLoader.compiler Statistics of the behavior of the HotSpot Just-in-Time Compiler.gc Statistics of the behavior of the garbage collected heap.gccapacity Statistics of the capacities of T He generations and their corresponding spaces.gccause Summary of garbage collection statistics (same as-gcutil), with the cause of the last and current (ifapplicable) garbage collection Events.gcnew Statistics of the behavior of theNewgeneration.gcnewcapacity Statistics of the sizes of theNewGenerations and its corresponding spaces.gcold Statistics of the behavior of the old and permanent GENERATIONS.GCOLDC Apacity Statistics of the sizes of the old generation.gcpermcapacity Statistics of the sizes of the permanent GENERATION.G Cutil Summary of Garbage Collection Statistics.printcompilation HotSpot compilation method statistics.

For more detailed instructions see: http://java.sun.com/javase/6/docs/technotes/tools/share/jstat.html
Example:

JSTAT-GC 23450 250 4//23450 is the process id,250 indicates that every 250-hao second sampling, 4 is the total execution 4 times, the output results are as follows:s0c s1c s0u s1u EC EU OC OU PC PU ygc ygct FGC fgct GCT1600.0 1600.0 786.5 0.0 13184.0 11964.2 114688.0 3684.3 131072.0 13484.2 8 0.127 0 0.000 0.1271600.0 1600.0 786.5 0.0 1318 4.0 11964.2 114688.0 3684.3 131072.0 13484.2 8 0.127 0 0.000 0.1271600.0 1600.0 786.5 0.0 13184.0 11964.2 114688.0 3684.3 131072.0 13484.2 8 0.127 0 0.000 0.1271600.0 1600.0 786.5 0.0 13184.0 11964.2 114688.0 3684.3 131072.0 13484.2 8 0.127 0 0 .000 0.127s0c| s1c/s0u| S1U: two x Suvivor area capacity/free capacity EC/eu:eden Area capacity/Idle capacity OC/ou:tenured Area capacity/Free capacity PC/pu:perm Area capacity/Idle capacity YGC/Ygct:young Gen Recovery times/Total payback time FGC/fgct:full GC Times/Total Payback time GCT: Total garbage collection time (YGCT+FGCT)

4. Jstack: Print all current thread, line stacks, and lock information for the JVM, most commonly used in the following format:

Jstack–l PID

Example:

Jstack-l 23450 fullthread dump Java HotSpot (TM) Server VM (10.0-b22 Mixed mode):"Attach Listener" Daemo n prio=10 tid=0x08058400 nid=0x3005 waiting on condition [0x00000000.. 0x00000000]java.lang.thread.state:runnablelocked ownable synchronizers:- None"DESTROYJAVAVM" prio=10 tid=0x822af400 nid=0x5b9b waiting on condition [0x00000000.. 0xb7dc2120]java.lang.thread.state:runnablelocked ownable synchronizers:- None ...

Jstack support connection to remote JVM (remote service requires boot JSADEBUGD), practical application is not very useful
5. Jmap: The current heap memory information Dump,jdk6 supports dump to a file that is analyzed by other analysts (such as jhat/eclipse memory Anaylzer). The most commonly used formats are as follows:

Jmap-dump:file={filename} PID

Example: Dump heap memory into Result.bin as follows

Jmap-dump:file=result.bin 23450 Displays the following information: dumping heap to ... /bin/Result.bin ... Heap dump file created

Second, supporting tools
The accessibility tool itself does not provide any functionality, only provides support for functional tools
1. JSTATD/JSADEBUGD: Provide remote agent services, support Jstat/jinfo/jstack remote access to information, the tool is not really meaningful
2.jhat: Analyze Jmap dump out of the heap to provide access in the form of Web pages. The Jhat function is basically weaker, is very memory-intensive, is largely unusable in the case of large heap files (for example, over 1G), and Eclipse Memory Anaylzer is an excellent alternative. Use the following format:

jhat {DumpFile} requires additional startup parameters when the heap file is large, such as the following jhat–j-mx512m {dumpfile}

Access http://localhost:7000 to see the results after analysis

Introduction to Sun JDK basic performance Profiling Tools

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.