This object is responsible for adding the instrumentation code to methods. It leverages the
AdfCheckpoint
class in order to perform timings and data collection. To get an instance, you must use the
getInstance()
method.
Field Summary
|
private static Number |
_index
-
This is a counter for generating uids
|
private static String |
_PROFILER_GROUP
-
The group id of all checkpoints added by the profiler class
|
private static String |
_PROP_CLASS_ID
-
This is put as a property on instance objects so that we can maintain consistant methodIds.
|
private static String |
_PROP_CLASSNAME
-
This is put as a property on every method that is registered and contains a flag as to whether this method was actually present on the object when it was instantiated
|
private static String |
_PROP_REGISTERED
-
This is put as a property on every method that is registered and contains the method's name
|
private static String |
_PROP_REGISTERED_CHECKPOINT
-
This is put as a property on every method that is registered and contains the method's checkpoint
|
private static String |
_PROP_REGISTERED_INST_METHOD
-
This is put as a property on every method that is registered and contains the origional method
|
private static String |
_PROP_REGISTERED_IS_PRESENT
-
This is put as a property on every method that is registered and contains a flag as to whether this method was actually present on the object when it was instantiated
|
private static String |
_PROP_REGISTERED_METHOD_NAME
-
This is put as a property on every method that is registered and contains the method name
|
private static String |
_PROP_REGISTERED_OBJECT
-
This is put as a property on every method that is registered and contains a reference to the containing object
|
private static RegExp |
_REGEXP_FUNCTION
-
This regular expression is for retrieving the BODY of a function.
|
private static RegExp |
_REGEXP_FUNCTION_NAME
-
This is the regular expression for retrieving the name of a function or object in the format of "function f(x)".
|
private static RegExp |
_REGEXP_REGEXP
-
This regular expression is used to detect and parse a regular expression.
|
private static RegExp |
_REGEXP_REPLACE_METHOD
-
This regular expression is for replacing the $methodname$ token in the body of the instrumentation function with another value.
|
private static AdfProfiler |
_THE_INSTANCE
-
The reference to the profiler singleton.
|
Method Summary
|
private static Object |
_getClassId(Object object)
-
Returns a unique class id.
|
private static Object |
_getClassName(Object object)
-
Returns this objects class name or "[anonymous]" if the object name is anonymous.
|
public static Object |
getInstance()
-
Returns the singleton instance of the AdfProfiler.
|
private static Object |
_getMethodId(String methodName, Object object)
-
Returns a unique method id that is duplicatable based on the methodName and the given object.
|
private Object |
__getRegisteredMethods()
-
Returns a list of instrumented methods by method id
|
private static Object |
_hasOwnMethod(Object object, String methodName)
-
Returns true if the object has its own version of the method.
|
private static Object |
_instrumenterFunction()
-
This is a "prototype" of the function that will be used for instrumentation.
|
private static Object |
_instrumentFunction(String methodName, String methodId, Object object, Object checkpoint)
-
Instruments a function on the object and returns a reference to the new function.
|
private static Object |
_isInstrumentable(Object object, Object property)
-
Returns true if this function is one which should be instrumented or not.
|
private static Object |
_isInstrumented(Object method)
-
Returns true if this method is part of the instrumentation.
|
private static Object |
_isPrototype(Object object, String classname)
-
Returns true if the given object is the prototype of its base class or false if it is either an instance or the class itself.
|
private static Object |
_isWindow(Object object)
-
Returns true if the given object is the window object or false if it is not.
|
public Object |
register(Object object, String methodName)
-
Deprecated: Please use registerMethod instead
|
public Object |
registerFunction(String functionName)
-
Registers a javascript function with the AdfProfiler.
|
public Object |
registerMethod(Object object, String methodName)
-
Registers a javascript method with the AdfProfiler.
|
public Object |
startProfiling()
-
Starts recording profiling data for checkpoints registered by this AdfProfiler.
|
public Object |
stopProfiling()
-
Stops recording profiling data for checkpoints registered by this AdfProfiler.
|
private static Object |
_uninstrumentFunction(Object func)
-
Removes instrumentation from a method and reverts the method back to its origional state.
|
public Object |
unregister(Object object, String methodName)
-
Deprecated: use unregisterMethod
|
public Object |
unregisterAll()
-
Unregisters all of the registered functions
|
public Object |
unregisterFunction(String functionName)
-
Unregisters functions that have been registered with the Javascript AdfProfiler.
|
public Object |
unregisterMethod(Object object, String methodName)
-
Unregisters methods which have been registered with the Javascript AdfProfiler.
|