科技行者

行者学院 转型私董会 科技行者专题报道 网红大战科技行者

知识库

知识库 安全导航

至顶网软件频道基础软件JROCKIT 5.0——轻松玩转JVM

JROCKIT 5.0——轻松玩转JVM

  • 扫一扫
    分享文章到微信

  • 扫一扫
    关注官方公众号
    至顶头条

  BEA JRockit Java虚拟机(JVM)所带来的不仅仅是性能的提升。本文探讨了JRockit 5.0 R26版本可用的一些管理和使用方面的特性

作者:中国IT实验室 来源:中国IT实验室 2007年8月24日

关键字:

  • 评论
  • 分享微博
  • 分享邮件

用法

  • 创建一个名为ctrlhandler.act的文件。
  • 向ctrlhandler.act文件添加命令(参见下文命令列表)。
  • 以“stop”结束文件,这是结束文件分析的保留命令。
  • 按下ctrl-break,每一个命令都将以出现的顺序执行。

  JRockit首先会在当前工作目录查找该文件。如果未找到,JRockit将在JVM目录中查找。如果仍然没有的话,JRockit将回退以生成一个常规的线程堆栈转储。JRockit将在每次按下ctrl-break时读取act文件,因此用户可以在方便时重新配置该文件,而同时JRockit仍在运行。

  这里给出一个示例act文件,它首先打印时间戳,然后是用于启动JRockit的命令行,最后是一个线程堆栈转储。它还包括可以用于act文件的有用命令的列表:

# Example ctrlhandler.act file
timestamp
command_line
print_threads
stop

# set_filename filename=<file> [append=true]
#  Sets the file that all handlers following this command will
#  use for printing. You can have several set_filename commands
#  in a file. It takes two arguments:  filename and an optional
#  append to specify if you want to append to the file 
#  or overwrite it. Default is to overwrite the file. 

# timestamp
#  Prints a timestamp. 

# print_threads
#  The normal thread dump.

# verbosity [args=<components>] [filename=<file>]
#  Changes the verbosity level normally specified with -Xverbose. 

# version
#  Prints JRockit version information. 

# command_line
#  Prints the command line used to start JRockit. 
#  print_object_summary
#  Prints heap usage statistics (how much heap is used per class),
#  together with a delta on how much this has changed since
#  the last invocation of this ctrl-break handler.

# print_memusage
#  Prints a memory usage report of how JRockit is using
#  the memory.

# heap_diagnostics
#  Prints a detailed report of the heap, including ascii graphics 
#  over the heap layout.

# print_class_summary
#  Prints all loaded classes. 

# print_utf8pool
#  Print all UTF8 strings. 

# jrarecording [filename=<file>] [time=<time>] [nativesamples=true]
#  Starts a JRA recording.

# run_optfile [filename=<file>]
#  See OptFile. 

# start_management_server
#  Starts the new JMX-based management agent. 

# kill_management_server
#  Stops the management agent. 

# start_rmp_server
#  Starts the old management server (actually the listening 
#  socket that in turn starts servers whenever a connection
#  is established). 

# kill_rmp_server
#  Stops the old management server (actually shuts down the
#  listening socket). The only reason it isn't named 
#  kill_rmp_server is that stop is a reserved keyword 
#  that stops the parsing of the act file. ;) 

# help [ctrl-break handler]
#  Prints all available ctrl-break handlers if no argument 
#  is specified, or help for the specified ctrl-break handler.

# memleakserver [port=<port>]
#  Toggles the memleakserver. If it hasn't been started 
#  it will be started. If it has already started, it will be
#  shut down. The default port is 7095.

# verbose_referents action=[heap|full|nursery|start|stop]
#  Print verbose reference information.
#  Parameters:
#   action=[heap|full|nursery|start|stop]
#    heap    - trigger a heap collection and output reference
#              information
#    full    - trigger a full heap collection (clears softly 
#              reached soft referents)
#    nursery - trigger a nursery collection (heap collection 
#              if running without nursery)
#    start   - start writing reference information to default
#              verbose stream
#    stop    - stop writing reference information

# print_exceptions 
#  exceptions=[true|all|false] stacktraces=[true|all|false]
#  Enable printing of Java exceptions thrown in the VM.
#  Parameters:
#    exceptions    - print exceptions
#    stacktraces   - print exceptions with stacktraces
#  At least one of the parameters is required.
#  Values for the parameters can be "true|all|false"
#    true  - print all exceptions 
#             except java/util/EmptyStackException,
#             java/lang/ClassNotFoundException and 
#             java/security/PrivilegedActionException
#    all   - print all exceptions
#    false - don't print exceptions
#  To turn exception printing off completely you need to set
#   exceptions = false even if it was turned 
#   on by stacktraces = true.
JRCMD
使用JRCMD实用工具是一种新的调用Ctrl-Break Handler的便捷方式,可在JRockit发行版的bin目录中找到它。
用法
jrcmd <PID> <command> <parameters>

JRCMD
  使用JRCMD实用工具是一种新的调用Ctrl-Break Handler的便捷方式,可在JRockit发行版的bin目录中找到它。

用法 jrcmd <PID> <command> <parameters>

  • PID = 要在其中执行Ctrl-Break Handler的JRockit进程的进程ID。
  • command = 要执行的Ctrl-Break Handler命令。
  • parameters = Ctrl-Break Handler的参数。

  如果不指定选项(或者只指定-P),那么将显示运行在本地机器上的所有JRockit的进程ID。如果PID设为0,那么命令将发送给在本地机器上运行的所有JRockit JVM。

  要列出特定的JRockit中有哪些Ctrl-Break Handler可用,可以使用help命令:

jrcmd <PID> help

  要想获得某个具体的Ctrl-Break Handler的帮助信息,需要在help后添加Ctrl-Break Handler的名称,比如:

jrcmd 0 help kill_management_server

  也可以使用JRCMD列出指定进程的性能计数:

jrcmd <PID> -l

    • 评论
    • 分享微博
    • 分享邮件
    邮件订阅

    如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。

    重磅专题
    往期文章
    最新文章