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).
[JavaScript]:
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++]:
ticks total nonlib name
......@@ -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.
ticks parent name
3 100.0% LazyCompile: DrawLine 3d-cube.js:17
3 100.0% LazyCompile: DrawQube 3d-cube.js:188
2 66.7% Stub: CompareStub_GE
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 @@
assertEquals('windows', p_platformAndLog.result().platform);
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());
assertEquals(TickProcessor.VmStates.GC, p_flags.result().stateFilter);
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']);
assertTrue(p_nmAndLog.parse());
assertEquals('mn', p_nmAndLog.result().nm);
......@@ -377,7 +382,8 @@ PrintMonitor.prototype.finish = function() {
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.
assertEquals('string', typeof TEST_FILE_NAME);
var pathLen = TEST_FILE_NAME.lastIndexOf('/');
......@@ -388,6 +394,9 @@ function driveTickProcessorTest(
var testsPath = TEST_FILE_NAME.substr(0, pathLen + 1);
var tp = new TickProcessor(new CppEntriesProviderMock(),
separateIc,
separateBytecodes,
separateBuiltins,
separateStubs,
TickProcessor.CALL_GRAPH_SIZE,
ignoreUnknown,
stateFilter,
......@@ -407,23 +416,23 @@ function driveTickProcessorTest(
(function testProcessing() {
var testData = {
'Default': [
false, false, null,
false, false, true, true, false, null,
'tickprocessor-test.log', 'tickprocessor-test.default', false],
'SeparateIc': [
true, false, null,
true, false, true, true, false, null,
'tickprocessor-test.log', 'tickprocessor-test.separate-ic', false],
'IgnoreUnknown': [
false, true, null,
false, false, true, true, true, null,
'tickprocessor-test.log', 'tickprocessor-test.ignore-unknown', false],
'GcState': [
false, false, TickProcessor.VmStates.GC,
false, false, true, true, false, TickProcessor.VmStates.GC,
'tickprocessor-test.log', 'tickprocessor-test.gc-state', false],
'FunctionInfo': [
false, false, null,
false, false, true, true, false, null,
'tickprocessor-test-func-info.log', 'tickprocessor-test.func-info',
false],
'OnlySummary': [
false, false, null,
false, false, true, true, false, null,
'tickprocessor-test.log', 'tickprocessor-test.only-summary', true]
};
for (var testName in testData) {
......
......@@ -64,6 +64,9 @@ if (params.sourceMap) {
var tickProcessor = new TickProcessor(
new (entriesProviders[params.platform])(params.nm, params.targetRootFS),
params.separateIc,
params.separateBytecodes,
params.separateBuiltins,
params.separateStubs,
params.callGraphSize,
params.ignoreUnknown,
params.stateFilter,
......
......@@ -30,17 +30,31 @@ function inherits(childCtor, parentCtor) {
};
function V8Profile(separateIc) {
function V8Profile(separateIc, separateBytecodes, separateBuiltins,
separateStubs) {
Profile.call(this);
if (!separateIc) {
this.skipThisFunction = function(name) { return V8Profile.IC_RE.test(name); };
var regexps = [];
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);
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) {
function TickProcessor(
cppEntriesProvider,
separateIc,
separateBytecodes,
separateBuiltins,
separateStubs,
callGraphSize,
ignoreUnknown,
stateFilter,
......@@ -175,7 +192,8 @@ function TickProcessor(
if (preprocessJson) {
this.profile_ = new JsonProfile();
} else {
this.profile_ = new V8Profile(separateIc);
this.profile_ = new V8Profile(separateIc, separateBytecodes,
separateBuiltins, separateStubs);
}
this.codeTypes_ = {};
// Count each tick as a time unit.
......@@ -808,6 +826,10 @@ WindowsCppEntriesProvider.prototype.unmangleName = function(name) {
function ArgumentsProcessor(args) {
this.args_ = args;
this.result_ = ArgumentsProcessor.DEFAULTS;
function parseBool(str) {
if (str == "true" || str == "1") return true;
return false;
}
this.argsDispatch_ = {
'-j': ['stateFilter', TickProcessor.VmStates.JS,
......@@ -826,8 +848,14 @@ function ArgumentsProcessor(args) {
'Set the call graph size'],
'--ignore-unknown': ['ignoreUnknown', true,
'Exclude ticks of unknown code entries from processing'],
'--separate-ic': ['separateIc', true,
'--separate-ic': ['separateIc', parseBool,
'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',
'Specify that we are running on *nix platform'],
'--windows': ['platform', 'windows',
......@@ -869,6 +897,9 @@ ArgumentsProcessor.DEFAULTS = {
callGraphSize: 5,
ignoreUnknown: false,
separateIc: true,
separateBytecodes: false,
separateBuiltins: true,
separateStubs: true,
preprocessJson: null,
targetRootFS: '',
nm: 'nm',
......@@ -896,7 +927,14 @@ ArgumentsProcessor.prototype.parse = function() {
}
if (arg in this.argsDispatch_) {
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 {
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