com.endeca.infront.assembler.perf
Class AssemblerPerfUtils

java.lang.Object
  extended by com.endeca.infront.assembler.perf.AssemblerPerfUtils

public class AssemblerPerfUtils
extends Object

A static interface to ease use of Assembler performance timing primitives. A thread-local is used to store the current thread's performance events. The only provided Event is the TimeEvent. Events may be serialized by registering EventSerializer's with this interface, two of which are provided:

Events may be serialized by registering EventSerializer's with this interface, two of which are provided:


Method Summary
static void addEventSerializer(EventSerializer serializer)
          Registers a serializer with the system.
static boolean isTimingPerformance()
          Returns whether performance is being monitored on the current request/thread.
static void startEvent(Object object, String name)
          Called to start a new performance event.
static void startEvent(String id)
          Called to start a new performance event.
static void startPerformanceTiming(javax.servlet.http.HttpServletRequest request)
          Starts performance timing on the current request/thread.
static void stopEvent(Object object, String name)
          Called to stop an event that was previously started.
static void stopEvent(String id)
          Called to stop an event that was previously started.
static void stopPerformanceTiming()
          Stops performance timing on the current request/thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

startPerformanceTiming

public static void startPerformanceTiming(javax.servlet.http.HttpServletRequest request)
Starts performance timing on the current request/thread. Note that this should not be called more than once per request/thread.


stopPerformanceTiming

public static void stopPerformanceTiming()
Stops performance timing on the current request/thread. Note that this should NOT be called more than once per request/thread. After this method is called, current timing statistics will be sent to the currently registered serializers (registered using addEventSerializer(EventSerializer)).


isTimingPerformance

public static boolean isTimingPerformance()
Returns whether performance is being monitored on the current request/thread.

Returns:
true if performance is being monitored on the current thread, false otherwise

addEventSerializer

public static void addEventSerializer(EventSerializer serializer)
Registers a serializer with the system.

Parameters:
serializer - the EventSerializer to add

startEvent

public static void startEvent(Object object,
                              String name)
Called to start a new performance event. A new instance representing this event is added to the stack of timers. Adding a new event will pause the current event's timer and start a new timer for the new event. Please Note: A call to startEvent MUST always include a corresponding call to stopEvent or undefined behavior will result. The resulting full event name will be obj.getClass().getName() + "_" + name.

Parameters:
object - the Object which the event is taking place on
name - the name of the event

stopEvent

public static void stopEvent(Object object,
                             String name)
Called to stop an event that was previously started. The current top of the timer stack is stopped and any performance events are recorded. The next timer on the stack is resumed after this call. Please Note: Calls to startEvent/stopEvent must be matched or undefined behavior will result. The resulting full event name will be obj.getClass().getName() + "_" + name.

Parameters:
object - the Object which the event is taking place on (this object MUST be the same class as the object used to start the event)
name - the name of the event (this name must be equal to the name used when starting this event)

startEvent

public static void startEvent(String id)
Called to start a new performance event. A new instance representing this event is added to the stack of timers. Adding a new event will pause the current event's timer and start a new timer for the new event. Please Note: A call to startEvent MUST always include a corresponding call to stopEvent or undefined behavior will result.

Parameters:
id - the representative id of a timing event

stopEvent

public static void stopEvent(String id)
Called to stop an event that was previously started. The current top of the timer stack is stopped and any performance events are recorded. The next timer on the stack is resumed after this call. Please Note: Calls to startEvent/stopEvent must be matched or undefined behavior will result.

Parameters:
id - the representative id of the performance event (this id must be equal to the id that was used to start this event)


Copyright © 2012, Oracle and/or its affiliates. All rights reserved.