OLD | NEW |
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 136 matching lines...) Loading... |
147 | 147 |
148 function TickProcessor( | 148 function TickProcessor( |
149 cppEntriesProvider, | 149 cppEntriesProvider, |
150 separateIc, | 150 separateIc, |
151 callGraphSize, | 151 callGraphSize, |
152 ignoreUnknown, | 152 ignoreUnknown, |
153 stateFilter, | 153 stateFilter, |
154 snapshotLogProcessor, | 154 snapshotLogProcessor, |
155 distortion, | 155 distortion, |
156 range, | 156 range, |
157 sourceMap) { | 157 sourceMap, |
| 158 timedRange) { |
158 LogReader.call(this, { | 159 LogReader.call(this, { |
159 'shared-library': { parsers: [null, parseInt, parseInt], | 160 'shared-library': { parsers: [null, parseInt, parseInt], |
160 processor: this.processSharedLibrary }, | 161 processor: this.processSharedLibrary }, |
161 'code-creation': { | 162 'code-creation': { |
162 parsers: [null, parseInt, parseInt, parseInt, null, 'var-args'], | 163 parsers: [null, parseInt, parseInt, parseInt, null, 'var-args'], |
163 processor: this.processCodeCreation }, | 164 processor: this.processCodeCreation }, |
164 'code-move': { parsers: [parseInt, parseInt], | 165 'code-move': { parsers: [parseInt, parseInt], |
165 processor: this.processCodeMove }, | 166 processor: this.processCodeMove }, |
166 'code-delete': { parsers: [parseInt], | 167 'code-delete': { parsers: [parseInt], |
167 processor: this.processCodeDelete }, | 168 processor: this.processCodeDelete }, |
(...skipping 12 matching lines...) Loading... |
180 'timer-event-start' : { parsers: [null, null, null], | 181 'timer-event-start' : { parsers: [null, null, null], |
181 processor: this.advanceDistortion }, | 182 processor: this.advanceDistortion }, |
182 'timer-event-end' : { parsers: [null, null, null], | 183 'timer-event-end' : { parsers: [null, null, null], |
183 processor: this.advanceDistortion }, | 184 processor: this.advanceDistortion }, |
184 // Ignored events. | 185 // Ignored events. |
185 'profiler': null, | 186 'profiler': null, |
186 'function-creation': null, | 187 'function-creation': null, |
187 'function-move': null, | 188 'function-move': null, |
188 'function-delete': null, | 189 'function-delete': null, |
189 'heap-sample-item': null, | 190 'heap-sample-item': null, |
| 191 'current-time': null, // Handled specially, not parsed. |
190 // Obsolete row types. | 192 // Obsolete row types. |
191 'code-allocate': null, | 193 'code-allocate': null, |
192 'begin-code-region': null, | 194 'begin-code-region': null, |
193 'end-code-region': null }); | 195 'end-code-region': null }, |
| 196 timedRange); |
194 | 197 |
195 this.cppEntriesProvider_ = cppEntriesProvider; | 198 this.cppEntriesProvider_ = cppEntriesProvider; |
196 this.callGraphSize_ = callGraphSize; | 199 this.callGraphSize_ = callGraphSize; |
197 this.ignoreUnknown_ = ignoreUnknown; | 200 this.ignoreUnknown_ = ignoreUnknown; |
198 this.stateFilter_ = stateFilter; | 201 this.stateFilter_ = stateFilter; |
199 this.snapshotLogProcessor_ = snapshotLogProcessor; | 202 this.snapshotLogProcessor_ = snapshotLogProcessor; |
200 this.sourceMap = sourceMap; | 203 this.sourceMap = sourceMap; |
201 this.deserializedEntriesNames_ = []; | 204 this.deserializedEntriesNames_ = []; |
202 var ticks = this.ticks_ = | 205 var ticks = this.ticks_ = |
203 { total: 0, unaccounted: 0, excluded: 0, gc: 0 }; | 206 { total: 0, unaccounted: 0, excluded: 0, gc: 0 }; |
(...skipping 81 matching lines...) Loading... |
285 return this.codeTypes_[name] == TickProcessor.CodeTypes.SHARED_LIB; | 288 return this.codeTypes_[name] == TickProcessor.CodeTypes.SHARED_LIB; |
286 }; | 289 }; |
287 | 290 |
288 | 291 |
289 TickProcessor.prototype.isCppCode = function(name) { | 292 TickProcessor.prototype.isCppCode = function(name) { |
290 return this.codeTypes_[name] == TickProcessor.CodeTypes.CPP; | 293 return this.codeTypes_[name] == TickProcessor.CodeTypes.CPP; |
291 }; | 294 }; |
292 | 295 |
293 | 296 |
294 TickProcessor.prototype.isJsCode = function(name) { | 297 TickProcessor.prototype.isJsCode = function(name) { |
295 return !(name in this.codeTypes_); | 298 return name !== "UNKNOWN" && !(name in this.codeTypes_); |
296 }; | 299 }; |
297 | 300 |
298 | 301 |
299 TickProcessor.prototype.processLogFile = function(fileName) { | 302 TickProcessor.prototype.processLogFile = function(fileName) { |
300 this.lastLogFileName_ = fileName; | 303 this.lastLogFileName_ = fileName; |
301 var line; | 304 var line; |
302 while (line = readline()) { | 305 while (line = readline()) { |
303 this.processLogLine(line); | 306 this.processLogLine(line); |
304 } | 307 } |
305 }; | 308 }; |
(...skipping 562 matching lines...) Loading... |
868 'Specify the \'nm\' executable to use (e.g. --nm=/my_dir/nm)'], | 871 'Specify the \'nm\' executable to use (e.g. --nm=/my_dir/nm)'], |
869 '--target': ['targetRootFS', '', | 872 '--target': ['targetRootFS', '', |
870 'Specify the target root directory for cross environment'], | 873 'Specify the target root directory for cross environment'], |
871 '--snapshot-log': ['snapshotLogFileName', 'snapshot.log', | 874 '--snapshot-log': ['snapshotLogFileName', 'snapshot.log', |
872 'Specify snapshot log file to use (e.g. --snapshot-log=snapshot.log)'], | 875 'Specify snapshot log file to use (e.g. --snapshot-log=snapshot.log)'], |
873 '--range': ['range', 'auto,auto', | 876 '--range': ['range', 'auto,auto', |
874 'Specify the range limit as [start],[end]'], | 877 'Specify the range limit as [start],[end]'], |
875 '--distortion': ['distortion', 0, | 878 '--distortion': ['distortion', 0, |
876 'Specify the logging overhead in picoseconds'], | 879 'Specify the logging overhead in picoseconds'], |
877 '--source-map': ['sourceMap', null, | 880 '--source-map': ['sourceMap', null, |
878 'Specify the source map that should be used for output'] | 881 'Specify the source map that should be used for output'], |
| 882 '--timed-range': ['timedRange', true, |
| 883 'Ignore ticks before first and after last Date.now() call'] |
879 }; | 884 }; |
880 this.argsDispatch_['--js'] = this.argsDispatch_['-j']; | 885 this.argsDispatch_['--js'] = this.argsDispatch_['-j']; |
881 this.argsDispatch_['--gc'] = this.argsDispatch_['-g']; | 886 this.argsDispatch_['--gc'] = this.argsDispatch_['-g']; |
882 this.argsDispatch_['--compiler'] = this.argsDispatch_['-c']; | 887 this.argsDispatch_['--compiler'] = this.argsDispatch_['-c']; |
883 this.argsDispatch_['--other'] = this.argsDispatch_['-o']; | 888 this.argsDispatch_['--other'] = this.argsDispatch_['-o']; |
884 this.argsDispatch_['--external'] = this.argsDispatch_['-e']; | 889 this.argsDispatch_['--external'] = this.argsDispatch_['-e']; |
885 }; | 890 }; |
886 | 891 |
887 | 892 |
888 ArgumentsProcessor.DEFAULTS = { | 893 ArgumentsProcessor.DEFAULTS = { |
889 logFileName: 'v8.log', | 894 logFileName: 'v8.log', |
890 snapshotLogFileName: null, | 895 snapshotLogFileName: null, |
891 platform: 'unix', | 896 platform: 'unix', |
892 stateFilter: null, | 897 stateFilter: null, |
893 callGraphSize: 5, | 898 callGraphSize: 5, |
894 ignoreUnknown: false, | 899 ignoreUnknown: false, |
895 separateIc: false, | 900 separateIc: false, |
896 targetRootFS: '', | 901 targetRootFS: '', |
897 nm: 'nm', | 902 nm: 'nm', |
898 range: 'auto,auto', | 903 range: 'auto,auto', |
899 distortion: 0 | 904 distortion: 0, |
| 905 timedRange: false |
900 }; | 906 }; |
901 | 907 |
902 | 908 |
903 ArgumentsProcessor.prototype.parse = function() { | 909 ArgumentsProcessor.prototype.parse = function() { |
904 while (this.args_.length) { | 910 while (this.args_.length) { |
905 var arg = this.args_[0]; | 911 var arg = this.args_[0]; |
906 if (arg.charAt(0) != '-') { | 912 if (arg.charAt(0) != '-') { |
907 break; | 913 break; |
908 } | 914 } |
909 this.args_.shift(); | 915 this.args_.shift(); |
(...skipping 43 matching lines...) Loading... |
953 for (var synArg in this.argsDispatch_) { | 959 for (var synArg in this.argsDispatch_) { |
954 if (arg !== synArg && dispatch === this.argsDispatch_[synArg]) { | 960 if (arg !== synArg && dispatch === this.argsDispatch_[synArg]) { |
955 synonims.push(synArg); | 961 synonims.push(synArg); |
956 delete this.argsDispatch_[synArg]; | 962 delete this.argsDispatch_[synArg]; |
957 } | 963 } |
958 } | 964 } |
959 print(' ' + padRight(synonims.join(', '), 20) + dispatch[2]); | 965 print(' ' + padRight(synonims.join(', '), 20) + dispatch[2]); |
960 } | 966 } |
961 quit(2); | 967 quit(2); |
962 }; | 968 }; |
OLD | NEW |