Lines Matching refs:name
22 * Creates a report object with the given name.
23 * @param {String} name The name to store for the report object.
28 function createReport(name){
29 report[name] = {
36 return report[name];
43 * @param {String} name The name of the function to mark as stopped.
51 function saveDataPoint(name, duration){
54 var functionData /*:Object*/ = report[name];
58 functionData = createReport(name);
95 * @param {String} name (Optional) The name of the report to clear. If
101 clear: function(name){
102 if (L.isString(name)){
103 delete report[name];
104 delete stopwatches[name];
113 * @param {String} name The name of the function/object to retrieve.
118 getOriginal: function(name){
119 return container[name];
124 * @param {String} name The name of the report for the function.
130 instrument: function(name, method){
139 saveDataPoint(name, stop-start);
153 container[name] = method;
154 container[name].__yuiFuncName = name;
157 createReport(name);
168 * Pauses profiling information for a given name.
169 * @param {String} name The name of the data point.
174 pause: function(name){
176 stopwatch = stopwatches[name];
187 * Start profiling information for a given name. The name cannot be the name
190 * @param {String} name The name of the data point.
195 start: function(name){
196 if(container[name]){
197 throw new Error("Cannot use '" + name + "' for profiling through start(), name is already in use.");
201 if (!report[name]){
202 createReport(name);
206 if (!stopwatches[name]){
207 stopwatches[name] = {
214 if (stopwatches[name].state == WATCH_STOPPED){
215 stopwatches[name].state = WATCH_STARTED;
216 stopwatches[name].start = new Date();
223 * Stops profiling information for a given name.
224 * @param {String} name The name of the data point.
229 stop: function(name){
231 stopwatch = stopwatches[name];
235 saveDataPoint(name, stopwatch.total + (now - stopwatch.start));
237 saveDataPoint(name, stopwatch.total);
253 * with the given name takes to execute.
254 * @param {String} name The name of the function whose data should be returned.
261 getAverage : function (name /*:String*/) /*:float*/ {
262 return report[name].avg;
267 * @param {String} name The name of the function whose data should be returned.
272 getCallCount : function (name /*:String*/) /*:int*/ {
273 return report[name].calls;
278 * with the given name takes to execute.
279 * @param {String} name The name of the function whose data should be returned.
286 getMax : function (name /*:String*/) /*:int*/ {
287 return report[name].max;
292 * with the given name takes to execute.
293 * @param {String} name The name of the function whose data should be returned.
300 getMin : function (name /*:String*/) /*:int*/ {
301 return report[name].min;
312 getFunctionReport : function (name /*:String*/) /*:Object*/ {
313 return report[name];
323 getReport : function (name /*:String*/) /*:Object*/ {
324 return report[name];
342 for (var name in report){
343 if (filter(report[name])){
344 fullReport[name] = report[name];
358 * @param {string} name The fully-qualified name of the function including namespace information.
364 registerConstructor : function (name /*:String*/, owner /*:Object*/) /*:Void*/ {
365 this.registerFunction(name, owner, true);
372 * @param {String} name The full name of the function including namespacing. This
373 * is the name of the function that is stored in the report.
385 registerFunction : function(name /*:String*/, owner /*:Object*/, registerPrototype /*:Boolean*/) /*:Void*/{
387 //figure out the function name without namespacing
388 var funcName = (name.indexOf(".") > -1 ?
389 name.substring(name.lastIndexOf(".")+1) : name),
393 //if owner isn't an object, try to find it from the name
395 owner = eval(name.substring(0, name.lastIndexOf(".")));
406 owner[funcName] = this.instrument(name, method);
410 * function as well as the owner and the name used to identify
413 container[name].__yuiOwner = owner;
414 container[name].__yuiFuncName = funcName; //overwrite with less-specific name
418 this.registerObject(name + ".prototype", prototype);
431 * @param {String} name The name of the object to profile (shows up in report).
432 * @param {Object} owner (Optional) The object represented by the name.
438 registerObject : function (name /*:String*/, object /*:Object*/, recurse /*:Boolean*/) /*:Void*/{
441 object = (L.isObject(object) ? object : eval(name));
444 container[name] = object;
449 this.registerFunction(name + "." + prop, object);
452 this.registerObject(name + "." + prop, object[prop], recurse);
460 * @param {String} name The full name of the function including namespacing. This
461 * is the name of the function that is stored in the report.
466 unregisterConstructor : function(name /*:String*/) /*:Void*/{
469 if (L.isFunction(container[name])){
470 this.unregisterFunction(name, true);
476 * @param {String} name The full name of the function including namespacing. This
477 * is the name of the function that is stored in the report.
482 unregisterFunction : function(name /*:String*/, unregisterPrototype /*:Boolean*/) /*:Void*/{
485 if (L.isFunction(container[name])){
489 this.unregisterObject(name + ".prototype", container[name].prototype);
493 var owner /*:Object*/ = container[name].__yuiOwner,
494 funcName /*:String*/ = container[name].__yuiFuncName;
497 delete container[name].__yuiOwner;
498 delete container[name].__yuiFuncName;
501 owner[funcName] = container[name];
504 delete container[name];
515 * @param {String} name The name of the object to unregister.
522 unregisterObject : function (name /*:String*/, recurse /*:Boolean*/) /*:Void*/{
525 if (L.isObject(container[name])){
526 var object = container[name];
530 this.unregisterFunction(name + "." + prop);
532 this.unregisterObject(name + "." + prop, recurse);
536 delete container[name];