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

Side by Side Diff: tools/tickprocessor.js

Issue 1796863002: Remove snapshot log parsing and option from tools. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 function parseState(s) { 63 function parseState(s) {
64 switch (s) { 64 switch (s) {
65 case "": return Profile.CodeState.COMPILED; 65 case "": return Profile.CodeState.COMPILED;
66 case "~": return Profile.CodeState.OPTIMIZABLE; 66 case "~": return Profile.CodeState.OPTIMIZABLE;
67 case "*": return Profile.CodeState.OPTIMIZED; 67 case "*": return Profile.CodeState.OPTIMIZED;
68 } 68 }
69 throw new Error("unknown code state: " + s); 69 throw new Error("unknown code state: " + s);
70 } 70 }
71 71
72 72
73 function SnapshotLogProcessor() {
74 LogReader.call(this, {
75 'code-creation': {
76 parsers: [null, parseInt, parseInt, parseInt, null, 'var-args'],
77 processor: this.processCodeCreation },
78 'code-move': { parsers: [parseInt, parseInt],
79 processor: this.processCodeMove },
80 'code-delete': { parsers: [parseInt],
81 processor: this.processCodeDelete },
82 'function-creation': null,
83 'function-move': null,
84 'function-delete': null,
85 'sfi-move': null,
86 'snapshot-pos': { parsers: [parseInt, parseInt],
87 processor: this.processSnapshotPosition }});
88
89 V8Profile.prototype.handleUnknownCode = function(operation, addr) {
90 var op = Profile.Operation;
91 switch (operation) {
92 case op.MOVE:
93 print('Snapshot: Code move event for unknown code: 0x' +
94 addr.toString(16));
95 break;
96 case op.DELETE:
97 print('Snapshot: Code delete event for unknown code: 0x' +
98 addr.toString(16));
99 break;
100 }
101 };
102
103 this.profile_ = new V8Profile();
104 this.serializedEntries_ = [];
105 }
106 inherits(SnapshotLogProcessor, LogReader);
107
108
109 SnapshotLogProcessor.prototype.processCodeCreation = function(
110 type, kind, start, size, name, maybe_func) {
111 if (maybe_func.length) {
112 var funcAddr = parseInt(maybe_func[0]);
113 var state = parseState(maybe_func[1]);
114 this.profile_.addFuncCode(type, name, start, size, funcAddr, state);
115 } else {
116 this.profile_.addCode(type, name, start, size);
117 }
118 };
119
120
121 SnapshotLogProcessor.prototype.processCodeMove = function(from, to) {
122 this.profile_.moveCode(from, to);
123 };
124
125
126 SnapshotLogProcessor.prototype.processCodeDelete = function(start) {
127 this.profile_.deleteCode(start);
128 };
129
130
131 SnapshotLogProcessor.prototype.processSnapshotPosition = function(addr, pos) {
132 this.serializedEntries_[pos] = this.profile_.findEntry(addr);
133 };
134
135
136 SnapshotLogProcessor.prototype.processLogFile = function(fileName) {
137 var contents = readFile(fileName);
138 this.processLogChunk(contents);
139 };
140
141
142 SnapshotLogProcessor.prototype.getSerializedEntryName = function(pos) {
143 var entry = this.serializedEntries_[pos];
144 return entry ? entry.getRawName() : null;
145 };
146
147
148 function TickProcessor( 73 function TickProcessor(
149 cppEntriesProvider, 74 cppEntriesProvider,
150 separateIc, 75 separateIc,
151 callGraphSize, 76 callGraphSize,
152 ignoreUnknown, 77 ignoreUnknown,
153 stateFilter, 78 stateFilter,
154 snapshotLogProcessor,
155 distortion, 79 distortion,
156 range, 80 range,
157 sourceMap, 81 sourceMap,
158 timedRange, 82 timedRange,
159 pairwiseTimedRange, 83 pairwiseTimedRange,
160 onlySummary) { 84 onlySummary) {
161 LogReader.call(this, { 85 LogReader.call(this, {
162 'shared-library': { parsers: [null, parseInt, parseInt], 86 'shared-library': { parsers: [null, parseInt, parseInt],
163 processor: this.processSharedLibrary }, 87 processor: this.processSharedLibrary },
164 'code-creation': { 88 'code-creation': {
165 parsers: [null, parseInt, parseInt, parseInt, null, 'var-args'], 89 parsers: [null, parseInt, parseInt, parseInt, null, 'var-args'],
166 processor: this.processCodeCreation }, 90 processor: this.processCodeCreation },
167 'code-move': { parsers: [parseInt, parseInt], 91 'code-move': { parsers: [parseInt, parseInt],
168 processor: this.processCodeMove }, 92 processor: this.processCodeMove },
169 'code-delete': { parsers: [parseInt], 93 'code-delete': { parsers: [parseInt],
170 processor: this.processCodeDelete }, 94 processor: this.processCodeDelete },
171 'sfi-move': { parsers: [parseInt, parseInt], 95 'sfi-move': { parsers: [parseInt, parseInt],
172 processor: this.processFunctionMove }, 96 processor: this.processFunctionMove },
173 'snapshot-pos': { parsers: [parseInt, parseInt],
174 processor: this.processSnapshotPosition },
175 'tick': { 97 'tick': {
176 parsers: [parseInt, parseInt, parseInt, 98 parsers: [parseInt, parseInt, parseInt,
177 parseInt, parseInt, 'var-args'], 99 parseInt, parseInt, 'var-args'],
178 processor: this.processTick }, 100 processor: this.processTick },
179 'heap-sample-begin': { parsers: [null, null, parseInt], 101 'heap-sample-begin': { parsers: [null, null, parseInt],
180 processor: this.processHeapSampleBegin }, 102 processor: this.processHeapSampleBegin },
181 'heap-sample-end': { parsers: [null, null], 103 'heap-sample-end': { parsers: [null, null],
182 processor: this.processHeapSampleEnd }, 104 processor: this.processHeapSampleEnd },
183 'timer-event-start' : { parsers: [null, null, null], 105 'timer-event-start' : { parsers: [null, null, null],
184 processor: this.advanceDistortion }, 106 processor: this.advanceDistortion },
(...skipping 10 matching lines...) Expand all
195 'code-allocate': null, 117 'code-allocate': null,
196 'begin-code-region': null, 118 'begin-code-region': null,
197 'end-code-region': null }, 119 'end-code-region': null },
198 timedRange, 120 timedRange,
199 pairwiseTimedRange); 121 pairwiseTimedRange);
200 122
201 this.cppEntriesProvider_ = cppEntriesProvider; 123 this.cppEntriesProvider_ = cppEntriesProvider;
202 this.callGraphSize_ = callGraphSize; 124 this.callGraphSize_ = callGraphSize;
203 this.ignoreUnknown_ = ignoreUnknown; 125 this.ignoreUnknown_ = ignoreUnknown;
204 this.stateFilter_ = stateFilter; 126 this.stateFilter_ = stateFilter;
205 this.snapshotLogProcessor_ = snapshotLogProcessor;
206 this.sourceMap = sourceMap; 127 this.sourceMap = sourceMap;
207 this.deserializedEntriesNames_ = []; 128 this.deserializedEntriesNames_ = [];
208 var ticks = this.ticks_ = 129 var ticks = this.ticks_ =
209 { total: 0, unaccounted: 0, excluded: 0, gc: 0 }; 130 { total: 0, unaccounted: 0, excluded: 0, gc: 0 };
210 131
211 distortion = parseInt(distortion); 132 distortion = parseInt(distortion);
212 // Convert picoseconds to nanoseconds. 133 // Convert picoseconds to nanoseconds.
213 this.distortion_per_entry = isNaN(distortion) ? 0 : (distortion / 1000); 134 this.distortion_per_entry = isNaN(distortion) ? 0 : (distortion / 1000);
214 this.distortion = 0; 135 this.distortion = 0;
215 var rangelimits = range ? range.split(",") : []; 136 var rangelimits = range ? range.split(",") : [];
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 TickProcessor.prototype.processCodeDelete = function(start) { 276 TickProcessor.prototype.processCodeDelete = function(start) {
356 this.profile_.deleteCode(start); 277 this.profile_.deleteCode(start);
357 }; 278 };
358 279
359 280
360 TickProcessor.prototype.processFunctionMove = function(from, to) { 281 TickProcessor.prototype.processFunctionMove = function(from, to) {
361 this.profile_.moveFunc(from, to); 282 this.profile_.moveFunc(from, to);
362 }; 283 };
363 284
364 285
365 TickProcessor.prototype.processSnapshotPosition = function(addr, pos) {
366 if (this.snapshotLogProcessor_) {
367 this.deserializedEntriesNames_[addr] =
368 this.snapshotLogProcessor_.getSerializedEntryName(pos);
369 }
370 };
371
372
373 TickProcessor.prototype.includeTick = function(vmState) { 286 TickProcessor.prototype.includeTick = function(vmState) {
374 return this.stateFilter_ == null || this.stateFilter_ == vmState; 287 return this.stateFilter_ == null || this.stateFilter_ == vmState;
375 }; 288 };
376 289
377 TickProcessor.prototype.processTick = function(pc, 290 TickProcessor.prototype.processTick = function(pc,
378 ns_since_start, 291 ns_since_start,
379 is_external_callback, 292 is_external_callback,
380 tos_or_external_callback, 293 tos_or_external_callback,
381 vmState, 294 vmState,
382 stack) { 295 stack) {
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 '--unix': ['platform', 'unix', 786 '--unix': ['platform', 'unix',
874 'Specify that we are running on *nix platform'], 787 'Specify that we are running on *nix platform'],
875 '--windows': ['platform', 'windows', 788 '--windows': ['platform', 'windows',
876 'Specify that we are running on Windows platform'], 789 'Specify that we are running on Windows platform'],
877 '--mac': ['platform', 'mac', 790 '--mac': ['platform', 'mac',
878 'Specify that we are running on Mac OS X platform'], 791 'Specify that we are running on Mac OS X platform'],
879 '--nm': ['nm', 'nm', 792 '--nm': ['nm', 'nm',
880 'Specify the \'nm\' executable to use (e.g. --nm=/my_dir/nm)'], 793 'Specify the \'nm\' executable to use (e.g. --nm=/my_dir/nm)'],
881 '--target': ['targetRootFS', '', 794 '--target': ['targetRootFS', '',
882 'Specify the target root directory for cross environment'], 795 'Specify the target root directory for cross environment'],
883 '--snapshot-log': ['snapshotLogFileName', 'snapshot.log',
884 'Specify snapshot log file to use (e.g. --snapshot-log=snapshot.log)'],
885 '--range': ['range', 'auto,auto', 796 '--range': ['range', 'auto,auto',
886 'Specify the range limit as [start],[end]'], 797 'Specify the range limit as [start],[end]'],
887 '--distortion': ['distortion', 0, 798 '--distortion': ['distortion', 0,
888 'Specify the logging overhead in picoseconds'], 799 'Specify the logging overhead in picoseconds'],
889 '--source-map': ['sourceMap', null, 800 '--source-map': ['sourceMap', null,
890 'Specify the source map that should be used for output'], 801 'Specify the source map that should be used for output'],
891 '--timed-range': ['timedRange', true, 802 '--timed-range': ['timedRange', true,
892 'Ignore ticks before first and after last Date.now() call'], 803 'Ignore ticks before first and after last Date.now() call'],
893 '--pairwise-timed-range': ['pairwiseTimedRange', true, 804 '--pairwise-timed-range': ['pairwiseTimedRange', true,
894 'Ignore ticks outside pairs of Date.now() calls'], 805 'Ignore ticks outside pairs of Date.now() calls'],
895 '--only-summary': ['onlySummary', true, 806 '--only-summary': ['onlySummary', true,
896 'Print only tick summary, exclude other information'] 807 'Print only tick summary, exclude other information']
897 }; 808 };
898 this.argsDispatch_['--js'] = this.argsDispatch_['-j']; 809 this.argsDispatch_['--js'] = this.argsDispatch_['-j'];
899 this.argsDispatch_['--gc'] = this.argsDispatch_['-g']; 810 this.argsDispatch_['--gc'] = this.argsDispatch_['-g'];
900 this.argsDispatch_['--compiler'] = this.argsDispatch_['-c']; 811 this.argsDispatch_['--compiler'] = this.argsDispatch_['-c'];
901 this.argsDispatch_['--other'] = this.argsDispatch_['-o']; 812 this.argsDispatch_['--other'] = this.argsDispatch_['-o'];
902 this.argsDispatch_['--external'] = this.argsDispatch_['-e']; 813 this.argsDispatch_['--external'] = this.argsDispatch_['-e'];
903 this.argsDispatch_['--ptr'] = this.argsDispatch_['--pairwise-timed-range']; 814 this.argsDispatch_['--ptr'] = this.argsDispatch_['--pairwise-timed-range'];
904 }; 815 };
905 816
906 817
907 ArgumentsProcessor.DEFAULTS = { 818 ArgumentsProcessor.DEFAULTS = {
908 logFileName: 'v8.log', 819 logFileName: 'v8.log',
909 snapshotLogFileName: null,
910 platform: 'unix', 820 platform: 'unix',
911 stateFilter: null, 821 stateFilter: null,
912 callGraphSize: 5, 822 callGraphSize: 5,
913 ignoreUnknown: false, 823 ignoreUnknown: false,
914 separateIc: false, 824 separateIc: false,
915 targetRootFS: '', 825 targetRootFS: '',
916 nm: 'nm', 826 nm: 'nm',
917 range: 'auto,auto', 827 range: 'auto,auto',
918 distortion: 0, 828 distortion: 0,
919 timedRange: false, 829 timedRange: false,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 for (var synArg in this.argsDispatch_) { 881 for (var synArg in this.argsDispatch_) {
972 if (arg !== synArg && dispatch === this.argsDispatch_[synArg]) { 882 if (arg !== synArg && dispatch === this.argsDispatch_[synArg]) {
973 synonyms.push(synArg); 883 synonyms.push(synArg);
974 delete this.argsDispatch_[synArg]; 884 delete this.argsDispatch_[synArg];
975 } 885 }
976 } 886 }
977 print(' ' + padRight(synonyms.join(', '), 20) + " " + dispatch[2]); 887 print(' ' + padRight(synonyms.join(', '), 20) + " " + dispatch[2]);
978 } 888 }
979 quit(2); 889 quit(2);
980 }; 890 };
OLDNEW
« tools/ll_prof.py ('K') | « tools/tick-processor.html ('k') | tools/tickprocessor-driver.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698