Commit 55f5bac4 authored by Camillo Bruni's avatar Camillo Bruni Committed by Commit Bot

[tools] Add options to separate more entries in tickprocessor

Enable separatio of ic, bytecode, builtin and stub entries through:
    --separate-ic=true
    --separate-bytecodes=true
    --separate-builtins=true
    --separate-stubs=true

Change-Id: I6da4be7add093bb54abe956c60cd186e735ed9b5
Reviewed-on: https://chromium-review.googlesource.com/473046
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#44555}
parent 7f7d403d
...@@ -5,7 +5,8 @@ Statistical profiling result from v8.log, (3 ticks, 0 unaccounted, 0 excluded). ...@@ -5,7 +5,8 @@ Statistical profiling result from v8.log, (3 ticks, 0 unaccounted, 0 excluded).
[JavaScript]: [JavaScript]:
ticks total nonlib name ticks total nonlib name
3 100.0% 100.0% LazyCompile: DrawLine 3d-cube.js:17 2 66.7% 66.7% Stub: CompareStub_GE
1 33.3% 33.3% LazyCompile: DrawLine 3d-cube.js:17
[C++]: [C++]:
ticks total nonlib name ticks total nonlib name
...@@ -26,6 +27,9 @@ Statistical profiling result from v8.log, (3 ticks, 0 unaccounted, 0 excluded). ...@@ -26,6 +27,9 @@ Statistical profiling result from v8.log, (3 ticks, 0 unaccounted, 0 excluded).
Callers occupying less than 1.0% are not shown. Callers occupying less than 1.0% are not shown.
ticks parent name ticks parent name
3 100.0% LazyCompile: DrawLine 3d-cube.js:17 2 66.7% Stub: CompareStub_GE
3 100.0% LazyCompile: DrawQube 3d-cube.js:188 2 100.0% LazyCompile: DrawLine 3d-cube.js:17
2 100.0% LazyCompile: DrawQube 3d-cube.js:188
1 33.3% LazyCompile: DrawLine 3d-cube.js:17
1 100.0% LazyCompile: DrawQube 3d-cube.js:188
...@@ -46,11 +46,16 @@ ...@@ -46,11 +46,16 @@
assertEquals('windows', p_platformAndLog.result().platform); assertEquals('windows', p_platformAndLog.result().platform);
assertEquals('winlog.log', p_platformAndLog.result().logFileName); assertEquals('winlog.log', p_platformAndLog.result().logFileName);
var p_flags = new ArgumentsProcessor(['--gc', '--separate-ic']); var p_flags = new ArgumentsProcessor(['--gc', '--separate-ic=true']);
assertTrue(p_flags.parse()); assertTrue(p_flags.parse());
assertEquals(TickProcessor.VmStates.GC, p_flags.result().stateFilter); assertEquals(TickProcessor.VmStates.GC, p_flags.result().stateFilter);
assertTrue(p_flags.result().separateIc); assertTrue(p_flags.result().separateIc);
var p_flags = new ArgumentsProcessor(['--gc', '--separate-ic=false']);
assertTrue(p_flags.parse());
assertEquals(TickProcessor.VmStates.GC, p_flags.result().stateFilter);
assertFalse(p_flags.result().separateIc);
var p_nmAndLog = new ArgumentsProcessor(['--nm=mn', 'nmlog.log']); var p_nmAndLog = new ArgumentsProcessor(['--nm=mn', 'nmlog.log']);
assertTrue(p_nmAndLog.parse()); assertTrue(p_nmAndLog.parse());
assertEquals('mn', p_nmAndLog.result().nm); assertEquals('mn', p_nmAndLog.result().nm);
...@@ -377,7 +382,8 @@ PrintMonitor.prototype.finish = function() { ...@@ -377,7 +382,8 @@ PrintMonitor.prototype.finish = function() {
function driveTickProcessorTest( function driveTickProcessorTest(
separateIc, ignoreUnknown, stateFilter, logInput, refOutput, onlySummary) { separateIc, separateBytecodes, separateBuiltins, separateStubs,
ignoreUnknown, stateFilter, logInput, refOutput, onlySummary) {
// TEST_FILE_NAME must be provided by test runner. // TEST_FILE_NAME must be provided by test runner.
assertEquals('string', typeof TEST_FILE_NAME); assertEquals('string', typeof TEST_FILE_NAME);
var pathLen = TEST_FILE_NAME.lastIndexOf('/'); var pathLen = TEST_FILE_NAME.lastIndexOf('/');
...@@ -388,6 +394,9 @@ function driveTickProcessorTest( ...@@ -388,6 +394,9 @@ function driveTickProcessorTest(
var testsPath = TEST_FILE_NAME.substr(0, pathLen + 1); var testsPath = TEST_FILE_NAME.substr(0, pathLen + 1);
var tp = new TickProcessor(new CppEntriesProviderMock(), var tp = new TickProcessor(new CppEntriesProviderMock(),
separateIc, separateIc,
separateBytecodes,
separateBuiltins,
separateStubs,
TickProcessor.CALL_GRAPH_SIZE, TickProcessor.CALL_GRAPH_SIZE,
ignoreUnknown, ignoreUnknown,
stateFilter, stateFilter,
...@@ -407,23 +416,23 @@ function driveTickProcessorTest( ...@@ -407,23 +416,23 @@ function driveTickProcessorTest(
(function testProcessing() { (function testProcessing() {
var testData = { var testData = {
'Default': [ 'Default': [
false, false, null, false, false, true, true, false, null,
'tickprocessor-test.log', 'tickprocessor-test.default', false], 'tickprocessor-test.log', 'tickprocessor-test.default', false],
'SeparateIc': [ 'SeparateIc': [
true, false, null, true, false, true, true, false, null,
'tickprocessor-test.log', 'tickprocessor-test.separate-ic', false], 'tickprocessor-test.log', 'tickprocessor-test.separate-ic', false],
'IgnoreUnknown': [ 'IgnoreUnknown': [
false, true, null, false, false, true, true, true, null,
'tickprocessor-test.log', 'tickprocessor-test.ignore-unknown', false], 'tickprocessor-test.log', 'tickprocessor-test.ignore-unknown', false],
'GcState': [ 'GcState': [
false, false, TickProcessor.VmStates.GC, false, false, true, true, false, TickProcessor.VmStates.GC,
'tickprocessor-test.log', 'tickprocessor-test.gc-state', false], 'tickprocessor-test.log', 'tickprocessor-test.gc-state', false],
'FunctionInfo': [ 'FunctionInfo': [
false, false, null, false, false, true, true, false, null,
'tickprocessor-test-func-info.log', 'tickprocessor-test.func-info', 'tickprocessor-test-func-info.log', 'tickprocessor-test.func-info',
false], false],
'OnlySummary': [ 'OnlySummary': [
false, false, null, false, false, true, true, false, null,
'tickprocessor-test.log', 'tickprocessor-test.only-summary', true] 'tickprocessor-test.log', 'tickprocessor-test.only-summary', true]
}; };
for (var testName in testData) { for (var testName in testData) {
......
...@@ -64,6 +64,9 @@ if (params.sourceMap) { ...@@ -64,6 +64,9 @@ if (params.sourceMap) {
var tickProcessor = new TickProcessor( var tickProcessor = new TickProcessor(
new (entriesProviders[params.platform])(params.nm, params.targetRootFS), new (entriesProviders[params.platform])(params.nm, params.targetRootFS),
params.separateIc, params.separateIc,
params.separateBytecodes,
params.separateBuiltins,
params.separateStubs,
params.callGraphSize, params.callGraphSize,
params.ignoreUnknown, params.ignoreUnknown,
params.stateFilter, params.stateFilter,
......
...@@ -30,17 +30,31 @@ function inherits(childCtor, parentCtor) { ...@@ -30,17 +30,31 @@ function inherits(childCtor, parentCtor) {
}; };
function V8Profile(separateIc) { function V8Profile(separateIc, separateBytecodes, separateBuiltins,
separateStubs) {
Profile.call(this); Profile.call(this);
if (!separateIc) { var regexps = [];
this.skipThisFunction = function(name) { return V8Profile.IC_RE.test(name); }; if (!separateIc) regexps.push(V8Profile.IC_RE);
if (!separateBytecodes) regexps.push(V8Profile.BYTECODES_RE);
if (!separateBuiltins) regexps.push(V8Profile.BUILTINS_RE);
if (!separateStubs) regexps.push(V8Profile.STUBS_RE);
if (regexps.length > 0) {
this.skipThisFunction = function(name) {
for (var i=0; i<regexps.length; i++) {
if (regexps[i].test(name)) return true;
}
return false;
};
} }
}; };
inherits(V8Profile, Profile); inherits(V8Profile, Profile);
V8Profile.IC_RE = V8Profile.IC_RE =
/^(LoadGlobalIC: )|(Handler: )|(Stub: )|(Builtin: )|(BytecodeHandler: )|(?:CallIC|LoadIC|StoreIC)|(?:Builtin: (?:Keyed)?(?:Load|Store)IC_)/; /^(LoadGlobalIC: )|(Handler: )|(?:CallIC|LoadIC|StoreIC)|(?:Builtin: (?:Keyed)?(?:Load|Store)IC_)/;
V8Profile.BYTECODES_RE = /^(BytecodeHandler: )/
V8Profile.BUILTINS_RE = /^(Builtin: )/
V8Profile.STUBS_RE = /^(Stub: )/
/** /**
...@@ -72,6 +86,9 @@ function parseState(s) { ...@@ -72,6 +86,9 @@ function parseState(s) {
function TickProcessor( function TickProcessor(
cppEntriesProvider, cppEntriesProvider,
separateIc, separateIc,
separateBytecodes,
separateBuiltins,
separateStubs,
callGraphSize, callGraphSize,
ignoreUnknown, ignoreUnknown,
stateFilter, stateFilter,
...@@ -175,7 +192,8 @@ function TickProcessor( ...@@ -175,7 +192,8 @@ function TickProcessor(
if (preprocessJson) { if (preprocessJson) {
this.profile_ = new JsonProfile(); this.profile_ = new JsonProfile();
} else { } else {
this.profile_ = new V8Profile(separateIc); this.profile_ = new V8Profile(separateIc, separateBytecodes,
separateBuiltins, separateStubs);
} }
this.codeTypes_ = {}; this.codeTypes_ = {};
// Count each tick as a time unit. // Count each tick as a time unit.
...@@ -808,6 +826,10 @@ WindowsCppEntriesProvider.prototype.unmangleName = function(name) { ...@@ -808,6 +826,10 @@ WindowsCppEntriesProvider.prototype.unmangleName = function(name) {
function ArgumentsProcessor(args) { function ArgumentsProcessor(args) {
this.args_ = args; this.args_ = args;
this.result_ = ArgumentsProcessor.DEFAULTS; this.result_ = ArgumentsProcessor.DEFAULTS;
function parseBool(str) {
if (str == "true" || str == "1") return true;
return false;
}
this.argsDispatch_ = { this.argsDispatch_ = {
'-j': ['stateFilter', TickProcessor.VmStates.JS, '-j': ['stateFilter', TickProcessor.VmStates.JS,
...@@ -826,8 +848,14 @@ function ArgumentsProcessor(args) { ...@@ -826,8 +848,14 @@ function ArgumentsProcessor(args) {
'Set the call graph size'], 'Set the call graph size'],
'--ignore-unknown': ['ignoreUnknown', true, '--ignore-unknown': ['ignoreUnknown', true,
'Exclude ticks of unknown code entries from processing'], 'Exclude ticks of unknown code entries from processing'],
'--separate-ic': ['separateIc', true, '--separate-ic': ['separateIc', parseBool,
'Separate IC entries'], 'Separate IC entries'],
'--separate-bytecodes': ['separateBytecodes', parseBool,
'Separate Bytecode entries'],
'--separate-builtins': ['separateBuiltins', parseBool,
'Separate Builtin entries'],
'--separate-stubs': ['separateStubs', parseBool,
'Separate Stub entries'],
'--unix': ['platform', 'unix', '--unix': ['platform', 'unix',
'Specify that we are running on *nix platform'], 'Specify that we are running on *nix platform'],
'--windows': ['platform', 'windows', '--windows': ['platform', 'windows',
...@@ -869,6 +897,9 @@ ArgumentsProcessor.DEFAULTS = { ...@@ -869,6 +897,9 @@ ArgumentsProcessor.DEFAULTS = {
callGraphSize: 5, callGraphSize: 5,
ignoreUnknown: false, ignoreUnknown: false,
separateIc: true, separateIc: true,
separateBytecodes: false,
separateBuiltins: true,
separateStubs: true,
preprocessJson: null, preprocessJson: null,
targetRootFS: '', targetRootFS: '',
nm: 'nm', nm: 'nm',
...@@ -896,7 +927,14 @@ ArgumentsProcessor.prototype.parse = function() { ...@@ -896,7 +927,14 @@ ArgumentsProcessor.prototype.parse = function() {
} }
if (arg in this.argsDispatch_) { if (arg in this.argsDispatch_) {
var dispatch = this.argsDispatch_[arg]; var dispatch = this.argsDispatch_[arg];
this.result_[dispatch[0]] = userValue == null ? dispatch[1] : userValue; var property = dispatch[0];
var defaultValue = dispatch[1];
if (typeof defaultValue == "function") {
userValue = defaultValue(userValue);
} else if (userValue == null) {
userValue = defaultValue;
}
this.result_[property] = userValue;
} else { } else {
return false; return false;
} }
......
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