1 / 17

Use of Profile Tool in Java

Use of Profile Tool in Java. 이준표 walker@altair.snu.ac.kr. Overview. What is profile? Default profiler of JDK Other profile tool. What is profile?. A report on the amounts of time spent in each routine of a program, used to find and tune away the hotspots in it .

velvet
Download Presentation

Use of Profile Tool in Java

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Use of Profile Tool in Java 이준표 walker@altair.snu.ac.kr

  2. Overview • What is profile? • Default profiler of JDK • Other profile tool

  3. What is profile? • A report on the amounts of time spent in each routine of a program, used to find and tune away the hotspots in it. • Some profiling modes reports units other than time(such as call counts) and/or report at granularities other than per-routine, but the idea is similar.

  4. JDK1.1 style profile • How to get profile information? • java -prof class_file • java -Xrunhprof:cpu=old class_file(Java 2) • Output(java.prof) format • count: how many callee is called by caller • callee: called method • caller: calling method • time(msec): spent in callee when called in caller

  5. Considerations on output • The output is initially sorted by count. • Both count and time are important to find hot-spot. • If JIT-compilation is enabled in JDK1.2, the profile information is not correct.

  6. Output example count callee caller time 811063 BitSet.clear(I)V SieveBits.sieve()V 1994 499998 BitSet.set(I)V SieveBits.sieve()V 1223 499998 BitSet.get(I)Z SieveBits.main([Ljava/lang/String;)V 1205 5808 java/lang/String.charAt(I)C java/lang/Character.<clinit>()V 11 1774 sun/io/CharToByteDoubleByte.convSingleByte(C[B)I sun/io/CharToByteDoubleByte.convert([CII[BII)I 4 ......... 1 SieveBits.main(Ljava/lang/String;)V Unknown caller 8955 1 SieveBits.sieve()V SieveBits.main(Ljava/lang/String;)V 6538

  7. ProfileViewer • Read profiling information of JDK1.1 style, and displays it for easy interpretation • Location http://www.capital.net/~dittmer/profileviewer.html • Requirement • swing : http://java.sun.com/products/jfc/index.html • collection : http://java.sun.com/beans/infobus

  8. JDK 1.2 style profile • How to get profile information? • java -Xrunhprof:cpu=[times|samples] class_file • Output(java.hprof.txt) format • rank : according to self value • self : % of total samples where this method is included in the trace • accum : % of total samples where the methods from rank 1 to this are

  9. Output example rank self accum method 1 93.12% 10.51% SieveBits.main ([Ljava/lang/String;)V 2 67.75% 39.13% SieveBits.sieve ()V 3 27.54% 66.67% BitSet.clear (I)V 4 14.49% 81.16% BitSet.get (I)Z 5 11.59% 92.75% BitSet.set (I)V

  10. JProbe • Location • http://www.klgroup.com/jprobe • Evaluation version is available(Window, Sparc) • Install • run ‘java profiler25’ • set install directory to INSTALL • Run • run ‘$INSTALL/profiler/jpprofiler’

  11. Limitation • Granulariry • routine(method) • time sample • JIT • compiler optimization(e.g., inlining)

  12. Summary • For most profile tools, method count, execution time, call graph are provided. • Graphical tool can give you an insight about entire execution easily.

More Related