Top Description Inners Fields Constructors Methods
com.sun.javafx.tk.quantum

public Class PerformanceLogger

extends Object
Class Inheritance
Imports
java.util.Vector, java.io.FileWriter, .File, .OutputStreamWriter, .Writer

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 arbitrary 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 applications would cause confusing results. This doesn't happen in practice.

To automatically track startup performance in an app, use the command-line parameter sun.perflog as follows:

-Dsun.perflog[=file:<filename>]

where simply using the parameter with no value will enable output to the console and a value of "file:<filename>" 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.

Author
Chet Haase Note: This file a copy for sun.misc.PerformanceLogger before it was moved to sun.awt.util and JavaFX do not want to be dependent on awt if possible.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
PerformanceLogger.TimeData

Internal class used to store time/message data together.

Field Summary

Modifier and TypeField and Description
private static long
private static final int
private static String
private static Writer
private static boolean
private static final int
private static Vector<PerformanceLogger.TimeData>
private static boolean

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static long
getCurrentTime()

Return the current time, in millis or nanos as appropriate

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.

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
setBaseTime(long time)

Sets the base time, output can then be displayed as offsets from the base time;.

public static void
setStartTime(String message)

Sets the start time.

public static void
setStartTime(String message, long time)

Sets the start time.

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.

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.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

baseTimeback to summary
private static long baseTime
LAST_RESERVEDback to summary
private static final int LAST_RESERVED
logFileNameback to summary
private static String logFileName
logWriterback to summary
private static Writer logWriter
perfLoggingOnback to summary
private static boolean perfLoggingOn
START_INDEXback to summary
private static final int START_INDEX
timesback to summary
private static Vector<PerformanceLogger.TimeData> times
useNanoTimeback to summary
private static boolean useNanoTime

Constructor Detail

PerformanceLoggerback to summary
public PerformanceLogger()

Method Detail

getCurrentTimeback to summary
private static long getCurrentTime()

Return the current time, in millis or nanos as appropriate

getMessageAtIndexback to summary
public static String getMessageAtIndex(int index)

Returns message at given index.

getStartTimeback to summary
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.

getTimeAtIndexback to summary
public static long getTimeAtIndex(int index)

Returns time at given index.

loggingEnabledback to summary
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.

outputLogback to summary
public static void outputLog(Writer writer)

Outputs all data to parameter-specified Writer object

outputLogback to summary
public static void outputLog()

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

setBaseTimeback to summary
public static void setBaseTime(long time)

Sets the base time, output can then be displayed as offsets from the base time;.

setStartTimeback to summary
public static void setStartTime(String message)

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

setStartTimeback to summary
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.

setTimeback to summary
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.

setTimeback to summary
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.

com.sun.javafx.tk.quantum back to summary

pack-priv Class PerformanceLogger.TimeData

extends Object
Class Inheritance

Internal class used to store time/message data together.

Field Summary

Modifier and TypeField and Description
pack-priv String
pack-priv long

Constructor Summary

AccessConstructor and Description
pack-priv
TimeData(String message, long time)

Method Summary

Modifier and TypeMethod and Description
pack-priv String
pack-priv long
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

messageback to summary
pack-priv String message
timeback to summary
pack-priv long time

Constructor Detail

TimeDataback to summary
pack-priv TimeData(String message, long time)

Method Detail

getMessageback to summary
pack-priv String getMessage()
getTimeback to summary
pack-priv long getTime()