Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
287 views
in Technique[技术] by (71.8m points)

java - HPjmeter-like graphical tool to view -agentlib:hprof profiling output

What tools are available to view the output of the built-in JVM profiler? For example, I'm starting my JVM with:

-agentlib:hprof=cpu=times,thread=y,cutoff=0,format=a,file=someFile.hprof.txt

This generates output in the hprof ("JAVA PROFILE 1.0.1") format.

I have had success in the past using HPjmeter to view these output files in a reasonable way. However, for whatever reason the files that are generated using the current version of the Sun JVM fail to load in the current version of HPjmeter:

java.lang.NullPointerException
    at com.hp.jmeter.f.jb.a(Unknown Source)
    at com.hp.jmeter.f.a.a(Unknown Source)
    at com.hp.c.a.j.z.run(Unknown Source)
Exception in thread "HPeprofDataFileReaderThread" java.lang.AssertionError: null pointer exception from loader
    at com.hp.jmeter.f.a.a(Unknown Source)
    at com.hp.c.a.j.z.run(Unknown Source)

(Why would they obfuscate the bytecode for a free product?!)

Two questions arise from this:

  1. Does anyone know the cause of this HPjmeter error? (EDIT: Yes--see below)
  2. What other tools exist to read hprof files? And why are there none from Sun (are there)?

I know the Eclipse TPTP and other tools can monitor JVMTI data on the fly, but I need a solution that can process the generated hprof files after the fact since the deployed machine only has a JRE (not a JDK) intalled.

EDIT: A very helpful HPjmeter developer replied to my question on an HP ITRC forum indicating that heap=dump needs to be included in the -agentlib options temporarily until a bug in HPjmeter is fixed. This information makes HPjmeter viable again, but I will still leave the question open to see if anyone knows of any other tools.

EDIT: As of version 4.0.00 of HPjmeter (available 05/2009) this bug has been fixed.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Your Kit Java Profiler is able to read hprof snapshots (I am not sure if only for memory profiling or for CPU as well). It is not free but is by far the best java profiler I ever used. It presents the results in a clear, intuitive way and performs well on large data sets. The documentation is also pretty good.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...