< prev index next >

src/java.base/share/classes/sun/misc/PerformanceLogger.java

Print this page




  34 import java.io.Writer;
  35 
  36 /**
  37  * This class is intended to be a central place for the jdk to
  38  * log timing events of interest.  There is pre-defined event
  39  * of startTime, as well as a general
  40  * mechanism of setting arbitrary times in an array.
  41  * All unreserved times in the array can be used by callers
  42  * in application-defined situations.  The caller is responsible
  43  * for setting and getting all times and for doing whatever
  44  * analysis is interesting; this class is merely a central container
  45  * for those timing values.
  46  * Note that, due to the variables in this class being static,
  47  * use of particular time values by multiple applets will cause
  48  * confusing results.  For example, if plugin runs two applets
  49  * simultaneously, the initTime for those applets will collide
  50  * and the results may be undefined.
  51  * <P>
  52  * To automatically track startup performance in an app or applet,
  53  * use the command-line parameter sun.perflog as follows:<BR>

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

  55  * <BR>
  56  * where simply using the parameter with no value will enable output
  57  * to the console and a value of "file:<filename>" will cause
  58  * that given filename to be created and used for all output.
  59  * <P>
  60  * By default, times are measured using System.currentTimeMillis().  To use
  61  * System.nanoTime() instead, add the command-line parameter:<BR>
  62        -Dsun.perflog.nano=true
  63  * <BR>
  64  * <P>
  65  * <B>Warning: Use at your own risk!</B>
  66  * This class is intended for internal testing
  67  * purposes only and may be removed at any time.  More
  68  * permanent monitoring and profiling APIs are expected to be
  69  * developed for future releases and this class will cease to
  70  * exist once those APIs are in place.
  71  * @author Chet Haase
  72  */
  73 public class PerformanceLogger {
  74 
  75     // Timing values of global interest
  76     private static final int START_INDEX    = 0;    // VM start
  77     private static final int LAST_RESERVED  = START_INDEX;




  34 import java.io.Writer;
  35 
  36 /**
  37  * This class is intended to be a central place for the jdk to
  38  * log timing events of interest.  There is pre-defined event
  39  * of startTime, as well as a general
  40  * mechanism of setting arbitrary times in an array.
  41  * All unreserved times in the array can be used by callers
  42  * in application-defined situations.  The caller is responsible
  43  * for setting and getting all times and for doing whatever
  44  * analysis is interesting; this class is merely a central container
  45  * for those timing values.
  46  * Note that, due to the variables in this class being static,
  47  * use of particular time values by multiple applets will cause
  48  * confusing results.  For example, if plugin runs two applets
  49  * simultaneously, the initTime for those applets will collide
  50  * and the results may be undefined.
  51  * <P>
  52  * To automatically track startup performance in an app or applet,
  53  * use the command-line parameter sun.perflog as follows:<BR>
  54  * <pre>{@code
  55  *     -Dsun.perflog[=file:<filename>]
  56  * }</pre>
  57  * <BR>
  58  * where simply using the parameter with no value will enable output
  59  * to the console and a value of "{@code file:<filename>}" will cause
  60  * that given filename to be created and used for all output.
  61  * <P>
  62  * By default, times are measured using System.currentTimeMillis().  To use
  63  * System.nanoTime() instead, add the command-line parameter:<BR>
  64        -Dsun.perflog.nano=true
  65  * <BR>
  66  * <P>
  67  * <B>Warning: Use at your own risk!</B>
  68  * This class is intended for internal testing
  69  * purposes only and may be removed at any time.  More
  70  * permanent monitoring and profiling APIs are expected to be
  71  * developed for future releases and this class will cease to
  72  * exist once those APIs are in place.
  73  * @author Chet Haase
  74  */
  75 public class PerformanceLogger {
  76 
  77     // Timing values of global interest
  78     private static final int START_INDEX    = 0;    // VM start
  79     private static final int LAST_RESERVED  = START_INDEX;


< prev index next >