On 5/15/06, Maninder, Singh
<mandiv-W2hqgAdRMsX2eFz/2MeuCQ@public.gmane.org>
wrote:> Yep, it can. But, it''s too clutterred and too much info.
Try this as a start.
var Benchmark = new function(){
this.starttime = [];
this.start = function(text) {
this.starttime.push([new Date(), text || ""]);
}
this.stop = function(){
var start = this.starttime.pop();
if (!start) return;
var dauer = (new Date()) - start[0];
this.show(dauer, start[1]);
}
this.show = function(zeit, text){
var wo = document.createElement("div");
wo.innerHTML = (new Date().toTimeString()) + " " + text + "
-> " +
zeit + " ms";
document.body.appendChild(wo);
}
};
Benchmark.start();
// something
Benchmark.start("Showing foo");
// show foo
Benchmark.stop();
//something else
Benchmark.stop();
Bye,
Martin