upgraded to yui 0.12.0
upgraded to yui-ext 0.33 rc2
This commit is contained in:
parent
62b3d90db7
commit
cfd09a5cb6
1271 changed files with 539033 additions and 0 deletions
43
www/extras/yui-ext/source/Bench.js
vendored
Normal file
43
www/extras/yui-ext/source/Bench.js
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* YUI Extensions 0.33 RC2
|
||||
* Copyright(c) 2006, Jack Slocum.
|
||||
*/
|
||||
|
||||
YAHOO.ext.util.Bench = function(){
|
||||
this.timers = {};
|
||||
this.lastKey = null;
|
||||
};
|
||||
YAHOO.ext.util.Bench.prototype = {
|
||||
start : function(key){
|
||||
this.lastKey = key;
|
||||
this.timers[key] = {};
|
||||
this.timers[key].startTime = new Date().getTime();
|
||||
},
|
||||
|
||||
stop : function(key){
|
||||
key = key || this.lastKey;
|
||||
this.timers[key].endTime = new Date().getTime();
|
||||
},
|
||||
|
||||
getElapsed : function(key){
|
||||
key = key || this.lastKey;
|
||||
return this.timers[key].endTime - this.timers[key].startTime;
|
||||
},
|
||||
|
||||
toString : function(html){
|
||||
var results = "";
|
||||
for(var key in this.timers){
|
||||
if(typeof this.timers[key] != 'function'){
|
||||
results += key + ":\t" + (this.getElapsed(key) / 1000) + " seconds\n";
|
||||
}
|
||||
}
|
||||
if(html){
|
||||
results = results.replace("\n", '<br>');
|
||||
}
|
||||
return results;
|
||||
},
|
||||
|
||||
show : function(){
|
||||
alert(this.toString());
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue