Profile Entire Java Program Execution in VisualVM

后端 未结 4 750
星月不相逢
星月不相逢 2020-12-23 11:35

In Java profiling, it seems like all (free) roads nowadays lead to the VisualVM profiler included with JDK6. It looks like a fine program, and everyone touts how you can \

4条回答
  •  生来不讨喜
    2020-12-23 12:08

    Consider using HPROF and opening the data file with a tool like HPjmeter - or just reading the resulting text file in your favorite editor.

    Command used: javac -J-agentlib:hprof=heap=sites Hello.java
    
    SITES BEGIN (ordered by live bytes) Fri Oct 22 11:52:24 2004
              percent          live          alloc'ed  stack class  rank   self  accum     bytes objs     bytes  objs trace name
        1 44.73% 44.73%   1161280 14516  1161280 14516 302032 java.util.zip.ZipEntry
        2  8.95% 53.67%    232256 14516   232256 14516 302033 com.sun.tools.javac.util.List
        3  5.06% 58.74%    131504    2    131504     2 301029 com.sun.tools.javac.util.Name[]
        4  5.05% 63.79%    131088    1    131088     1 301030 byte[]
        5  5.05% 68.84%    131072    1    131072     1 301710 byte[]
    

    HPROF is capable of presenting CPU usage, heap allocation statistics, and monitor contention profiles. In addition, it can also report complete heap dumps and states of all the monitors and threads in the Java virtual machine.

提交回复
热议问题