ページ更新: 2005-03-23 (水) (5177日前)

目次

[編集]

スレッドダンプの例 #

ctrl+Pause (=Break) で

public class Dumpee {
    public static void main(String[] args) {
        long start = System.currentTimeMillis();
        System.out.println("start = " + start);
        while ((System.currentTimeMillis() - start) < 10*1000)
            ;
        System.out.println("elapsed = " + (System.currentTimeMillis() - start));
    }
}
> java Dumpee
start = 1068794743063
(ctrl+Pause)
Full thread dump Java HotSpot(TM) Client VM (1.4.1_05-b01 mixed mode):

"Signal Dispatcher" daemon prio=10 tid=0x009E8860 nid=0xdf8 waiting on condition
 [0..0]

"Finalizer" daemon prio=9 tid=0x0003EBA0 nid=0x53c in Object.wait() [ab6f000..ab
6fd8c]
        at java.lang.Object.wait(Native Method)
        - waiting on <02A60498> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:111)
        - locked <02A60498> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:127)
        at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)

"Reference Handler" daemon prio=10 tid=0x0003D770 nid=0x95c in Object.wait() [ab
2f000..ab2fd8c]
        at java.lang.Object.wait(Native Method)
        - waiting on <02A60388> (a java.lang.ref.Reference$Lock)
        at java.lang.Object.wait(Object.java:426)
        at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:113)
        - locked <02A60388> (a java.lang.ref.Reference$Lock)

"main" prio=5 tid=0x00034D00 nid=0x9bc runnable [7f000..7fc40]
        at java.lang.System.currentTimeMillis(Native Method)
        at Dumpee.main(Dumpee.java:7)

"VM Thread" prio=5 tid=0x009E54E8 nid=0xd48 runnable

"VM Periodic Task Thread" prio=10 tid=0x009E73F0 nid=0xdfc waiting on condition

"Suspend Checker Thread" prio=10 tid=0x009E7EA0 nid=0x914 runnable
(プログラムは続行...)
[編集]

-XX:+PrintCompilation -XX:+CITime の例 #

VM引数に「-XX:+PrintCompilation -XX:+CITime」を追加して実行すると:

  1 s b   java.lang.StringBuffer::append (40 bytes)
  2   b   java.lang.String::indexOf (74 bytes)
  3   b   java.lang.String::equals (89 bytes)
  4   b   java.lang.String::indexOf (140 bytes)
  5   b   java.lang.String::hashCode (60 bytes)
  6   b   java.lang.String::charAt (33 bytes)
  7   b   java.lang.String::lastIndexOf (67 bytes)
  8   b   java.lang.String::replace (142 bytes)
  9   b   sun.io.ByteToCharMS932::convSingleByte (19 bytes)
 10   b   java.lang.CharacterDataLatin1::getProperties (6 bytes)
 11   b   java.io.Win32FileSystem::normalize (143 bytes)
COUNT=10000
 12   b   java.lang.Character::toLowerCase (17 bytes)
 13   b   java.lang.CharacterDataLatin1::toLowerCase (37 bytes)
 14*  b   java.lang.System::arraycopy (0 bytes)
 15   b   java.lang.String::getChars (66 bytes)
 16 s b   java.lang.StringBuffer::append (56 bytes)
 17   b   java.lang.StringBuffer::expandCapacity (56 bytes)
 18 s b   java.lang.StringBuffer::length (5 bytes)
 19   b   java.lang.StringBuffer::<init> (17 bytes)
 20   b   java.lang.StringBuffer::toString (9 bytes)
 21  !b   java.lang.String::<init> (49 bytes)
 22   b   java.lang.StringBuffer::<init> (7 bytes)
10062ms
31ms
16ms
end.

Accumulated compiler times (for compiled methods only)
------------------------------------------------
  Total compilation time   :  0.010 s
    Standard compilation   :  0.010 s, Average : 0.000
    On stack replacement   :  0.000 s, Average : -1.#IO
    Native methods         :  0.000 s, Average : 0.000
    Detailed C1 Timings
       Setup time:         0.001 s ( 7.6%)
       Build IR:           0.003 s (34.9%)
         Optimize:            0.000 s ( 4.2%)
         Loop Comp.:          0.000 s ( 2.7%)
       Emit LIR:           0.001 s (16.1%)
       Cache Locals:       0.001 s ( 7.5%)
       LIR Optimize:       0.001 s (10.6%)
       Code Emission:      0.002 s (18.1%)
       Code Installation:  0.000 s ( 5.2%)
       Instruction Nodes:   1421 nodes

  Total compiled bytecodes :   1290 bytes
    Standard compilation   :   1290 bytes
    On stack replacement   :      0 bytes
  Average compilation speed: 132511 bytes/s

  nmethod code size        :   5766 bytes
  nmethod total size       :  12176 bytes
 23 s b   java.io.BufferedOutputStream::write (35 bytes)
 24   b   java.io.DataOutputStream::incCount (20 bytes)
 25   b   java.io.DataOutputStream::writeInt (65 bytes)
  1% !b   com.cortexeb.tools.clover.g::flush @ 141 (237 bytes)