Lines Matching refs:name
24 * Creates a report object with the given name.
25 * @param {String} name The name to store for the report object.
30 function createReport(name){
31 report[name] = {
38 return report[name];
45 * @param {String} name The name of the function to mark as stopped.
53 function saveDataPoint(name, duration){
56 var functionData /*:Object*/ = report[name];
60 functionData = createReport(name);
97 * @param {String} name (Optional) The name of the report to clear. If
103 clear: function(name){
104 if (L.isString(name)){
105 delete report[name];
106 delete stopwatches[name];
115 * @param {String} name The name of the function/object to retrieve.
120 getOriginal: function(name){
121 return container[name];
126 * @param {String} name The name of the report for the function.
132 instrument: function(name, method){
141 saveDataPoint(name, stop-start);
155 container[name] = method;
156 container[name].__yuiFuncName = name;
159 createReport(name);
170 * Pauses profiling information for a given name.
171 * @param {String} name The name of the data point.
176 pause: function(name){
178 stopwatch = stopwatches[name];
189 * Start profiling information for a given name. The name cannot be the name
192 * @param {String} name The name of the data point.
197 start: function(name){
198 if(container[name]){
199 throw new Error("Cannot use '" + name + "' for profiling through start(), name is already in use.");
203 if (!report[name]){
204 createReport(name);
208 if (!stopwatches[name]){
209 stopwatches[name] = {
216 if (stopwatches[name].state == WATCH_STOPPED){
217 stopwatches[name].state = WATCH_STARTED;
218 stopwatches[name].start = new Date();
225 * Stops profiling information for a given name.
226 * @param {String} name The name of the data point.
231 stop: function(name){
233 stopwatch = stopwatches[name];
237 saveDataPoint(name, stopwatch.total + (now - stopwatch.start));
239 saveDataPoint(name, stopwatch.total);
255 * with the given name takes to execute.
256 * @param {String} name The name of the function whose data should be returned.
263 getAverage : function (name /*:String*/) /*:float*/ {
264 return report[name].avg;
269 * @param {String} name The name of the function whose data should be returned.
274 getCallCount : function (name /*:String*/) /*:int*/ {
275 return report[name].calls;
280 * with the given name takes to execute.
281 * @param {String} name The name of the function whose data should be returned.
288 getMax : function (name /*:String*/) /*:int*/ {
289 return report[name].max;
294 * with the given name takes to execute.
295 * @param {String} name The name of the function whose data should be returned.
302 getMin : function (name /*:String*/) /*:int*/ {
303 return report[name].min;
314 getFunctionReport : function (name /*:String*/) /*:Object*/ {
315 return report[name];
325 getReport : function (name /*:String*/) /*:Object*/ {
326 return report[name];
344 for (var name in report){
345 if (filter(report[name])){
346 fullReport[name] = report[name];
360 * @param {string} name The fully-qualified name of the function including namespace information.
366 registerConstructor : function (name /*:String*/, owner /*:Object*/) /*:Void*/ {
367 this.registerFunction(name, owner, true);
374 * @param {String} name The full name of the function including namespacing. This
375 * is the name of the function that is stored in the report.
387 registerFunction : function(name /*:String*/, owner /*:Object*/, registerPrototype /*:Boolean*/) /*:Void*/{
389 //figure out the function name without namespacing
390 var funcName = (name.indexOf(".") > -1 ?
391 name.substring(name.lastIndexOf(".")+1) : name),
395 //if owner isn't an object, try to find it from the name
397 owner = eval(name.substring(0, name.lastIndexOf(".")));
408 owner[funcName] = this.instrument(name, method);
412 * function as well as the owner and the name used to identify
415 container[name].__yuiOwner = owner;
416 container[name].__yuiFuncName = funcName; //overwrite with less-specific name
420 this.registerObject(name + ".prototype", prototype);
433 * @param {String} name The name of the object to profile (shows up in report).
434 * @param {Object} owner (Optional) The object represented by the name.
440 registerObject : function (name /*:String*/, object /*:Object*/, recurse /*:Boolean*/) /*:Void*/{
443 object = (L.isObject(object) ? object : eval(name));
446 container[name] = object;
451 this.registerFunction(name + "." + prop, object);
454 this.registerObject(name + "." + prop, object[prop], recurse);
462 * @param {String} name The full name of the function including namespacing. This
463 * is the name of the function that is stored in the report.
468 unregisterConstructor : function(name /*:String*/) /*:Void*/{
471 if (L.isFunction(container[name])){
472 this.unregisterFunction(name, true);
478 * @param {String} name The full name of the function including namespacing. This
479 * is the name of the function that is stored in the report.
484 unregisterFunction : function(name /*:String*/, unregisterPrototype /*:Boolean*/) /*:Void*/{
487 if (L.isFunction(container[name])){
491 this.unregisterObject(name + ".prototype", container[name].prototype);
495 var owner /*:Object*/ = container[name].__yuiOwner,
496 funcName /*:String*/ = container[name].__yuiFuncName;
499 delete container[name].__yuiOwner;
500 delete container[name].__yuiFuncName;
503 owner[funcName] = container[name];
506 delete container[name];
517 * @param {String} name The name of the object to unregister.
524 unregisterObject : function (name /*:String*/, recurse /*:Boolean*/) /*:Void*/{
527 if (L.isObject(container[name])){
528 var object = container[name];
532 this.unregisterFunction(name + "." + prop);
534 this.unregisterObject(name + "." + prop, recurse);
538 delete container[name];