A utility for generating execution traces of JavaTM 1.2 applications.

Alden Dima alden.dima@nist.gov



Fig 1. Sample VMView trace.



VMView Topics

Legal Notice
Introduction
Tracing JavaTM Applications using the JDK
The VMView Architecture
VMView DLL
The VMView GUI
VMView Requirements
Downloading VMView


Legal Notice

VMView is released by the National Institute of Standards and Technology (NIST), an agency of the U.S. Department of Commerce, Gaithersburg MD 20899, USA.  VMView bears no warranty, either express or implied.  NIST does not assume legal liability nor responsibility for a User's use of VMView or the results of such use.

This software was developed at the National Institute of Standards and Technology by employees of the Federal Government in the course of their official duties. Pursuant to title 17 Section 105 of the United States Code this software is not subject to copyright protection and is in the public domain.

We would appreciate acknowledgement if the software is used.

JAVA AND ALL JAVA-BASED TRADEMARKS AND LOGOS ARE TRADEMARKS OR REGISTERED TRADEMARKS OF SUN MICROSYSTEMS, INC. IN THE UNITED STATES AND OTHER COUNTRIES.


Introduction

VMView was originally conceived as a means to determine whether a particular Java virtual machine implementation conforms to the Java Virtual Machine Specification.  The idea was to find a way to observe internal state changes of the JVM during the execution of Java test programs.  The internal VM state would be captured as execution traces, which could then be analyzed.

The first experimental implementation of VMView was based on source-level changes to the kaffe VM (available from Transvirtual Technologies). While this approach worked, we wanted something more general.  With the exception of "open" VMs like kaffe, it would be difficult to obtain source code for each VM for which VMView might possibly work.  In addition, implementations may vary greatly, so a substantial piece of VMView might have to be redone for each VM.

Sun’s beta JDK1.2 introduced JVMDI – the Java Virtual Machine Debugger Interface – that promises to simplify the creation of tools like VMView.  In principle, it is possible that VMView could be just recompiled for different VMs.

During development, it was discovered that some of the functionality needed for VMView was yet to be implemented in JVMDI.  VMView was refocused as a development utility that would allow Java programmers to generate traces while their programs are being debugged.


Tracing Java applications using the JDK

Prior to Java 2 (JDK 1.2) the Java Development Kit allowed for execution tracing of Java applications.  Tracing via the JDK was accomplished using a special Java interpreter, java_g, which performed bytecode level and method level tracing.  However, unlike VMView-based tracing, JDK-based tracing was an all or nothing proposition.  Once enabled, the tracing occured for all classes loaded by the virtual machine.  As a result, the traces grew to huge proportions quickly.

For example, consider the canonical "Hello World" program:

public class HelloWorld 
   { 
   public static void main(String[] argv) 
      { 
      System.out.println("Hello, World!"); 
      } 
   }
If executed using the java_g's bytecode tracing option (-t), the trace output contained over 149,000 lines or about 6.4 MB of data.  When tracing method calls using the -tm option, the trace output contained 4,819 lines or about 400 kilobytes of data.

In contrast, VMView produces a 6 line, 360 byte bytecode trace and 27 line, 399 byte method call trace.  The difference in size between the JDK-based trace and the VMView-based trace is due to the fact that VMView-based trace is much more focused - VMView can trace individual classes, whereas java_g traces all loaded classes.

NOTE:  java_g is no longer included with the JDK distribution.


The VMView Architecture

VMView consists of the following major components:
A Windows dynamic-link library (DLL) written in C++.
A Tcl/Tk-based GUI.


VMView DLL

The VMView DLL contains:
An "event hook" function which provides a means for an event-generating Java application thread to notify VMView that an event has occurred.
An EventData class to encapsulate the VM event data.
Event Actions which query the state of the VM to generate the items found in the trace.


The VMView GUI

VMView's graphical user interface was implemented with the Tool Command Language (Tcl) and its GUI Toolkit (Tk).  The VMView GUI serves as the basic means of user interaction with VMView. It allows for the following:

Presentation and editing of traces – Traces are displayed in a scrollable Tk text widget.  They can be searched using Unix-style regular expression searches.  Certain standard features of a trace such as method invocations can be highlighted to make them more visible.  Standard selection, cut, and paste operations are available for editing the trace.

Saving and retrieving traces – Traces are saved in ASCII text format with a ".out" file extension.  They can then be retrieved for later viewing.  File saving and retrieval operations are performed via the standard Windows file dialogs.


VMView Requirements

Download VMView 1.0 beta 2a


NIST

Software Diagnostics & Conformance Testing

By selecting the following links, you will be leaving NIST web space.  We have provided these links to other web sites because they may have information that would be of interest to you.  No inferences should be drawn on account of other sites being referenced, or not, from this page.  There may be other web sites that are more appropriate for your purpose.  NIST does not necessarily endorse the views expressed, or concur with the facts presented on these sites.  Further, NIST does not endorse any commercial products that may be mentioned on these sites.  Please address comments about this page to alden.dima@nist.gov.

Transvirtual Technologies (Kaffe VM)

Scriptics(Tcl/Tk)

Sun Microsystems (JDK)



 

please direct all questions and comments to alden.dima@nist.gov
 

back to top

Created by Stanley Hsing
Updated by Alden Dima
Last Updated on: 5/13/99