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

Side by Side Diff: tools/tickprocessor.js

Issue 9386007: Add --call-graph-size option to tickprocessor. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/tickprocessor-driver.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 }; 139 };
140 140
141 141
142 SnapshotLogProcessor.prototype.getSerializedEntryName = function(pos) { 142 SnapshotLogProcessor.prototype.getSerializedEntryName = function(pos) {
143 var entry = this.serializedEntries_[pos]; 143 var entry = this.serializedEntries_[pos];
144 return entry ? entry.getRawName() : null; 144 return entry ? entry.getRawName() : null;
145 }; 145 };
146 146
147 147
148 function TickProcessor( 148 function TickProcessor(
149 cppEntriesProvider, separateIc, ignoreUnknown, stateFilter, snapshotLogProce ssor) { 149 cppEntriesProvider,
150 separateIc,
151 callGraphSize,
152 ignoreUnknown,
153 stateFilter,
154 snapshotLogProcessor) {
150 LogReader.call(this, { 155 LogReader.call(this, {
151 'shared-library': { parsers: [null, parseInt, parseInt], 156 'shared-library': { parsers: [null, parseInt, parseInt],
152 processor: this.processSharedLibrary }, 157 processor: this.processSharedLibrary },
153 'code-creation': { 158 'code-creation': {
154 parsers: [null, parseInt, parseInt, null, 'var-args'], 159 parsers: [null, parseInt, parseInt, null, 'var-args'],
155 processor: this.processCodeCreation }, 160 processor: this.processCodeCreation },
156 'code-move': { parsers: [parseInt, parseInt], 161 'code-move': { parsers: [parseInt, parseInt],
157 processor: this.processCodeMove }, 162 processor: this.processCodeMove },
158 'code-delete': { parsers: [parseInt], 163 'code-delete': { parsers: [parseInt],
159 processor: this.processCodeDelete }, 164 processor: this.processCodeDelete },
(...skipping 14 matching lines...) Expand all
174 'function-creation': null, 179 'function-creation': null,
175 'function-move': null, 180 'function-move': null,
176 'function-delete': null, 181 'function-delete': null,
177 'heap-sample-item': null, 182 'heap-sample-item': null,
178 // Obsolete row types. 183 // Obsolete row types.
179 'code-allocate': null, 184 'code-allocate': null,
180 'begin-code-region': null, 185 'begin-code-region': null,
181 'end-code-region': null }); 186 'end-code-region': null });
182 187
183 this.cppEntriesProvider_ = cppEntriesProvider; 188 this.cppEntriesProvider_ = cppEntriesProvider;
189 this.callGraphSize_ = callGraphSize;
184 this.ignoreUnknown_ = ignoreUnknown; 190 this.ignoreUnknown_ = ignoreUnknown;
185 this.stateFilter_ = stateFilter; 191 this.stateFilter_ = stateFilter;
186 this.snapshotLogProcessor_ = snapshotLogProcessor; 192 this.snapshotLogProcessor_ = snapshotLogProcessor;
187 this.deserializedEntriesNames_ = []; 193 this.deserializedEntriesNames_ = [];
188 var ticks = this.ticks_ = 194 var ticks = this.ticks_ =
189 { total: 0, unaccounted: 0, excluded: 0, gc: 0 }; 195 { total: 0, unaccounted: 0, excluded: 0, gc: 0 };
190 196
191 V8Profile.prototype.handleUnknownCode = function( 197 V8Profile.prototype.handleUnknownCode = function(
192 operation, addr, opt_stackPos) { 198 operation, addr, opt_stackPos) {
193 var op = Profile.Operation; 199 var op = Profile.Operation;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 TickProcessor.CodeTypes = { 239 TickProcessor.CodeTypes = {
234 CPP: 0, 240 CPP: 0,
235 SHARED_LIB: 1 241 SHARED_LIB: 1
236 }; 242 };
237 // Otherwise, this is JS-related code. We are not adding it to 243 // Otherwise, this is JS-related code. We are not adding it to
238 // codeTypes_ map because there can be zillions of them. 244 // codeTypes_ map because there can be zillions of them.
239 245
240 246
241 TickProcessor.CALL_PROFILE_CUTOFF_PCT = 2.0; 247 TickProcessor.CALL_PROFILE_CUTOFF_PCT = 2.0;
242 248
249 TickProcessor.CALL_GRAPH_SIZE = 5;
243 250
244 /** 251 /**
245 * @override 252 * @override
246 */ 253 */
247 TickProcessor.prototype.printError = function(str) { 254 TickProcessor.prototype.printError = function(str) {
248 print(str); 255 print(str);
249 }; 256 };
250 257
251 258
252 TickProcessor.prototype.setCodeType = function(name, type) { 259 TickProcessor.prototype.setCodeType = function(name, type) {
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 var self = this; 535 var self = this;
529 var indent = opt_indent || 0; 536 var indent = opt_indent || 0;
530 var indentStr = padLeft('', indent); 537 var indentStr = padLeft('', indent);
531 this.processProfile(profile, function() { return true; }, function (rec) { 538 this.processProfile(profile, function() { return true; }, function (rec) {
532 // Cut off too infrequent callers. 539 // Cut off too infrequent callers.
533 if (rec.parentTotalPercent < TickProcessor.CALL_PROFILE_CUTOFF_PCT) return; 540 if (rec.parentTotalPercent < TickProcessor.CALL_PROFILE_CUTOFF_PCT) return;
534 print(' ' + padLeft(rec.totalTime, 5) + ' ' + 541 print(' ' + padLeft(rec.totalTime, 5) + ' ' +
535 padLeft(rec.parentTotalPercent.toFixed(1), 5) + '% ' + 542 padLeft(rec.parentTotalPercent.toFixed(1), 5) + '% ' +
536 indentStr + rec.internalFuncName); 543 indentStr + rec.internalFuncName);
537 // Limit backtrace depth. 544 // Limit backtrace depth.
538 if (indent < 10) { 545 if (indent < 2 * self.callGraphSize_) {
539 self.printHeavyProfile(rec.children, indent + 2); 546 self.printHeavyProfile(rec.children, indent + 2);
540 } 547 }
541 // Delimit top-level functions. 548 // Delimit top-level functions.
542 if (indent == 0) { 549 if (indent == 0) {
543 print(''); 550 print('');
544 } 551 }
545 }); 552 });
546 }; 553 };
547 554
548 555
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 '-j': ['stateFilter', TickProcessor.VmStates.JS, 764 '-j': ['stateFilter', TickProcessor.VmStates.JS,
758 'Show only ticks from JS VM state'], 765 'Show only ticks from JS VM state'],
759 '-g': ['stateFilter', TickProcessor.VmStates.GC, 766 '-g': ['stateFilter', TickProcessor.VmStates.GC,
760 'Show only ticks from GC VM state'], 767 'Show only ticks from GC VM state'],
761 '-c': ['stateFilter', TickProcessor.VmStates.COMPILER, 768 '-c': ['stateFilter', TickProcessor.VmStates.COMPILER,
762 'Show only ticks from COMPILER VM state'], 769 'Show only ticks from COMPILER VM state'],
763 '-o': ['stateFilter', TickProcessor.VmStates.OTHER, 770 '-o': ['stateFilter', TickProcessor.VmStates.OTHER,
764 'Show only ticks from OTHER VM state'], 771 'Show only ticks from OTHER VM state'],
765 '-e': ['stateFilter', TickProcessor.VmStates.EXTERNAL, 772 '-e': ['stateFilter', TickProcessor.VmStates.EXTERNAL,
766 'Show only ticks from EXTERNAL VM state'], 773 'Show only ticks from EXTERNAL VM state'],
774 '--call-graph-size': ['callGraphSize', TickProcessor.CALL_GRAPH_SIZE,
775 'Set the call graph size'],
767 '--ignore-unknown': ['ignoreUnknown', true, 776 '--ignore-unknown': ['ignoreUnknown', true,
768 'Exclude ticks of unknown code entries from processing'], 777 'Exclude ticks of unknown code entries from processing'],
769 '--separate-ic': ['separateIc', true, 778 '--separate-ic': ['separateIc', true,
770 'Separate IC entries'], 779 'Separate IC entries'],
771 '--unix': ['platform', 'unix', 780 '--unix': ['platform', 'unix',
772 'Specify that we are running on *nix platform'], 781 'Specify that we are running on *nix platform'],
773 '--windows': ['platform', 'windows', 782 '--windows': ['platform', 'windows',
774 'Specify that we are running on Windows platform'], 783 'Specify that we are running on Windows platform'],
775 '--mac': ['platform', 'mac', 784 '--mac': ['platform', 'mac',
776 'Specify that we are running on Mac OS X platform'], 785 'Specify that we are running on Mac OS X platform'],
777 '--nm': ['nm', 'nm', 786 '--nm': ['nm', 'nm',
778 'Specify the \'nm\' executable to use (e.g. --nm=/my_dir/nm)'], 787 'Specify the \'nm\' executable to use (e.g. --nm=/my_dir/nm)'],
779 '--snapshot-log': ['snapshotLogFileName', 'snapshot.log', 788 '--snapshot-log': ['snapshotLogFileName', 'snapshot.log',
780 'Specify snapshot log file to use (e.g. --snapshot-log=snapshot.log)'] 789 'Specify snapshot log file to use (e.g. --snapshot-log=snapshot.log)']
781 }; 790 };
782 this.argsDispatch_['--js'] = this.argsDispatch_['-j']; 791 this.argsDispatch_['--js'] = this.argsDispatch_['-j'];
783 this.argsDispatch_['--gc'] = this.argsDispatch_['-g']; 792 this.argsDispatch_['--gc'] = this.argsDispatch_['-g'];
784 this.argsDispatch_['--compiler'] = this.argsDispatch_['-c']; 793 this.argsDispatch_['--compiler'] = this.argsDispatch_['-c'];
785 this.argsDispatch_['--other'] = this.argsDispatch_['-o']; 794 this.argsDispatch_['--other'] = this.argsDispatch_['-o'];
786 this.argsDispatch_['--external'] = this.argsDispatch_['-e']; 795 this.argsDispatch_['--external'] = this.argsDispatch_['-e'];
787 }; 796 };
788 797
789 798
790 ArgumentsProcessor.DEFAULTS = { 799 ArgumentsProcessor.DEFAULTS = {
791 logFileName: 'v8.log', 800 logFileName: 'v8.log',
792 snapshotLogFileName: null, 801 snapshotLogFileName: null,
793 platform: 'unix', 802 platform: 'unix',
794 stateFilter: null, 803 stateFilter: null,
804 callGraphSize: 5,
795 ignoreUnknown: false, 805 ignoreUnknown: false,
796 separateIc: false, 806 separateIc: false,
797 nm: 'nm' 807 nm: 'nm'
798 }; 808 };
799 809
800 810
801 ArgumentsProcessor.prototype.parse = function() { 811 ArgumentsProcessor.prototype.parse = function() {
802 while (this.args_.length) { 812 while (this.args_.length) {
803 var arg = this.args_[0]; 813 var arg = this.args_[0];
804 if (arg.charAt(0) != '-') { 814 if (arg.charAt(0) != '-') {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 if (arg !== synArg && dispatch === this.argsDispatch_[synArg]) { 862 if (arg !== synArg && dispatch === this.argsDispatch_[synArg]) {
853 synonims.push(synArg); 863 synonims.push(synArg);
854 delete this.argsDispatch_[synArg]; 864 delete this.argsDispatch_[synArg];
855 } 865 }
856 } 866 }
857 print(' ' + padRight(synonims.join(', '), 20) + dispatch[2]); 867 print(' ' + padRight(synonims.join(', '), 20) + dispatch[2]);
858 } 868 }
859 quit(2); 869 quit(2);
860 }; 870 };
861 871
OLDNEW
« no previous file with comments | « no previous file | tools/tickprocessor-driver.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698