70 likes | 165 Views
Quick Updates - Profiling. Hprof ( java ) Adventures in gprof. Hprof. To get options as well as if its there: Java –Xrunhprof:help. Hprof – how to run. Java –Xrunhprof:cpu=samples execfilename < input file > output file
E N D
Quick Updates - Profiling Hprof ( java ) Adventures in gprof
Hprof • To get options as well as if its there: Java –Xrunhprof:help
Hprof – how to run Java –Xrunhprof:cpu=samples execfilename < input file > output file Profiling output turns up in a textedit form in a file called java.hprof.txt Bottom of file looks like this: Command used: javac -J-agentlib:hprof=cpu=samples Hello.java CPU SAMPLES BEGIN (total = 126) Fri Oct 22 12:12:14 2004 rank self accum count trace method 1 53.17% 53.17% 67 300027 java.util.zip.ZipFile.getEntry 2 17.46% 70.63% 22 300135 java.util.zip.ZipFile.getNextEntry 3 5.56% 76.19% 7 300111 java.lang.ClassLoader.defineClass2 4 3.97% 80.16% 5 300140 java.io.UnixFileSystem.list 5 2.38% 82.54% 3 300149 java.lang.Shutdown.halt0 6 1.59% 84.13% 2 300136 java.util.zip.ZipEntry.initFields 7 1.59% 85.71% 2 300138 java.lang.String.substring 8 1.59% 87.30% 2 300026 java.util.zip.ZipFile.open 9 0.79% 88.10% 1 300118 com.sun.tools.javac.code.Type$ErrorType.<init> 10 0.79% 88.89% 1 300134 java.util.zip.ZipFile.ensureOpen
Hprof – Questions? • Source: Beginning Algorithms by Harris and Ross Isbn 139780764596742
Quick Updates: gprof • Modify the makefile • CXXFLAGS entry was –ggdb • Now is –ggdb –pg • Then compile and run code…..
gprof • Then run code…. Lcs –F test3 • And in the directory you will find: Gmon.out
gprof • But how to view? gprof –b lcs gmon.out Mine was 8 pages in length double sided.