Ruby's Louvre

每天学习一点点算法

导航

性能监控代码

var log = function(msg){
     if(window.console){
            var now = new Date - 0;
            var last = arguments.callee.last;
             if(typeof last === "number"){
               window.console.log(msg +"        :       "+(now-last)+" ms");
            }
            arguments.callee.last = now;
     }
}

posted on 2010-11-30 11:52  司徒正美  阅读(1063)  评论(3编辑  收藏  举报