[Tick processor] Add an option to the tick-processor to print the summary.
- Print the summary excluding other tick information - Add test to verify that summary is printed correctly. BUG=None LOG=N R=machenbach@chromium.org Review URL: https://codereview.chromium.org/1318933004 Cr-Commit-Position: refs/heads/master@{#30573}
This commit is contained in:
parent
29a2e8f861
commit
e1f38de76a
9
test/mjsunit/tools/tickprocessor-test.only-summary
Normal file
9
test/mjsunit/tools/tickprocessor-test.only-summary
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
Statistical profiling result from v8.log, (13 ticks, 2 unaccounted, 0 excluded).
|
||||||
|
|
||||||
|
[Summary]:
|
||||||
|
ticks total nonlib name
|
||||||
|
0 0.0% 0.0% JavaScript
|
||||||
|
5 38.5% 55.6% C++
|
||||||
|
0 0.0% 0.0% GC
|
||||||
|
4 30.8% Shared libraries
|
||||||
|
2 15.4% Unaccounted
|
@ -370,7 +370,7 @@ PrintMonitor.prototype.finish = function() {
|
|||||||
|
|
||||||
|
|
||||||
function driveTickProcessorTest(
|
function driveTickProcessorTest(
|
||||||
separateIc, ignoreUnknown, stateFilter, logInput, refOutput) {
|
separateIc, 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('/');
|
||||||
@ -387,7 +387,10 @@ function driveTickProcessorTest(
|
|||||||
undefined,
|
undefined,
|
||||||
"0",
|
"0",
|
||||||
"auto,auto",
|
"auto,auto",
|
||||||
false);
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
onlySummary);
|
||||||
var pm = new PrintMonitor(testsPath + refOutput);
|
var pm = new PrintMonitor(testsPath + refOutput);
|
||||||
tp.processLogFileInTest(testsPath + logInput);
|
tp.processLogFileInTest(testsPath + logInput);
|
||||||
tp.printStatistics();
|
tp.printStatistics();
|
||||||
@ -399,19 +402,23 @@ function driveTickProcessorTest(
|
|||||||
var testData = {
|
var testData = {
|
||||||
'Default': [
|
'Default': [
|
||||||
false, false, null,
|
false, false, null,
|
||||||
'tickprocessor-test.log', 'tickprocessor-test.default'],
|
'tickprocessor-test.log', 'tickprocessor-test.default', false],
|
||||||
'SeparateIc': [
|
'SeparateIc': [
|
||||||
true, false, null,
|
true, false, null,
|
||||||
'tickprocessor-test.log', 'tickprocessor-test.separate-ic'],
|
'tickprocessor-test.log', 'tickprocessor-test.separate-ic', false],
|
||||||
'IgnoreUnknown': [
|
'IgnoreUnknown': [
|
||||||
false, true, null,
|
false, true, null,
|
||||||
'tickprocessor-test.log', 'tickprocessor-test.ignore-unknown'],
|
'tickprocessor-test.log', 'tickprocessor-test.ignore-unknown', false],
|
||||||
'GcState': [
|
'GcState': [
|
||||||
false, false, TickProcessor.VmStates.GC,
|
false, false, TickProcessor.VmStates.GC,
|
||||||
'tickprocessor-test.log', 'tickprocessor-test.gc-state'],
|
'tickprocessor-test.log', 'tickprocessor-test.gc-state', false],
|
||||||
'FunctionInfo': [
|
'FunctionInfo': [
|
||||||
false, false, null,
|
false, false, null,
|
||||||
'tickprocessor-test-func-info.log', 'tickprocessor-test.func-info']
|
'tickprocessor-test-func-info.log', 'tickprocessor-test.func-info',
|
||||||
|
false],
|
||||||
|
'OnlySummary': [
|
||||||
|
false, false, null,
|
||||||
|
'tickprocessor-test.log', 'tickprocessor-test.only-summary', true]
|
||||||
};
|
};
|
||||||
for (var testName in testData) {
|
for (var testName in testData) {
|
||||||
print('=== testProcessing-' + testName + ' ===');
|
print('=== testProcessing-' + testName + ' ===');
|
||||||
|
@ -77,6 +77,7 @@ var tickProcessor = new TickProcessor(
|
|||||||
params.range,
|
params.range,
|
||||||
sourceMap,
|
sourceMap,
|
||||||
params.timedRange,
|
params.timedRange,
|
||||||
params.pairwiseTimedRange);
|
params.pairwiseTimedRange,
|
||||||
|
params.onlySummary);
|
||||||
tickProcessor.processLogFile(params.logFileName);
|
tickProcessor.processLogFile(params.logFileName);
|
||||||
tickProcessor.printStatistics();
|
tickProcessor.printStatistics();
|
||||||
|
@ -156,7 +156,8 @@ function TickProcessor(
|
|||||||
range,
|
range,
|
||||||
sourceMap,
|
sourceMap,
|
||||||
timedRange,
|
timedRange,
|
||||||
pairwiseTimedRange) {
|
pairwiseTimedRange,
|
||||||
|
onlySummary) {
|
||||||
LogReader.call(this, {
|
LogReader.call(this, {
|
||||||
'shared-library': { parsers: [null, parseInt, parseInt],
|
'shared-library': { parsers: [null, parseInt, parseInt],
|
||||||
processor: this.processSharedLibrary },
|
processor: this.processSharedLibrary },
|
||||||
@ -247,6 +248,7 @@ function TickProcessor(
|
|||||||
|
|
||||||
this.generation_ = 1;
|
this.generation_ = 1;
|
||||||
this.currentProducerProfile_ = null;
|
this.currentProducerProfile_ = null;
|
||||||
|
this.onlySummary_ = onlySummary;
|
||||||
};
|
};
|
||||||
inherits(TickProcessor, LogReader);
|
inherits(TickProcessor, LogReader);
|
||||||
|
|
||||||
@ -456,29 +458,30 @@ TickProcessor.prototype.printStatistics = function() {
|
|||||||
if (this.ignoreUnknown_) {
|
if (this.ignoreUnknown_) {
|
||||||
totalTicks -= this.ticks_.unaccounted;
|
totalTicks -= this.ticks_.unaccounted;
|
||||||
}
|
}
|
||||||
|
var printAllTicks = !this.onlySummary_;
|
||||||
|
|
||||||
// Count library ticks
|
// Count library ticks
|
||||||
var flatViewNodes = flatView.head.children;
|
var flatViewNodes = flatView.head.children;
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
var libraryTicks = 0;
|
var libraryTicks = 0;
|
||||||
this.printHeader('Shared libraries');
|
if(printAllTicks) this.printHeader('Shared libraries');
|
||||||
this.printEntries(flatViewNodes, totalTicks, null,
|
this.printEntries(flatViewNodes, totalTicks, null,
|
||||||
function(name) { return self.isSharedLibrary(name); },
|
function(name) { return self.isSharedLibrary(name); },
|
||||||
function(rec) { libraryTicks += rec.selfTime; });
|
function(rec) { libraryTicks += rec.selfTime; }, printAllTicks);
|
||||||
var nonLibraryTicks = totalTicks - libraryTicks;
|
var nonLibraryTicks = totalTicks - libraryTicks;
|
||||||
|
|
||||||
var jsTicks = 0;
|
var jsTicks = 0;
|
||||||
this.printHeader('JavaScript');
|
if(printAllTicks) this.printHeader('JavaScript');
|
||||||
this.printEntries(flatViewNodes, totalTicks, nonLibraryTicks,
|
this.printEntries(flatViewNodes, totalTicks, nonLibraryTicks,
|
||||||
function(name) { return self.isJsCode(name); },
|
function(name) { return self.isJsCode(name); },
|
||||||
function(rec) { jsTicks += rec.selfTime; });
|
function(rec) { jsTicks += rec.selfTime; }, printAllTicks);
|
||||||
|
|
||||||
var cppTicks = 0;
|
var cppTicks = 0;
|
||||||
this.printHeader('C++');
|
if(printAllTicks) this.printHeader('C++');
|
||||||
this.printEntries(flatViewNodes, totalTicks, nonLibraryTicks,
|
this.printEntries(flatViewNodes, totalTicks, nonLibraryTicks,
|
||||||
function(name) { return self.isCppCode(name); },
|
function(name) { return self.isCppCode(name); },
|
||||||
function(rec) { cppTicks += rec.selfTime; });
|
function(rec) { cppTicks += rec.selfTime; }, printAllTicks);
|
||||||
|
|
||||||
this.printHeader('Summary');
|
this.printHeader('Summary');
|
||||||
this.printLine('JavaScript', jsTicks, totalTicks, nonLibraryTicks);
|
this.printLine('JavaScript', jsTicks, totalTicks, nonLibraryTicks);
|
||||||
@ -490,25 +493,27 @@ TickProcessor.prototype.printStatistics = function() {
|
|||||||
this.ticks_.total, null);
|
this.ticks_.total, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
print('\n [C++ entry points]:');
|
if(printAllTicks) {
|
||||||
print(' ticks cpp total name');
|
print('\n [C++ entry points]:');
|
||||||
var c_entry_functions = this.profile_.getCEntryProfile();
|
print(' ticks cpp total name');
|
||||||
var total_c_entry = c_entry_functions[0].ticks;
|
var c_entry_functions = this.profile_.getCEntryProfile();
|
||||||
for (var i = 1; i < c_entry_functions.length; i++) {
|
var total_c_entry = c_entry_functions[0].ticks;
|
||||||
c = c_entry_functions[i];
|
for (var i = 1; i < c_entry_functions.length; i++) {
|
||||||
this.printLine(c.name, c.ticks, total_c_entry, totalTicks);
|
c = c_entry_functions[i];
|
||||||
}
|
this.printLine(c.name, c.ticks, total_c_entry, totalTicks);
|
||||||
|
}
|
||||||
|
|
||||||
this.printHeavyProfHeader();
|
this.printHeavyProfHeader();
|
||||||
var heavyProfile = this.profile_.getBottomUpProfile();
|
var heavyProfile = this.profile_.getBottomUpProfile();
|
||||||
var heavyView = this.viewBuilder_.buildView(heavyProfile);
|
var heavyView = this.viewBuilder_.buildView(heavyProfile);
|
||||||
// To show the same percentages as in the flat profile.
|
// To show the same percentages as in the flat profile.
|
||||||
heavyView.head.totalTime = totalTicks;
|
heavyView.head.totalTime = totalTicks;
|
||||||
// Sort by total time, desc, then by name, desc.
|
// Sort by total time, desc, then by name, desc.
|
||||||
heavyView.sort(function(rec1, rec2) {
|
heavyView.sort(function(rec1, rec2) {
|
||||||
return rec2.totalTime - rec1.totalTime ||
|
return rec2.totalTime - rec1.totalTime ||
|
||||||
(rec2.internalFuncName < rec1.internalFuncName ? -1 : 1); });
|
(rec2.internalFuncName < rec1.internalFuncName ? -1 : 1); });
|
||||||
this.printHeavyProfile(heavyView.head.children);
|
this.printHeavyProfile(heavyView.head.children);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -600,13 +605,15 @@ TickProcessor.prototype.formatFunctionName = function(funcName) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
TickProcessor.prototype.printEntries = function(
|
TickProcessor.prototype.printEntries = function(
|
||||||
profile, totalTicks, nonLibTicks, filterP, callback) {
|
profile, totalTicks, nonLibTicks, filterP, callback, printAllTicks) {
|
||||||
var that = this;
|
var that = this;
|
||||||
this.processProfile(profile, filterP, function (rec) {
|
this.processProfile(profile, filterP, function (rec) {
|
||||||
if (rec.selfTime == 0) return;
|
if (rec.selfTime == 0) return;
|
||||||
callback(rec);
|
callback(rec);
|
||||||
var funcName = that.formatFunctionName(rec.internalFuncName);
|
var funcName = that.formatFunctionName(rec.internalFuncName);
|
||||||
that.printLine(funcName, rec.selfTime, totalTicks, nonLibTicks);
|
if(printAllTicks) {
|
||||||
|
that.printLine(funcName, rec.selfTime, totalTicks, nonLibTicks);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -884,7 +891,9 @@ function ArgumentsProcessor(args) {
|
|||||||
'--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,
|
'--pairwise-timed-range': ['pairwiseTimedRange', true,
|
||||||
'Ignore ticks outside pairs of Date.now() calls']
|
'Ignore ticks outside pairs of Date.now() calls'],
|
||||||
|
'--only-summary': ['onlySummary', true,
|
||||||
|
'Print only tick summary, exclude other information']
|
||||||
};
|
};
|
||||||
this.argsDispatch_['--js'] = this.argsDispatch_['-j'];
|
this.argsDispatch_['--js'] = this.argsDispatch_['-j'];
|
||||||
this.argsDispatch_['--gc'] = this.argsDispatch_['-g'];
|
this.argsDispatch_['--gc'] = this.argsDispatch_['-g'];
|
||||||
@ -908,7 +917,8 @@ ArgumentsProcessor.DEFAULTS = {
|
|||||||
range: 'auto,auto',
|
range: 'auto,auto',
|
||||||
distortion: 0,
|
distortion: 0,
|
||||||
timedRange: false,
|
timedRange: false,
|
||||||
pairwiseTimedRange: false
|
pairwiseTimedRange: false,
|
||||||
|
onlySummary: false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user