Fork me on GitHub

Module ringo/profiler

A profiler for measuring execution time of JavaScript functions. Note that you need to run with optimization level -1 for profiling to work. Running the profiler on optimized code will produce no data.

Functions

Class Profiler

Instance Methods


Profiler ()

A class for measuring the frequency and runtime of function invocations.


Profiler.prototype.formatResult (maxFrames)

Parameters

maxFrames

Profiler.prototype.getFrames ()


Profiler.prototype.getScriptFrame (cx, script)

Parameters

cx
script

Profiler.prototype.toString ()


profile (func, maxFrames)

Convenience function for profiling the invocation of a function.

Parameters

Function func the function to profile
number maxFrames optional maximal number of frames to include

Returns

Object an object with the following properties:
  • result: the value returned by the function, if any
  • error: the error thrown by the function, if any
  • profiler: the Profiler instance used to profile the invocation