public class

PerformanceLogger

extends Object
java.lang.Object
   ↳ sun.misc.PerformanceLogger

Class Overview

This class is intended to be a central place for the jdk to log timing events of interest. There is pre-defined event of startTime, as well as a general mechanism of setting aribtrary times in an array. All unreserved times in the array can be used by callers in application-defined situations. The caller is responsible for setting and getting all times and for doing whatever analysis is interesting; this class is merely a central container for those timing values. Note that, due to the variables in this class being static, use of particular time values by multiple applets will cause confusing results. For example, if plugin runs two applets simultaneously, the initTime for those applets will collide and the results may be undefined.

To automatically track startup performance in an app or applet, use the command-line parameter sun.perflog as follows:
-Dsun.perflog[=file:]
where simply using the parameter with no value will enable output to the console and a value of "file:" will cause that given filename to be created and used for all output.

By default, times are measured using System.currentTimeMillis(). To use System.nanoTime() instead, add the command-line parameter:
-Dsun.perflog.nano=true

Warning: Use at your own risk! This class is intended for internal testing purposes only and may be removed at any time. More permanent monitoring and profiling APIs are expected to be developed for future releases and this class will cease to exist once those APIs are in place.

Summary

Public Constructors
PerformanceLogger()
Public Methods
static String getMessageAtIndex(int index)
Returns message at given index.
static long getStartTime()
Gets the start time, which should be the time when the java process started, prior to the VM actually being loaded.
static long getTimeAtIndex(int index)
Returns time at given index.
static boolean loggingEnabled()
Returns status of whether logging is enabled or not.
static void outputLog(Writer writer)
Outputs all data to parameter-specified Writer object
static void outputLog()
Outputs all data to whatever location the user specified via sun.perflog command-line parameter.
static void setStartTime(String message, long time)
Sets the start time.
static void setStartTime(String message)
Sets the start time.
static int setTime(String message, long time)
Sets the value of a given time and returns the index of the slot that that time was stored in.
static int setTime(String message)
Sets the value of a given time and returns the index of the slot that that time was stored in.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public PerformanceLogger ()

Public Methods

public static String getMessageAtIndex (int index)

Returns message at given index.

public static long getStartTime ()

Gets the start time, which should be the time when the java process started, prior to the VM actually being loaded.

public static long getTimeAtIndex (int index)

Returns time at given index.

public static boolean loggingEnabled ()

Returns status of whether logging is enabled or not. This is provided as a convenience method so that users do not have to perform the same GetPropertyAction check as above to determine whether to enable performance logging.

public static void outputLog (Writer writer)

Outputs all data to parameter-specified Writer object

public static void outputLog ()

Outputs all data to whatever location the user specified via sun.perflog command-line parameter.

public static void setStartTime (String message, long time)

Sets the start time. This version of the method is given the time to log, instead of expecting this method to get the time itself. This is done in case the time was recorded much earlier than this method was called.

public static void setStartTime (String message)

Sets the start time. Ideally, this is the earliest time available during the startup of a Java applet or application. This time is later used to analyze the difference between the initial startup time and other events in the system (such as an applet's init time).

public static int setTime (String message, long time)

Sets the value of a given time and returns the index of the slot that that time was stored in. This version of the method is given the time to log, instead of expecting this method to get the time itself. This is done in case the time was recorded much earlier than this method was called.

public static int setTime (String message)

Sets the value of a given time and returns the index of the slot that that time was stored in.