Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: tools/tickprocessor.js

Issue 1318933004: [Tick processor] Add an option to the tick-processor to print the summary. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Review comments from Jakob and Michael. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/tools/tickprocessor-test.only-summary ('k') | tools/tickprocessor-driver.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/tickprocessor.js
diff --git a/tools/tickprocessor.js b/tools/tickprocessor.js
index d8575738553aa93f46116489312232d31acf8cf5..600d2eeb7b79dc3bcee56f183e0ec3c2347e83f6 100644
--- a/tools/tickprocessor.js
+++ b/tools/tickprocessor.js
@@ -156,7 +156,8 @@ function TickProcessor(
range,
sourceMap,
timedRange,
- pairwiseTimedRange) {
+ pairwiseTimedRange,
+ onlySummary) {
LogReader.call(this, {
'shared-library': { parsers: [null, parseInt, parseInt],
processor: this.processSharedLibrary },
@@ -247,6 +248,7 @@ function TickProcessor(
this.generation_ = 1;
this.currentProducerProfile_ = null;
+ this.onlySummary_ = onlySummary;
};
inherits(TickProcessor, LogReader);
@@ -456,29 +458,30 @@ TickProcessor.prototype.printStatistics = function() {
if (this.ignoreUnknown_) {
totalTicks -= this.ticks_.unaccounted;
}
+ var printAllTicks = !this.onlySummary_;
// Count library ticks
var flatViewNodes = flatView.head.children;
var self = this;
var libraryTicks = 0;
- this.printHeader('Shared libraries');
+ if(printAllTicks) this.printHeader('Shared libraries');
this.printEntries(flatViewNodes, totalTicks, null,
function(name) { return self.isSharedLibrary(name); },
- function(rec) { libraryTicks += rec.selfTime; });
+ function(rec) { libraryTicks += rec.selfTime; }, printAllTicks);
var nonLibraryTicks = totalTicks - libraryTicks;
var jsTicks = 0;
- this.printHeader('JavaScript');
+ if(printAllTicks) this.printHeader('JavaScript');
this.printEntries(flatViewNodes, totalTicks, nonLibraryTicks,
function(name) { return self.isJsCode(name); },
- function(rec) { jsTicks += rec.selfTime; });
+ function(rec) { jsTicks += rec.selfTime; }, printAllTicks);
var cppTicks = 0;
- this.printHeader('C++');
+ if(printAllTicks) this.printHeader('C++');
this.printEntries(flatViewNodes, totalTicks, nonLibraryTicks,
function(name) { return self.isCppCode(name); },
- function(rec) { cppTicks += rec.selfTime; });
+ function(rec) { cppTicks += rec.selfTime; }, printAllTicks);
this.printHeader('Summary');
this.printLine('JavaScript', jsTicks, totalTicks, nonLibraryTicks);
@@ -490,25 +493,27 @@ TickProcessor.prototype.printStatistics = function() {
this.ticks_.total, null);
}
- print('\n [C++ entry points]:');
- print(' ticks cpp total name');
- var c_entry_functions = this.profile_.getCEntryProfile();
- var total_c_entry = c_entry_functions[0].ticks;
- for (var i = 1; i < c_entry_functions.length; i++) {
- c = c_entry_functions[i];
- this.printLine(c.name, c.ticks, total_c_entry, totalTicks);
- }
+ if(printAllTicks) {
+ print('\n [C++ entry points]:');
+ print(' ticks cpp total name');
+ var c_entry_functions = this.profile_.getCEntryProfile();
+ var total_c_entry = c_entry_functions[0].ticks;
+ for (var i = 1; i < c_entry_functions.length; i++) {
+ c = c_entry_functions[i];
+ this.printLine(c.name, c.ticks, total_c_entry, totalTicks);
+ }
- this.printHeavyProfHeader();
- var heavyProfile = this.profile_.getBottomUpProfile();
- var heavyView = this.viewBuilder_.buildView(heavyProfile);
- // To show the same percentages as in the flat profile.
- heavyView.head.totalTime = totalTicks;
- // Sort by total time, desc, then by name, desc.
- heavyView.sort(function(rec1, rec2) {
- return rec2.totalTime - rec1.totalTime ||
- (rec2.internalFuncName < rec1.internalFuncName ? -1 : 1); });
- this.printHeavyProfile(heavyView.head.children);
+ this.printHeavyProfHeader();
+ var heavyProfile = this.profile_.getBottomUpProfile();
+ var heavyView = this.viewBuilder_.buildView(heavyProfile);
+ // To show the same percentages as in the flat profile.
+ heavyView.head.totalTime = totalTicks;
+ // Sort by total time, desc, then by name, desc.
+ heavyView.sort(function(rec1, rec2) {
+ return rec2.totalTime - rec1.totalTime ||
+ (rec2.internalFuncName < rec1.internalFuncName ? -1 : 1); });
+ this.printHeavyProfile(heavyView.head.children);
+ }
};
@@ -600,13 +605,15 @@ TickProcessor.prototype.formatFunctionName = function(funcName) {
};
TickProcessor.prototype.printEntries = function(
- profile, totalTicks, nonLibTicks, filterP, callback) {
+ profile, totalTicks, nonLibTicks, filterP, callback, printAllTicks) {
var that = this;
this.processProfile(profile, filterP, function (rec) {
if (rec.selfTime == 0) return;
callback(rec);
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,
'Ignore ticks before first and after last Date.now() call'],
'--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_['--gc'] = this.argsDispatch_['-g'];
@@ -908,7 +917,8 @@ ArgumentsProcessor.DEFAULTS = {
range: 'auto,auto',
distortion: 0,
timedRange: false,
- pairwiseTimedRange: false
+ pairwiseTimedRange: false,
+ onlySummary: false
};
« no previous file with comments | « test/mjsunit/tools/tickprocessor-test.only-summary ('k') | tools/tickprocessor-driver.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698