| 1 |
dojo.provide("dojox.lang.aspect.profiler"); |
| 2 |
|
| 3 |
(function(){ |
| 4 |
var aop = dojox.lang.aspect, |
| 5 |
uniqueNumber = 0; |
| 6 |
|
| 7 |
var Profiler = function(title){ |
| 8 |
this.args = title ? [title] : []; |
| 9 |
this.inCall = 0; |
| 10 |
}; |
| 11 |
dojo.extend(Profiler, { |
| 12 |
before: function(){ |
| 13 |
if(!(this.inCall++)){ |
| 14 |
console.profile.apply(console, this.args); |
| 15 |
} |
| 16 |
}, |
| 17 |
after: function(){ |
| 18 |
if(!--this.inCall){ |
| 19 |
console.profileEnd(); |
| 20 |
} |
| 21 |
} |
| 22 |
}); |
| 23 |
|
| 24 |
aop.profiler = function( title){ |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
return new Profiler(title); |
| 32 |
}; |
| 33 |
})(); |