To automatically track startup performance in an app
use the command-line parameter sun.perflog as follows:
-Dsun.perflog[=file:<filename>]
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.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | PerformanceLogger.
Internal class used to store time/message data together. |
| Modifier and Type | Field 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 | |
| private static boolean |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private static long | |
| public static String | |
| 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 | |
| public static boolean | |
| public static void | |
| 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 | |
| public static void | |
| public static int | |
| public static int |
| baseTime | back to summary |
|---|---|
| private static long baseTime | |
| LAST_RESERVED | back to summary |
|---|---|
| private static final int LAST_RESERVED | |
| logFileName | back to summary |
|---|---|
| private static String logFileName | |
| logWriter | back to summary |
|---|---|
| private static Writer logWriter | |
| perfLoggingOn | back to summary |
|---|---|
| private static boolean perfLoggingOn | |
| START_INDEX | back to summary |
|---|---|
| private static final int START_INDEX | |
| times | back to summary |
|---|---|
| private static Vector<PerformanceLogger. | |
| useNanoTime | back to summary |
|---|---|
| private static boolean useNanoTime | |
| PerformanceLogger | back to summary |
|---|---|
| public PerformanceLogger() | |
| getCurrentTime | back to summary |
|---|---|
| private static long getCurrentTime() Return the current time, in millis or nanos as appropriate | |
| getMessageAtIndex | back to summary |
|---|---|
| public static String getMessageAtIndex(int index) Returns message at given index. | |
| getStartTime | back 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. | |
| getTimeAtIndex | back to summary |
|---|---|
| public static long getTimeAtIndex(int index) Returns time at given index. | |
| loggingEnabled | back to summary |
|---|---|
| public static boolean loggingEnabled() Returns status of whether logging is enabled or not. This is provided as a convenience method. | |
| outputLog | back to summary |
|---|---|
| public static void outputLog(Writer writer) Outputs all data to parameter-specified Writer object | |
| outputLog | back to summary |
|---|---|
| public static void outputLog() Outputs all data to whatever location the user specified via sun.perflog command-line parameter. | |
| setBaseTime | back to summary |
|---|---|
| public static void setBaseTime(long time) Sets the base time, output can then be displayed as offsets from the base time;. | |
| setStartTime | back to summary |
|---|---|
| public static void setStartTime(String message) Sets the start time. Ideally, this is the earliest time available during the startup of an application. This time is later used to analyze the difference between the initial startup time and other events in the system. | |
| setStartTime | back 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. | |
| setTime | back 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. | |
| setTime | back 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. | |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv String | |
| pack-priv long |
| message | back to summary |
|---|---|
| pack-priv String message | |
| time | back to summary |
|---|---|
| pack-priv long time | |
| TimeData | back to summary |
|---|---|
| pack-priv TimeData(String message, long time) | |
| getMessage | back to summary |
|---|---|
| pack-priv String getMessage() | |
| getTime | back to summary |
|---|---|
| pack-priv long getTime() | |