The HPROF Profiler

The Heap and CPU Profiling Agent (HPROF)是JAVA2 SDK自带的一个简单的profiler代理,它通过与Java Virtual Machine Profiler Interface (JVMPI) 交互,将profiling信息通过本地文件或socket输出ASCII或二进制格式的流。

HPROF可以监控CPU使用率,堆分配统计。除此之外,还可以报告JVM所有监视器和线程的完整的堆的dump状态。

HPROF的JVM参数的语法如下:

-Xrunhprof[:help]|[:param=value,param2=value2, ...]

示例:

-Xrunhprof:file=log.txt,thread=y,depth=

The file parameter determines where the stack dump is written.

file参数决定dump的堆栈写入到那个文件。

HPROF的详细参数如下:

Hprof usage: -Xrunhprof[:help]|[:<option>=<value>, ...]

Option Name and Value   Description             Default
--------------------- ----------- -------
heap=dump|sites|all heap profiling all
cpu=samples|old CPU usage off
format=a|b ascii or binary output a
file=<file> write data to file java.hprof
(.txt for ascii)
net=<host>:<port> send data over a socket write to file
depth=<size> stack trace depth
cutoff=<value> output cutoff point 0.0001
lineno=y|n line number in traces? y
thread=y|n thread in traces? n
doe=y|n dump on exit? y

一个javac的示例

Command used: javac -J-agentlib:hprof=cpu=samples Hello.java

CPU SAMPLES BEGIN (total = ) Fri Oct  ::
rank self accum count trace method
53.17% 53.17% java.util.zip.ZipFile.getEntry
17.46% 70.63% java.util.zip.ZipFile.getNextEntry
5.56% 76.19% java.lang.ClassLoader.defineClass2
3.97% 80.16% java.io.UnixFileSystem.list
2.38% 82.54% java.lang.Shutdown.halt0
1.59% 84.13% java.util.zip.ZipEntry.initFields
1.59% 85.71% java.lang.String.substring
1.59% 87.30% java.util.zip.ZipFile.open
0.79% 88.10% com.sun.tools.javac.code.Type$ErrorType.<init>
0.79% 88.89% java.util.zip.ZipFile.ensureOpen

参考 http://docs.oracle.com/cd/E19798-01/821-1752/beafo/index.html

http://stackoverflow.com/questions/11737013/java-profile-tool-without-gui

java命令行HPROF Profiler的更多相关文章

  1. java命令行HPROF Profiler(转)

    The HPROF Profiler The Heap and CPU Profiling Agent (HPROF)是JAVA2 SDK自带的一个简单的profiler代理,它通过与Java Vir ...

  2. Java命令行的基本编译运行

    1.编译 编写MyProgram.java文件,内容如下: public class MyProgram { public static void main(String[] args) { Syst ...

  3. Linux java 命令行编译 jar包

    Java 命令行编译成class,然后在打包成jar文件. 编译成class javac -classpath $CLASS_PATH -d class ./src/Hello.java 可以通过ja ...

  4. java命令行执行程序解决依赖外部jar包的问题

    用java命令行直接执行程序,如果这个程序需要引用外部jar包.就不能单纯用java xx来执行 如果你的jar包和程序就在一个目录: 编译 javac -cp D:\yy\yy.jar,D\xx\x ...

  5. java命令行打war

    java命令行打war(windows下) 切换到需要打包文件夹low的上级目录>jar -cfM legendwealth.war -C low .

  6. Java 命令行编译项目

    如果是用Exlipse, 第三方的包可以放在eclipse文件夹的jre包的lib文件夹中! (初学者的一些总结-高手们勿喷哈-) 原因: 以前一直用Eclispe编程环境运行Java.非常舒服,就像 ...

  7. java命令行从编译到打jar包到执行

     目录: 一. javac编译     1. 没有额外的jar包     2. 包含额外的jar包 二. jar打jar包 三. java运行     1. java命令执行     2. jar包执 ...

  8. Java - Java 命令行简介: 选项, 属性, 参数

    概述 简单介绍一下 java 命令行相关的参数及属性 1. java 命令行 基本 命令 > java <mainClass> 描述 执行 Java 类 需要准备好编译完成的 mai ...

  9. java命令行输入参数

    Java命令行输入参数 代码用例:命令行输入参数,并进行加法运算. public class Demo01 { public static void main(String[] args) { for ...

随机推荐

  1. jquery商城购物车右侧悬浮加入购物车动画效果

    <script type="text/javascript" src="js/jquery-1.7.min.js"></script> ...

  2. js部分---运算符,if分支语句,for循环;switch case 的用法;

    ------------------------------------------运算符---------------------------------------------------- *数 ...

  3. 使用配置方式进行ssh的整合以及管理员管理的案例(二)

    (续) 删除Hibernate配置文件的写法: 在applicationContext.xml中添加数据库操作的相关配置: <!-- 配置数据库连接池 -->    <bean id ...

  4. MySQL日志功能

    1.查询日志 log={ON|OFF}:是否记录所有语句的日志信息于一般查询日志文件(general_log); log_output={TABLE|FILE|NONE},TABLE和FILE可以同时 ...

  5. windows 10安装framework 3.5失败的解决方案

    装了两次win 10,全都因为没法安装framework 3.5,用不了老版本的开发环境,又换回了win7. 网上有两种解决方案: a,通过iso安装. 可是拜托,我的系统都是用ghost版本安装的, ...

  6. 强化学习之 免模型学习(model-free based learning)

    强化学习之 免模型学习(model-free based learning) ------ 蒙特卡罗强化学习 与 时序查分学习 ------ 部分节选自周志华老师的教材<机器学习> 由于现 ...

  7. read the python code and predict the results --- from <Learn Python The Hard Way>

    import random from urllib import urlopen import sys WORD_URL = "http://learncodethehardway.org/ ...

  8. http协议传输二进制数据以及对输入流(php://input)和http请求的理解

    1.index.php <?php $data=file_get_contents('./a.jpg'); $opts = array('http' => array( 'method' ...

  9. kvo-观察者-iOS

    #import <Foundation/Foundation.h> @interface Child : NSObject @property (nonatomic,assign) int ...

  10. ABBYY FineReader无法打开TWAIN源怎么办

    ABBYY FineReader OCR文字识别软件不仅可以将PDF文档和图像文件(包括数码照片)转换为可编辑.可搜索的格式,还可以用来扫描文档,但在扫描过程中,有时可能会出现以下两种错误信息:一是无 ...