API Docs for: 3.5.1
Show:

Profiler Class

Module: profiler

Profiles functions in JavaScript.

Item Index

Methods

Methods

clear

(
  • name
)
Void static

Removes all report data from the profiler.

Parameters:

  • name String

    (Optional) The name of the report to clear. If omitted, then all report data is cleared.

Returns:

Void:

getAverage

(
  • name
)
Float static

Returns the average amount of time (in milliseconds) that the function with the given name takes to execute.

Parameters:

  • name String

    The name of the function whose data should be returned. If an object type method, it should be 'constructor.prototype.methodName'; a normal object method would just be 'object.methodName'.

Returns:

Float: The average time it takes the function to execute.

getCallCount

(
  • name
)
Int static

Returns the number of times that the given function has been called.

Parameters:

  • name String

    The name of the function whose data should be returned.

Returns:

Int: The number of times the function was called.

getFullReport

() Object static

Returns an object containing profiling data for all of the functions that were profiled. The object has an entry for each function and returns all information (min, max, average, calls, etc.) for each function.

Returns:

Object: An object containing all profile data.

getFunctionReport

() Object deprecated static

Defined in profiler/js/Profiler.js:304

Deprecated: Use getReport() instead.

Returns an object containing profiling data for a single function. The object has an entry for min, max, avg, calls, and points).

Returns:

Object: An object containing profile data for a given function.

getMax

(
  • name
)
Float static

Returns the maximum amount of time (in milliseconds) that the function with the given name takes to execute.

Parameters:

  • name String

    The name of the function whose data should be returned. If an object type method, it should be 'constructor.prototype.methodName'; a normal object method would just be 'object.methodName'.

Returns:

Float: The maximum time it takes the function to execute.

getMin

(
  • name
)
Float static

Returns the minimum amount of time (in milliseconds) that the function with the given name takes to execute.

Parameters:

  • name String

    The name of the function whose data should be returned. If an object type method, it should be 'constructor.prototype.methodName'; a normal object method would just be 'object.methodName'.

Returns:

Float: The minimum time it takes the function to execute.

getOriginal

(
  • name
)
Function | Object static

Returns the uninstrumented version of a function/object.

Parameters:

  • name String

    The name of the function/object to retrieve.

Returns:

Function | Object: The uninstrumented version of a function/object.

getReport

() Object static

Returns an object containing profiling data for a single function. The object has an entry for min, max, avg, calls, and points).

Returns:

Object: An object containing profile data for a given function.

instrument

(
  • name
  • method
)
Function static

Instruments a method to have profiling calls.

Parameters:

  • name String

    The name of the report for the function.

  • method Function

    The function to instrument.

Returns:

Function: An instrumented version of the function.

pause

(
  • name
)
Void static

Pauses profiling information for a given name.

Parameters:

  • name String

    The name of the data point.

Returns:

Void:

registerConstructor

(
  • name
  • owner
)
Void static

Sets up a constructor for profiling, including all properties and methods on the prototype.

Parameters:

  • name String

    The fully-qualified name of the function including namespace information.

  • owner Object

    (Optional) The object that owns the function (namespace or containing object).

Returns:

Void:

registerFunction

(
  • name
  • owner
  • registerPrototype
)
Void static

Sets up a function for profiling. It essentially overwrites the function with one that has instrumentation data. This method also creates an entry for the function in the profile report. The original function is stored on the container object.

Parameters:

  • name String

    The full name of the function including namespacing. This is the name of the function that is stored in the report.

  • owner Object

    (Optional) The object that owns the function. If the function isn't global then this argument is required. This could be the namespace that the function belongs to or the object on which it's a method.

  • registerPrototype Boolean

    (Optional) Indicates that the prototype should also be instrumented. Setting to true has the same effect as calling registerConstructor().

Returns:

Void:

registerObject

(
  • name
  • owner
  • recurse
)
Void static

Sets up an object for profiling. It takes the object and looks for functions. When a function is found, registerMethod() is called on it. If set to recrusive mode, it will also setup objects found inside of this object for profiling, using the same methodology.

Parameters:

  • name String

    The name of the object to profile (shows up in report).

  • owner Object

    (Optional) The object represented by the name.

  • recurse Boolean

    (Optional) Determines if subobject methods are also profiled.

Returns:

Void:

start

(
  • name
)
Void static

Start profiling information for a given name. The name cannot be the name of a registered function or object. This is used to start timing for a particular block of code rather than instrumenting the entire function.

Parameters:

  • name String

    The name of the data point.

Returns:

Void:

stop

(
  • name
)
Void static

Stops profiling information for a given name.

Parameters:

  • name String

    The name of the data point.

Returns:

Void:

unregisterFunction

(
  • name
)
Void static

Removes a constructor function from profiling. Reverses the registerConstructor() method.

Parameters:

  • name String

    The full name of the function including namespacing. This is the name of the function that is stored in the report.

Returns:

Void:

unregisterFunction

(
  • name
)
Void static

Removes function from profiling. Reverses the registerFunction() method.

Parameters:

  • name String

    The full name of the function including namespacing. This is the name of the function that is stored in the report.

Returns:

Void:

unregisterObject

(
  • name
  • recurse
)
Void static

Unregisters an object for profiling. It takes the object and looks for functions. When a function is found, unregisterMethod() is called on it. If set to recrusive mode, it will also unregister objects found inside of this object, using the same methodology.

Parameters:

  • name String

    The name of the object to unregister.

  • recurse Boolean

    (Optional) Determines if subobject methods should also be unregistered.

Returns:

Void: