public/javascripts/yui/profiler/profiler.js
function(name, method){
        
            //create instrumented version of function
            var newMethod = function () {
    
                var start = new Date(),
                    retval = method.apply(this, arguments),
                    stop = new Date();
                
                saveDataPoint(name, stop-start);
                
                return retval;                
            
            };     

            //copy the function properties over
            lang.augmentObject(newMethod, method);
            
            //assign prototype and flag as being profiled
            newMethod.__yuiProfiled = true;
            newMethod.prototype = method.prototype;
            
            //store original method
            container[name] = method;
            container[name].__yuiFuncName = name;
            
            //create the report
            createReport(name);

            //return the new method
            return newMethod;
        }
function(name, method){
        
            //create instrumented version of function
            var newMethod = function () {
    
                var start = new Date(),
                    retval = method.apply(this, arguments),
                    stop = new Date();
                
                saveDataPoint(name, stop-start);
                
                return retval;                
            
            };     

            //copy the function properties over
            lang.augmentObject(newMethod, method);
            
            //assign prototype and flag as being profiled
            newMethod.__yuiProfiled = true;
            newMethod.prototype = method.prototype;
            
            //store original method
            container[name] = method;
            container[name].__yuiFuncName = name;
            
            //create the report
            createReport(name);

            //return the new method
            return newMethod;
        }
function ( name , method ) { //create instrumented version of function var newMethod = function ( ) { var start = new Date ( ) , retval = method . apply ( this , arguments ) , stop = new Date ( ) ; saveDataPoint ( name , stop - start ) ; return retval ; } ; //copy the function properties over lang . augmentObject ( newMethod , method ) ; //assign prototype and flag as being profiled newMethod . __yuiProfiled = true ; newMethod . prototype = method . prototype ; //store original method container [ name ] = method ; container [ name ] . __yuiFuncName = name ; //create the report createReport ( name ) ; //return the new method return newMethod ; }
Instruments a method to have profiling calls.
@param {String} name The name of the report for the function.
@param {Function} method The function to instrument.
@return {Function} An instrumented version of the function.
@method instrument
@static
Instruments a method to have profiling calls .