Commit 367d14d4 authored by jkummerow's avatar jkummerow Committed by Commit bot

[tick processor] Introduce --pairwise-timed-range processing mode

Review URL: https://codereview.chromium.org/1123883002

Cr-Commit-Position: refs/heads/master@{#28228}
parent e47c3626
...@@ -36,9 +36,11 @@ ...@@ -36,9 +36,11 @@
* @param {Array.<Object>} dispatchTable A table used for parsing and processing * @param {Array.<Object>} dispatchTable A table used for parsing and processing
* log records. * log records.
* @param {boolean} timedRange Ignore ticks outside timed range. * @param {boolean} timedRange Ignore ticks outside timed range.
* @param {boolean} pairwiseTimedRange Ignore ticks outside pairs of timer
* markers.
* @constructor * @constructor
*/ */
function LogReader(dispatchTable, timedRange) { function LogReader(dispatchTable, timedRange, pairwiseTimedRange) {
/** /**
* @type {Array.<Object>} * @type {Array.<Object>}
*/ */
...@@ -49,6 +51,14 @@ function LogReader(dispatchTable, timedRange) { ...@@ -49,6 +51,14 @@ function LogReader(dispatchTable, timedRange) {
*/ */
this.timedRange_ = timedRange; this.timedRange_ = timedRange;
/**
* @type {boolean}
*/
this.pairwiseTimedRange_ = pairwiseTimedRange;
if (pairwiseTimedRange) {
this.timedRange_ = true;
}
/** /**
* Current line. * Current line.
* @type {number} * @type {number}
...@@ -109,6 +119,10 @@ LogReader.prototype.processLogLine = function(line) { ...@@ -109,6 +119,10 @@ LogReader.prototype.processLogLine = function(line) {
if (this.hasSeenTimerMarker_) { if (this.hasSeenTimerMarker_) {
this.processLog_(this.logLinesSinceLastTimerMarker_); this.processLog_(this.logLinesSinceLastTimerMarker_);
this.logLinesSinceLastTimerMarker_ = []; this.logLinesSinceLastTimerMarker_ = [];
// In pairwise mode, a "current-time" line ends the timed range.
if (this.pairwiseTimedRange_) {
this.hasSeenTimerMarker_ = false;
}
} else { } else {
this.hasSeenTimerMarker_ = true; this.hasSeenTimerMarker_ = true;
} }
......
...@@ -76,6 +76,7 @@ var tickProcessor = new TickProcessor( ...@@ -76,6 +76,7 @@ var tickProcessor = new TickProcessor(
params.distortion, params.distortion,
params.range, params.range,
sourceMap, sourceMap,
params.timedRange); params.timedRange,
params.pairwiseTimedRange);
tickProcessor.processLogFile(params.logFileName); tickProcessor.processLogFile(params.logFileName);
tickProcessor.printStatistics(); tickProcessor.printStatistics();
...@@ -155,7 +155,8 @@ function TickProcessor( ...@@ -155,7 +155,8 @@ function TickProcessor(
distortion, distortion,
range, range,
sourceMap, sourceMap,
timedRange) { timedRange,
pairwiseTimedRange) {
LogReader.call(this, { LogReader.call(this, {
'shared-library': { parsers: [null, parseInt, parseInt], 'shared-library': { parsers: [null, parseInt, parseInt],
processor: this.processSharedLibrary }, processor: this.processSharedLibrary },
...@@ -193,7 +194,8 @@ function TickProcessor( ...@@ -193,7 +194,8 @@ function TickProcessor(
'code-allocate': null, 'code-allocate': null,
'begin-code-region': null, 'begin-code-region': null,
'end-code-region': null }, 'end-code-region': null },
timedRange); timedRange,
pairwiseTimedRange);
this.cppEntriesProvider_ = cppEntriesProvider; this.cppEntriesProvider_ = cppEntriesProvider;
this.callGraphSize_ = callGraphSize; this.callGraphSize_ = callGraphSize;
...@@ -880,13 +882,16 @@ function ArgumentsProcessor(args) { ...@@ -880,13 +882,16 @@ function ArgumentsProcessor(args) {
'--source-map': ['sourceMap', null, '--source-map': ['sourceMap', null,
'Specify the source map that should be used for output'], 'Specify the source map that should be used for output'],
'--timed-range': ['timedRange', true, '--timed-range': ['timedRange', true,
'Ignore ticks before first and after last Date.now() call'] 'Ignore ticks before first and after last Date.now() call'],
'--pairwise-timed-range': ['pairwiseTimedRange', true,
'Ignore ticks outside pairs of Date.now() calls']
}; };
this.argsDispatch_['--js'] = this.argsDispatch_['-j']; this.argsDispatch_['--js'] = this.argsDispatch_['-j'];
this.argsDispatch_['--gc'] = this.argsDispatch_['-g']; this.argsDispatch_['--gc'] = this.argsDispatch_['-g'];
this.argsDispatch_['--compiler'] = this.argsDispatch_['-c']; this.argsDispatch_['--compiler'] = this.argsDispatch_['-c'];
this.argsDispatch_['--other'] = this.argsDispatch_['-o']; this.argsDispatch_['--other'] = this.argsDispatch_['-o'];
this.argsDispatch_['--external'] = this.argsDispatch_['-e']; this.argsDispatch_['--external'] = this.argsDispatch_['-e'];
this.argsDispatch_['--ptr'] = this.argsDispatch_['--pairwise-timed-range'];
}; };
...@@ -902,17 +907,18 @@ ArgumentsProcessor.DEFAULTS = { ...@@ -902,17 +907,18 @@ ArgumentsProcessor.DEFAULTS = {
nm: 'nm', nm: 'nm',
range: 'auto,auto', range: 'auto,auto',
distortion: 0, distortion: 0,
timedRange: false timedRange: false,
pairwiseTimedRange: false
}; };
ArgumentsProcessor.prototype.parse = function() { ArgumentsProcessor.prototype.parse = function() {
while (this.args_.length) { while (this.args_.length) {
var arg = this.args_[0]; var arg = this.args_.shift();
if (arg.charAt(0) != '-') { if (arg.charAt(0) != '-') {
break; this.result_.logFileName = arg;
continue;
} }
this.args_.shift();
var userValue = null; var userValue = null;
var eqPos = arg.indexOf('='); var eqPos = arg.indexOf('=');
if (eqPos != -1) { if (eqPos != -1) {
...@@ -926,10 +932,6 @@ ArgumentsProcessor.prototype.parse = function() { ...@@ -926,10 +932,6 @@ ArgumentsProcessor.prototype.parse = function() {
return false; return false;
} }
} }
if (this.args_.length >= 1) {
this.result_.logFileName = this.args_.shift();
}
return true; return true;
}; };
...@@ -954,15 +956,15 @@ ArgumentsProcessor.prototype.printUsageAndExit = function() { ...@@ -954,15 +956,15 @@ ArgumentsProcessor.prototype.printUsageAndExit = function() {
ArgumentsProcessor.DEFAULTS.logFileName + '".\n'); ArgumentsProcessor.DEFAULTS.logFileName + '".\n');
print('Options:'); print('Options:');
for (var arg in this.argsDispatch_) { for (var arg in this.argsDispatch_) {
var synonims = [arg]; var synonyms = [arg];
var dispatch = this.argsDispatch_[arg]; var dispatch = this.argsDispatch_[arg];
for (var synArg in this.argsDispatch_) { for (var synArg in this.argsDispatch_) {
if (arg !== synArg && dispatch === this.argsDispatch_[synArg]) { if (arg !== synArg && dispatch === this.argsDispatch_[synArg]) {
synonims.push(synArg); synonyms.push(synArg);
delete this.argsDispatch_[synArg]; delete this.argsDispatch_[synArg];
} }
} }
print(' ' + padRight(synonims.join(', '), 20) + dispatch[2]); print(' ' + padRight(synonyms.join(', '), 20) + " " + dispatch[2]);
} }
quit(2); quit(2);
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment