Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.1.0)

E17493-02

oracle.ide.performance
Class PerformanceLogger

java.lang.Object
  extended by oracle.ide.performance.PerformanceLogger

public final class PerformanceLogger
extends java.lang.Object

Performance logger should be used to log performance information that may be of interest to extension developers.

Performance logger must be used to log events on the same thread. When you retrieve an instance of PerformanceLogger via the get() method, a unique logger for the current thread is returned.

Performance logger delegates all logging to an instance of Logger. For the purposes of configuring this logger, its name is the same as the fully qualified name of this class (oracle.ide.performance.PerformanceLogger).

Performance logger will log PerformanceLogRecord instances to the logger. These log records contain additional information about the logging event used to format performance log messages.

The default handler used for performance log messages is configured with a formatter that prints indented timing information for each log record to the console. This is a typical example of the output:

 Timing:      [0ms] Started some long task...
 Timing:    [300ms]   Did some subtask
 Timing:    [233ms]   Did another subtask
 Timing:    [550ms] Finished the long task
 
You can change the default formatter by setting the logging property oracle.ide.performance.PerformanceHandler.formatter to the fully qualified class name of a Formatter.

This handler is installed with a default filter that only allows log messages to be printed if the current build of JDeveloper is a debug build. In other words, in released production builds of JDeveloper, timing diagnostics are not displayed at all by default. You can override this behavior by setting the logging property oracle.ide.performance.PerformanceHandler.filter to an empty string.

Since:
10.1.3

Method Summary
static PerformanceLogger get()
          Get an instance of the performance logger.
static boolean isAboveGlobalThreshold(long timingInNanos)
           
 void log(java.util.logging.Level level, java.lang.String message)
          Deprecated. 
 void log(java.util.logging.Level level, java.lang.String message, long elapsedTime)
          Deprecated. 
 void log(java.lang.String id, java.lang.String message, long elapsedTime)
          Log a message with an elapsed time.
 void logConfigurationProperty(java.lang.String key, java.lang.String value)
           
 void startTiming(java.lang.String id)
          Start timing some long operation.
 void startTiming(java.lang.String id, java.lang.String startMessage)
          Start timing some long operation and log a start message.
 void stopTiming(java.lang.String id, int threshold, java.lang.String endMessage, java.lang.Object... arguments)
          Stop timing some long operation.
 void stopTiming(java.lang.String id, java.lang.String endMessage)
          Stop timing some long operation and log an end message that includes the elapsed time in milliseconds of the operation.
 void stopTiming(java.lang.String id, java.lang.String endMessage, int threshold)
          Stop timing some long operation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

logConfigurationProperty

public void logConfigurationProperty(java.lang.String key,
                                     java.lang.String value)

get

public static PerformanceLogger get()
Get an instance of the performance logger. There is a separate instance of this logger per thread.

Returns:
the performance logger

log

@Deprecated
public void log(java.util.logging.Level level,
                           java.lang.String message)
Deprecated. 


log

@Deprecated
public void log(java.util.logging.Level level,
                           java.lang.String message,
                           long elapsedTime)
Deprecated. 


log

public void log(java.lang.String id,
                java.lang.String message,
                long elapsedTime)
Log a message with an elapsed time.

Parameters:
id - the id of the type of performance statistic being tracked.
message - parameterized information about the performance statistic.
elapsedTime - the elapsed time in nanoseconds.

startTiming

public void startTiming(java.lang.String id)
Start timing some long operation. No log record will be created for the start of this event; the start time is simply recorded.

Parameters:
id - a unique identifier for the operation.

startTiming

public void startTiming(java.lang.String id,
                        java.lang.String startMessage)
Start timing some long operation and log a start message. The elapsed time of the start message will be 0.

Parameters:
id - a unique identifier for the operation.
startMessage - a message to log. The message will be logged at Level.INFO.

stopTiming

public void stopTiming(java.lang.String id,
                       java.lang.String endMessage)
Stop timing some long operation and log an end message that includes the elapsed time in milliseconds of the operation.

Parameters:
id - the id of an operation. Must match an id previously registered with startTiming( String, String ).
endMessage - the message for the log record.
Throws:
java.lang.IllegalArgumentException - if the specified id is unrecognized.

stopTiming

public void stopTiming(java.lang.String id,
                       java.lang.String endMessage,
                       int threshold)
Stop timing some long operation. If the time taken by the operation is longer than the specified threshold, log an end message that includes the elapsed time in milliseconds.

Parameters:
id - the id of an operation. Must match an id previously registered with startTiming( String, String ).
endMessage - the message for the log record.
threshold - the minimum time required to print the message
Throws:
java.lang.IllegalArgumentException - if the specified id is unrecognized.

stopTiming

public void stopTiming(java.lang.String id,
                       int threshold,
                       java.lang.String endMessage,
                       java.lang.Object... arguments)
Stop timing some long operation. If the time taken by the operation is longer than the specified threshold, log an end message that includes the elapsed time in milliseconds.

Parameters:
id - the id of an operation. Must match an id previously registered with startTiming( String, String ).
threshold - the minimum time required to print the message
endMessage - the message for the log record.
arguments - arguments to be formatted into endMessage using MessageFormat.format(java.lang.Object[], java.lang.StringBuffer, java.text.FieldPosition).
Throws:
java.lang.IllegalArgumentException - if the specified id is unrecognized.

isAboveGlobalThreshold

public static boolean isAboveGlobalThreshold(long timingInNanos)

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.1.0)

E17493-02

Copyright © 1997, 2011, Oracle. All rights reserved.