17
Use of Profile Tool in Java 이이이 [email protected]

Use of Profile Tool in Java

  • Upload
    velvet

  • View
    70

  • Download
    1

Embed Size (px)

DESCRIPTION

Use of Profile Tool in Java. 이준표 [email protected]. 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 . - PowerPoint PPT Presentation

Citation preview

Page 1: Use of Profile Tool in Java

Use of Profile Tool in Java

이준표[email protected]

Page 2: Use of Profile Tool in Java

Overview

• What is profile?

• Default profiler of JDK

• Other profile tool

Page 3: Use of Profile Tool in Java

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.

Page 4: Use of Profile Tool in Java

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 call

er

Page 5: Use of Profile Tool in Java

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.

Page 6: Use of Profile Tool in Java

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

Page 7: Use of Profile Tool in Java

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

Page 8: Use of Profile Tool in Java
Page 9: Use of Profile Tool in Java
Page 10: Use of Profile Tool in Java

JDK 1.2 style profile

• How to get profile information?– java -Xrunhprof:cpu=[times|samples] class_fil

e

• 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 method

s from rank 1 to this are

Page 11: Use of Profile Tool in Java

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

Page 12: Use of Profile Tool in Java

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’

Page 13: Use of Profile Tool in Java
Page 14: Use of Profile Tool in Java
Page 15: Use of Profile Tool in Java
Page 16: Use of Profile Tool in Java

Limitation

• Granulariry– routine(method)– time sample

• JIT

• compiler optimization(e.g., inlining)

Page 17: Use of Profile Tool in Java

Summary

• For most profile tools, method count, execution time, call graph are provided.

• Graphical tool can give you an insight about entire execution easily.