2273N/A * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 0N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 1472N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A * or visit www.oracle.com if you need additional information or have any 0N/A * This class is intended to be a central place for the jdk to 0N/A * log timing events of interest. There is pre-defined event 0N/A * of startTime, as well as a general 0N/A * mechanism of setting aribtrary times in an array. 0N/A * All unreserved times in the array can be used by callers 0N/A * in application-defined situations. The caller is responsible 0N/A * for setting and getting all times and for doing whatever 0N/A * analysis is interesting; this class is merely a central container 0N/A * for those timing values. 0N/A * Note that, due to the variables in this class being static, 0N/A * use of particular time values by multiple applets will cause 0N/A * confusing results. For example, if plugin runs two applets 0N/A * simultaneously, the initTime for those applets will collide 0N/A * and the results may be undefined. 0N/A * To automatically track startup performance in an app or applet, 0N/A * use the command-line parameter sun.perflog as follows:<BR> 0N/A * -Dsun.perflog[=file:<filename>] 1564N/A * where simply using the parameter with no value will enable output 0N/A * to the console and a value of "file:<filename>" will cause 0N/A * that given filename to be created and used for all output. 1202N/A * By default, times are measured using System.currentTimeMillis(). To use 0N/A * System.nanoTime() instead, add the command-line parameter:<BR> 0N/A -Dsun.perflog.nano=true 989N/A * <B>Warning: Use at your own risk!</B> 989N/A * This class is intended for internal testing 4141N/A * purposes only and may be removed at any time. More 4141N/A * permanent monitoring and profiling APIs are expected to be 0N/A * developed for future releases and this class will cease to 0N/A * exist once those APIs are in place. 0N/A * @author Chet Haase 4141N/A // Timing values of global interest 0N/A // Check if we should use nanoTime 107N/A // Now, figure out what the user wants to do with the data 0N/A ". Log to console");
0N/A // Reserve predefined slots 0N/A * Returns status of whether logging is enabled or not. This is 0N/A * provided as a convenience method so that users do not have to 0N/A * perform the same GetPropertyAction check as above to determine whether 989N/A * to enable performance logging. 0N/A * Return the current time, in millis or nanos as appropriate 1202N/A * Sets the start time. Ideally, this is the earliest time available 1202N/A * during the startup of a Java applet or application. This time is 1202N/A * later used to analyze the difference between the initial startup 0N/A * time and other events in the system (such as an applet's init time). 0N/A * Sets the base time, output can then 0N/A * be displayed as offsets from the base 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. * Gets the start time, which should be the time when * the java process started, prior to the VM actually being * Sets the value of a given time and returns the index of the * slot that that time was stored in. * 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. // times is already synchronized, but we need to ensure that // the size used in times.set() is the same used when returning // the index of that operation. * Returns time at given index. * Returns message at given index. * Outputs all data to parameter-specified Writer object * Outputs all data to whatever location the user specified * via sun.perflog command-line parameter.