1 1.1 christos The following are examples of j_cputime.d. 2 1.1 christos 3 1.1 christos This script traces the on-CPU time of Java methods and prints a report. Here 4 1.1 christos it traces the example program, Code/Java/Func_abc 5 1.1 christos 6 1.1 christos # j_cputime.d 7 1.1 christos Tracing... Hit Ctrl-C to end. 8 1.1 christos ^C 9 1.1 christos 10 1.1 christos Top 10 counts, 11 1.1 christos PID TYPE NAME COUNT 12 1.1 christos 311374 method java/lang/String.equals 202 13 1.1 christos 311374 method java/lang/Math.min 208 14 1.1 christos 311374 method java/lang/String.hashCode 213 15 1.1 christos 311374 method java/lang/String.indexOf 302 16 1.1 christos 311374 method java/lang/System.arraycopy 360 17 1.1 christos 311374 method java/lang/StringBuilder.append 533 18 1.1 christos 311374 method java/lang/AbstractStringBuilder.append 549 19 1.1 christos 311374 method java/lang/Object.<init> 823 20 1.1 christos 311374 method java/lang/String.charAt 1960 21 1.1 christos 0 total - 12020 22 1.1 christos 23 1.1 christos Top 10 on-CPU times (us), 24 1.1 christos PID TYPE NAME TOTAL 25 1.1 christos 26 1.1 christos Top 10 exclusive method on-CPU times (us), 27 1.1 christos PID TYPE NAME TOTAL 28 1.1 christos 311374 method java/io/FilePermission$1.run 1055 29 1.1 christos 311374 method java/util/Arrays.copyOf 1110 30 1.1 christos 311374 method sun/net/www/ParseUtil.decode 1161 31 1.1 christos 311374 method java/io/File.<clinit> 1212 32 1.1 christos 311374 method java/lang/StringBuilder.append 1228 33 1.1 christos 311374 method java/io/UnixFileSystem.normalize 1402 34 1.1 christos 311374 method java/lang/String.<init> 2251 35 1.1 christos 311374 method java/lang/String.charAt 2262 36 1.1 christos 311374 method java/lang/System.initializeSystemClass 2751 37 1.1 christos 0 total - 99868 38 1.1 christos 39 1.1 christos Top 10 inclusive method on-CPU times (us), 40 1.1 christos PID TYPE NAME TOTAL 41 1.1 christos 311374 method java/lang/ClassLoader.loadClassInternal 25826 42 1.1 christos 311374 method sun/misc/Launcher$ExtClassLoader.getExtClassLoader 25914 43 1.1 christos 311374 method java/net/URL.<init> 27677 44 1.1 christos 311374 method sun/misc/Launcher.<init> 28566 45 1.1 christos 311374 method sun/misc/Launcher.<clinit> 28744 46 1.1 christos 311374 method java/lang/ClassLoader.initSystemClassLoader 29241 47 1.1 christos 311374 method java/lang/ClassLoader.getSystemClassLoader 29249 48 1.1 christos 311374 method java/lang/System.initializeSystemClass 33814 49 1.1 christos 311374 method java/lang/ClassLoader.loadClass 66564 50 1.1 christos 311374 method java/security/AccessController.doPrivileged 67499 51 1.1 christos 52 1.1 christos You can see that it prints the top ten results in each of four categories. 53 1.1 christos 54 1.1 christos The first section reports how many times each subroutine was called, and it's 55 1.1 christos type. 56 1.1 christos 57 1.1 christos The second section reports on the on-CPU time of anything that was not of type 58 1.1 christos "method", in this case - none. 59 1.1 christos 60 1.1 christos The exclusive method on-CPU times shows, amongst other results, that 61 1.1 christos java/lang/String.charAt spent around 2,200 microseconds on-CPU. This times 62 1.1 christos excludes time spent in other subroutines. 63 1.1 christos 64 1.1 christos The inclusive method on-CPU times show the times that various methods 65 1.1 christos spent on-CPU. This includes the time spent in other subroutines called. 66 1.1 christos 67 1.1 christos These on-CPU times are the time the thread spent running on a CPU, from when 68 1.1 christos the subroutine began to when it completed. This does not include time 69 1.1 christos spent off-CPU time such as sleeping for I/O or waiting for scheduling. 70 1.1 christos 71 1.1 christos On-CPU times are useful for showing who is causing the CPUs to be busy. 72 1.1 christos See Notes/ALLoncpu_notes.txt for more details. Also see 73 1.1 christos Notes/ALLexclusive_notes.txt and Notes/ALLinclusive_notes.txt for a 74 1.1 christos detailed explanation of exclusive vs inclusive subroutine time. 75 1.1 christos 76