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 @@
* @param {Array.<Object>} dispatchTable A table used for parsing and processing
* log records.
* @param {boolean} timedRange Ignore ticks outside timed range.
* @param {boolean} pairwiseTimedRange Ignore ticks outside pairs of timer
* markers.
* @constructor
*/
function LogReader(dispatchTable, timedRange) {
function LogReader(dispatchTable, timedRange, pairwiseTimedRange) {
/**
* @type {Array.<Object>}
*/
......@@ -49,6 +51,14 @@ function LogReader(dispatchTable, timedRange) {
*/
this.timedRange_ = timedRange;
/**
* @type {boolean}
*/
this.pairwiseTimedRange_ = pairwiseTimedRange;
if (pairwiseTimedRange) {
this.timedRange_ = true;
}
/**
* Current line.
* @type {number}
......@@ -109,6 +119,10 @@ LogReader.prototype.processLogLine = function(line) {
if (this.hasSeenTimerMarker_) {
this.processLog_(this.logLinesSinceLastTimerMarker_);
this.logLinesSinceLastTimerMarker_ = [];
// In pairwise mode, a "current-time" line ends the timed range.
if (this.pairwiseTimedRange_) {
this.hasSeenTimerMarker_ = false;
}
} else {
this.hasSeenTimerMarker_ = true;
}
......
......@@ -76,6 +76,7 @@ var tickProcessor = new TickProcessor(
params.distortion,
params.range,
sourceMap,
params.timedRange);
params.timedRange,
params.pairwiseTimedRange);
tickProcessor.processLogFile(params.logFileName);
tickProcessor.printStatistics();
......@@ -155,7 +155,8 @@ function TickProcessor(
distortion,
range,
sourceMap,
timedRange) {
timedRange,
pairwiseTimedRange) {
LogReader.call(this, {
'shared-library': { parsers: [null, parseInt, parseInt],
processor: this.processSharedLibrary },
......@@ -193,7 +194,8 @@ function TickProcessor(
'code-allocate': null,
'begin-code-region': null,
'end-code-region': null },
timedRange);
timedRange,
pairwiseTimedRange);
this.cppEntriesProvider_ = cppEntriesProvider;
this.callGraphSize_ = callGraphSize;
......@@ -880,13 +882,16 @@ function ArgumentsProcessor(args) {
'--source-map': ['sourceMap', null,
'Specify the source map that should be used for output'],
'--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_['--gc'] = this.argsDispatch_['-g'];
this.argsDispatch_['--compiler'] = this.argsDispatch_['-c'];
this.argsDispatch_['--other'] = this.argsDispatch_['-o'];
this.argsDispatch_['--external'] = this.argsDispatch_['-e'];
this.argsDispatch_['--ptr'] = this.argsDispatch_['--pairwise-timed-range'];
};
......@@ -902,17 +907,18 @@ ArgumentsProcessor.DEFAULTS = {
nm: 'nm',
range: 'auto,auto',
distortion: 0,
timedRange: false
timedRange: false,
pairwiseTimedRange: false
};
ArgumentsProcessor.prototype.parse = function() {
while (this.args_.length) {
var arg = this.args_[0];
var arg = this.args_.shift();
if (arg.charAt(0) != '-') {
break;
this.result_.logFileName = arg;
continue;
}
this.args_.shift();
var userValue = null;
var eqPos = arg.indexOf('=');
if (eqPos != -1) {
......@@ -926,10 +932,6 @@ ArgumentsProcessor.prototype.parse = function() {
return false;
}
}
if (this.args_.length >= 1) {
this.result_.logFileName = this.args_.shift();
}
return true;
};
......@@ -954,15 +956,15 @@ ArgumentsProcessor.prototype.printUsageAndExit = function() {
ArgumentsProcessor.DEFAULTS.logFileName + '".\n');
print('Options:');
for (var arg in this.argsDispatch_) {
var synonims = [arg];
var synonyms = [arg];
var dispatch = this.argsDispatch_[arg];
for (var synArg in this.argsDispatch_) {
if (arg !== synArg && dispatch === this.argsDispatch_[synArg]) {
synonims.push(synArg);
synonyms.push(synArg);
delete this.argsDispatch_[synArg];
}
}
print(' ' + padRight(synonims.join(', '), 20) + dispatch[2]);
print(' ' + padRight(synonyms.join(', '), 20) + " " + dispatch[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