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

Side by Side Diff: tools/logreader.js

Issue 1123883002: [tick processor] Introduce --pairwise-timed-range processing mode (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix typo Created 5 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | tools/tickprocessor.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 18 matching lines...) Expand all
29 * @fileoverview Log Reader is used to process log file produced by V8. 29 * @fileoverview Log Reader is used to process log file produced by V8.
30 */ 30 */
31 31
32 32
33 /** 33 /**
34 * Base class for processing log files. 34 * Base class for processing log files.
35 * 35 *
36 * @param {Array.<Object>} dispatchTable A table used for parsing and processing 36 * @param {Array.<Object>} dispatchTable A table used for parsing and processing
37 * log records. 37 * log records.
38 * @param {boolean} timedRange Ignore ticks outside timed range. 38 * @param {boolean} timedRange Ignore ticks outside timed range.
39 * @param {boolean} pairwiseTimedRange Ignore ticks outside pairs of timer
40 * markers.
39 * @constructor 41 * @constructor
40 */ 42 */
41 function LogReader(dispatchTable, timedRange) { 43 function LogReader(dispatchTable, timedRange, pairwiseTimedRange) {
42 /** 44 /**
43 * @type {Array.<Object>} 45 * @type {Array.<Object>}
44 */ 46 */
45 this.dispatchTable_ = dispatchTable; 47 this.dispatchTable_ = dispatchTable;
46 48
47 /** 49 /**
48 * @type {boolean} 50 * @type {boolean}
49 */ 51 */
50 this.timedRange_ = timedRange; 52 this.timedRange_ = timedRange;
51 53
52 /** 54 /**
55 * @type {boolean}
56 */
57 this.pairwiseTimedRange_ = pairwiseTimedRange;
58 if (pairwiseTimedRange) {
59 this.timedRange_ = true;
60 }
61
62 /**
53 * Current line. 63 * Current line.
54 * @type {number} 64 * @type {number}
55 */ 65 */
56 this.lineNum_ = 0; 66 this.lineNum_ = 0;
57 67
58 /** 68 /**
59 * CSV lines parser. 69 * CSV lines parser.
60 * @type {CsvParser} 70 * @type {CsvParser}
61 */ 71 */
62 this.csvParser_ = new CsvParser(); 72 this.csvParser_ = new CsvParser();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 */ 112 */
103 LogReader.prototype.processLogLine = function(line) { 113 LogReader.prototype.processLogLine = function(line) {
104 if (!this.timedRange_) { 114 if (!this.timedRange_) {
105 this.processLog_([line]); 115 this.processLog_([line]);
106 return; 116 return;
107 } 117 }
108 if (line.startsWith("current-time")) { 118 if (line.startsWith("current-time")) {
109 if (this.hasSeenTimerMarker_) { 119 if (this.hasSeenTimerMarker_) {
110 this.processLog_(this.logLinesSinceLastTimerMarker_); 120 this.processLog_(this.logLinesSinceLastTimerMarker_);
111 this.logLinesSinceLastTimerMarker_ = []; 121 this.logLinesSinceLastTimerMarker_ = [];
122 // In pairwise mode, a "current-time" line ends the timed range.
123 if (this.pairwiseTimedRange_) {
124 this.hasSeenTimerMarker_ = false;
125 }
112 } else { 126 } else {
113 this.hasSeenTimerMarker_ = true; 127 this.hasSeenTimerMarker_ = true;
114 } 128 }
115 } else { 129 } else {
116 if (this.hasSeenTimerMarker_) { 130 if (this.hasSeenTimerMarker_) {
117 this.logLinesSinceLastTimerMarker_.push(line); 131 this.logLinesSinceLastTimerMarker_.push(line);
118 } else if (!line.startsWith("tick")) { 132 } else if (!line.startsWith("tick")) {
119 this.processLog_([line]); 133 this.processLog_([line]);
120 } 134 }
121 } 135 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 continue; 226 continue;
213 } 227 }
214 try { 228 try {
215 var fields = this.csvParser_.parseLine(line); 229 var fields = this.csvParser_.parseLine(line);
216 this.dispatchLogRow_(fields); 230 this.dispatchLogRow_(fields);
217 } catch (e) { 231 } catch (e) {
218 this.printError('line ' + (this.lineNum_ + 1) + ': ' + (e.message || e)); 232 this.printError('line ' + (this.lineNum_ + 1) + ': ' + (e.message || e));
219 } 233 }
220 } 234 }
221 }; 235 };
OLDNEW
« no previous file with comments | « no previous file | tools/tickprocessor.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698