英文文献 科技类 原文及翻译 (电子 电气 自动化 通信…)74

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

英文文献科技类原文及翻译(电子电气自动化通

信…)74

Article

Creating a Debugging and Profiling Agent with JVMTI

Articles Index

The Java Virtual Machine Tool Interface (JVMTI) provides a programming interface that allows

you, the software developer, to create software agents that can monitor and control your Java

programming language applications. JVMTI is new in the Java 2 Software Development Kit

(SDK), Standard Edition, version 1.5.0. It replaces the Java Virtual Machine Profiling Interface

(JVMPI), which had been included as an experimental feature of the Java 2 SDK since version

1.1. JVMTI is described in JSR-163.

This article illustrates how to use JVMTI to create a debugging and profiling tool for Java applications. Such a tool, also called an agent, uses the functionality exposed by the interface

to register for notification of events as they occur in the application, and to query and control

the application. JVMTI documentation is available here. A JVMTI

agent can be useful for debugging and tuning an application. It can illustrate aspects of the application, such as

memory allocation, CPU utilization, and lock contention.

Even though JVMPI is experimental, it is being used by many Java technology developers, and in

several commercially-available Java application profilers. Please

note that developers are strongly encouraged to use JVMTI instead of JVMPI. JVMPI will be discontinued in the very near future.

JVMTI improves upon the functionality and performance of JVMPI in many ways. For example:

JVMTI relies on a callback for each event. This is more efficient

than the JVMPI design of using

event structures, which needed to be marshalled and unmarshalled.

JVMTI contains four times as many functions as JVMPI (including many more functions to

obtain information about variables, fields, methods, and classes).

For a complete index of the JVMTI

functions, see the Function Index page.

JVMTI provides notification for more types of events than does JVMPI, including exception

events, field access and modification events, and breakpoint and single-step events.

Some of the JVMPI events that were never fully utilized, such as arena new and delete, or that

can be better obtained through bytecode instrumentation, or the JVMTI functions themselves, (such

as heap dump and object allocation) have been dropped. A description of the events is available at

the Event Index page.

JVMTI is capability-based, whereas JVMPI was "all or nothing" with corresponding performance impact.

JVMPI heap functionality did not scale.

JVMPI had no error return information.

JVMPI was deeply invasive on VM implementations with resulting maintenance issues and

performance impacts.

JVMPI is experimental and will be discontinued very soon.

In the remainder of this article, we present a simple agent that uses JVMTI functions to extract

information from a Java application. The agent must be written in native code. The sample

agent shown here is written in the C programming language. You can download the complete sample agent code here. The following paragraphs describe how an agent is initialized, and

how the agent uses JVMTI functions to extract information about a Java application, as well as

相关文档
最新文档