Profiler.js revision 4e10ce0fb16d86c41fc11c6105715c493055383d
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * The YUI JavaScript profiler.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @module profiler
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @requires yui
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //-------------------------------------------------------------------------
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich // Private Variables and Functions
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //-------------------------------------------------------------------------
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich var container = {}, //Container object on which to put the original unprofiled methods.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich report = {}, //Profiling information for functions
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich stopwatches = {}, //Additional stopwatch information
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich /* (intentionally not documented)
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Creates a report object with the given name.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @param {String} name The name to store for the report object.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @return {Void}
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @method createReport
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich /* (intentionally not documented)
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Called when a method ends execution. Marks the start and end time of the
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * method so it can calculate how long the function took to execute. Also
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * updates min/max/avg calculations for the function.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @param {String} name The name of the function to mark as stopped.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @param {int} duration The number of milliseconds it took the function to
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @return {Void}
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @method saveDataPoint
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //get the function data
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich var functionData /*:Object*/ = report[name];
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //just in case clear() was called
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //increment the calls
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //if it's already been called at least once, do more complex calculations
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich functionData.avg = ((functionData.avg*(functionData.calls-1))+duration)/functionData.calls;
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich functionData.min = Math.min(functionData.min, duration);
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich functionData.max = Math.max(functionData.max, duration);
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //-------------------------------------------------------------------------
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich // Public Interface
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //-------------------------------------------------------------------------
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Profiles functions in JavaScript.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @class Profiler
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //-------------------------------------------------------------------------
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich // Utility Methods
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //-------------------------------------------------------------------------
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Removes all report data from the profiler.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @param {String} name (Optional) The name of the report to clear. If
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * omitted, then all report data is cleared.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @return {Void}
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @method clear
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Returns the uninstrumented version of a function/object.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @param {String} name The name of the function/object to retrieve.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @return {Function|Object} The uninstrumented version of a function/object.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @method getOriginal
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Instruments a method to have profiling calls.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @param {String} name The name of the report for the function.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @param {Function} method The function to instrument.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @return {Function} An instrumented version of the function.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @method instrument
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //create instrumented version of function
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich var newMethod = function () {
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich var start = new Date(),
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich stop = new Date();
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //copy the function properties over
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //assign prototype and flag as being profiled
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //store original method
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //create the report
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //return the new method
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //-------------------------------------------------------------------------
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich // Stopwatch Methods
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //-------------------------------------------------------------------------
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Pauses profiling information for a given name.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @param {String} name The name of the data point.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @return {Void}
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @method pause
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich var now = new Date(),
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich if (stopwatch && stopwatch.state == WATCH_STARTED){
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich stopwatch.total += (now - stopwatch.start);
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Start profiling information for a given name. The name cannot be the name
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * of a registered function or object. This is used to start timing for a
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * particular block of code rather than instrumenting the entire function.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @param {String} name The name of the data point.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @return {Void}
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @method start
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich throw new Error("Cannot use '" + name + "' for profiling through start(), name is already in use.");
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //create report if necessary
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //create stopwatch object if necessary
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich if (stopwatches[name].state == WATCH_STOPPED){
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Stops profiling information for a given name.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @param {String} name The name of the data point.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @return {Void}
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @method stop
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich var now = new Date(),
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich saveDataPoint(name, stopwatch.total + (now - stopwatch.start));
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich } else if (stopwatch.state == WATCH_PAUSED){
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //reset stopwatch information
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //-------------------------------------------------------------------------
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich // Reporting Methods
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //-------------------------------------------------------------------------
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Returns the average amount of time (in milliseconds) that the function
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * with the given name takes to execute.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @param {String} name The name of the function whose data should be returned.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * If an object type method, it should be 'constructor.prototype.methodName';
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * a normal object method would just be 'object.methodName'.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @return {float} The average time it takes the function to execute.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @method getAverage
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich getAverage : function (name /*:String*/) /*:float*/ {
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Returns the number of times that the given function has been called.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @param {String} name The name of the function whose data should be returned.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @return {int} The number of times the function was called.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @method getCallCount
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich getCallCount : function (name /*:String*/) /*:int*/ {
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Returns the maximum amount of time (in milliseconds) that the function
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * with the given name takes to execute.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @param {String} name The name of the function whose data should be returned.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * If an object type method, it should be 'constructor.prototype.methodName';
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * a normal object method would just be 'object.methodName'.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @return {float} The maximum time it takes the function to execute.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @method getMax
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich getMax : function (name /*:String*/) /*:int*/ {
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Returns the minimum amount of time (in milliseconds) that the function
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * with the given name takes to execute.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @param {String} name The name of the function whose data should be returned.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * If an object type method, it should be 'constructor.prototype.methodName';
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * a normal object method would just be 'object.methodName'.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @return {float} The minimum time it takes the function to execute.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @method getMin
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich getMin : function (name /*:String*/) /*:int*/ {
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Returns an object containing profiling data for a single function.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * The object has an entry for min, max, avg, calls, and points).
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @return {Object} An object containing profile data for a given function.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @method getFunctionReport
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @deprecated Use getReport() instead.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich getFunctionReport : function (name /*:String*/) /*:Object*/ {
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Returns an object containing profiling data for a single function.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * The object has an entry for min, max, avg, calls, and points).
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @return {Object} An object containing profile data for a given function.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @method getReport
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich getReport : function (name /*:String*/) /*:Object*/ {
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Returns an object containing profiling data for all of the functions
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * that were profiled. The object has an entry for each function and
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * returns all information (min, max, average, calls, etc.) for each
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @return {Object} An object containing all profile data.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich getFullReport : function (filter /*:Function*/) /*:Object*/ {
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich filter = filter || function(){return true;};
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //-------------------------------------------------------------------------
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich // Profiling Methods
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //-------------------------------------------------------------------------
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Sets up a constructor for profiling, including all properties and methods on the prototype.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @param {string} name The fully-qualified name of the function including namespace information.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @param {Object} owner (Optional) The object that owns the function (namespace or containing object).
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @return {Void}
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @method registerConstructor
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich registerConstructor : function (name /*:String*/, owner /*:Object*/) /*:Void*/ {
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Sets up a function for profiling. It essentially overwrites the function with one
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * that has instrumentation data. This method also creates an entry for the function
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * in the profile report. The original function is stored on the container object.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @param {String} name The full name of the function including namespacing. This
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * is the name of the function that is stored in the report.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @param {Object} owner (Optional) The object that owns the function. If the function
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * isn't global then this argument is required. This could be the namespace that
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * the function belongs to or the object on which it's
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @param {Boolean} registerPrototype (Optional) Indicates that the prototype should
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * also be instrumented. Setting to true has the same effect as calling
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * registerConstructor().
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @return {Void}
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @method registerFunction
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich registerFunction : function(name /*:String*/, owner /*:Object*/, registerPrototype /*:Boolean*/) /*:Void*/{
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //figure out the function name without namespacing
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich name.substring(name.lastIndexOf(".")+1) : name),
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //if owner isn't an object, try to find it from the name
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich owner = eval(name.substring(0, name.lastIndexOf(".")));
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //get the method and prototype
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //see if the method has already been registered
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich if (L.isFunction(method) && !method.__yuiProfiled){
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //replace the function with the profiling one
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich owner[funcName] = this.instrument(name, method);
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Store original function information. We store the actual
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * function as well as the owner and the name used to identify
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * the function so it can be restored later.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich container[name].__yuiFuncName = funcName; //overwrite with less-specific name
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //register prototype if necessary
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich this.registerObject(name + ".prototype", prototype);
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Sets up an object for profiling. It takes the object and looks for functions.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * When a function is found, registerMethod() is called on it. If set to recrusive
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * mode, it will also setup objects found inside of this object for profiling,
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * using the same methodology.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @param {String} name The name of the object to profile (shows up in report).
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @param {Object} owner (Optional) The object represented by the name.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @param {Boolean} recurse (Optional) Determines if subobject methods are also profiled.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @return {Void}
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @method registerObject
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich registerObject : function (name /*:String*/, object /*:Object*/, recurse /*:Boolean*/) /*:Void*/{
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //get the object
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich object = (L.isObject(object) ? object : eval(name));
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //save the object
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich if (prop != "constructor" && prop != "superclass"){ //don't do constructor or superclass, it's recursive
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich this.registerFunction(name + "." + prop, object);
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich } else if (typeof object[prop] == "object" && recurse){
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich this.registerObject(name + "." + prop, object[prop], recurse);
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Removes a constructor function from profiling. Reverses the registerConstructor() method.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @param {String} name The full name of the function including namespacing. This
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * is the name of the function that is stored in the report.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @return {Void}
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @method unregisterFunction
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich unregisterConstructor : function(name /*:String*/) /*:Void*/{
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //see if the method has been registered
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * Removes function from profiling. Reverses the registerFunction() method.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @param {String} name The full name of the function including namespacing. This
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * is the name of the function that is stored in the report.
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @return {Void}
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich * @method unregisterFunction
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich unregisterFunction : function(name /*:String*/, unregisterPrototype /*:Boolean*/) /*:Void*/{
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //see if the method has been registered
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //check to see if you should unregister the prototype
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich this.unregisterObject(name + ".prototype", container[name].prototype);
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //get original data
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich var owner /*:Object*/ = container[name].__yuiOwner,
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich funcName /*:String*/ = container[name].__yuiFuncName;
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //delete extra information
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //replace instrumented function
66900b43227bf441b6a6b1084af2c96ce2c747c8Allen Rabinovich //delete supporting information