Skip to content

Commit

Permalink
MyProfiler.reset
Browse files Browse the repository at this point in the history
  • Loading branch information
arrix committed Nov 19, 2010
1 parent b367442 commit 37ac4b9
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions lib/readability.js
Original file line number Diff line number Diff line change
Expand Up @@ -2044,6 +2044,11 @@ var MyProfiler = {
var st = stats[name];
console.log(sprintf("%5d\t%7.3f\t%s", st.count, st.time / 1000, name));
};
},

reset: function() {
this.stats = {};
this.timed_level = 0;
}
};

Expand All @@ -2052,12 +2057,21 @@ function timed() {
}

(function() {
MyProfiler.timerize('================= TOTAL', 'init', readability);
MyProfiler.timerize('================= TOTAL', 'init', readability);
//return;
MyProfiler.timerize('prepDocument', 'prepDocument', readability);
MyProfiler.timerize('prepArticle', 'prepArticle', readability);
MyProfiler.timerize('grabArticle', 'grabArticle', readability);
MyProfiler.timerize('getElementsByTagName', 'getElementsByTagName', jsdom.defaultLevel.Element.prototype, {silent: true});
MyProfiler.timerize('update', 'update', jsdom.defaultLevel.NodeList.prototype, {silent: true});
MyProfiler.timerize('getLinkDensity', 'getLinkDensity', readability, {silent: true});
//MyProfiler.timerize('getInnerText', 'getInnerText', readability, {silent: true});
MyProfiler.timerize('cleanConditionally', 'cleanConditionally', readability);
MyProfiler.timerize('clean', 'clean', readability);
MyProfiler.timerize('killBreaks', 'killBreaks', readability);
MyProfiler.timerize('cleanStyles', 'cleanStyles', readability, {silent: true});
MyProfiler.timerize('cleanHeaders', 'cleanHeaders', readability);
//MyProfiler.timerize('getElementsByTagName', 'getElementsByTagName', jsdom.defaultLevel.Element.prototype, {silent: true});
//MyProfiler.timerize('update', 'update', jsdom.defaultLevel.NodeList.prototype, {silent: true});
//MyProfiler.timerize('removeAttribute', 'removeAttribute', jsdom.defaultLevel.Element.prototype, {silent: true});

})();

Expand All @@ -2074,6 +2088,7 @@ function start(w, cb) {
w.scrollTo = function(){};

readability.reset();
MyProfiler.reset();
try {
readability.init();
MyProfiler.report();
Expand Down

0 comments on commit 37ac4b9

Please sign in to comment.