Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(906)

Unified Diff: tools/logreader.js

Issue 802333002: Profiler improvements (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updated test expectations; improved tickprocessor tests failure output Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/tools/tickprocessor-test.separate-ic ('k') | tools/profile.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/logreader.js
diff --git a/tools/logreader.js b/tools/logreader.js
index 5f0ec7f6c7a687829aefd08649d043ea16c2d0a7..ceac2b826800e3375db94454fb3cf068af2107ff 100644
--- a/tools/logreader.js
+++ b/tools/logreader.js
@@ -35,15 +35,21 @@
*
* @param {Array.<Object>} dispatchTable A table used for parsing and processing
* log records.
+ * @param {boolean} timedRange Ignore ticks outside timed range.
* @constructor
*/
-function LogReader(dispatchTable) {
+function LogReader(dispatchTable, timedRange) {
/**
* @type {Array.<Object>}
*/
this.dispatchTable_ = dispatchTable;
/**
+ * @type {boolean}
+ */
+ this.timedRange_ = timedRange;
+
+ /**
* Current line.
* @type {number}
*/
@@ -54,6 +60,18 @@ function LogReader(dispatchTable) {
* @type {CsvParser}
*/
this.csvParser_ = new CsvParser();
+
+ /**
+ * Keeps track of whether we've seen a "current-time" tick yet.
+ * @type {boolean}
+ */
+ this.hasSeenTimerMarker_ = false;
+
+ /**
+ * List of log lines seen since last "current-time" tick.
+ * @type {Array.<String>}
+ */
+ this.logLinesSinceLastTimerMarker_ = [];
};
@@ -83,7 +101,24 @@ LogReader.prototype.processLogChunk = function(chunk) {
* @param {string} line A line of log.
*/
LogReader.prototype.processLogLine = function(line) {
- this.processLog_([line]);
+ if (!this.timedRange_) {
+ this.processLog_([line]);
+ return;
+ }
+ if (line.startsWith("current-time")) {
+ if (this.hasSeenTimerMarker_) {
+ this.processLog_(this.logLinesSinceLastTimerMarker_);
+ this.logLinesSinceLastTimerMarker_ = [];
+ } else {
+ this.hasSeenTimerMarker_ = true;
+ }
+ } else {
+ if (this.hasSeenTimerMarker_) {
+ this.logLinesSinceLastTimerMarker_.push(line);
+ } else if (!line.startsWith("tick")) {
+ this.processLog_([line]);
+ }
+ }
};
« no previous file with comments | « test/mjsunit/tools/tickprocessor-test.separate-ic ('k') | tools/profile.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698