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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 timedRange, |
| 159 pairwiseTimedRange) { |
159 LogReader.call(this, { | 160 LogReader.call(this, { |
160 'shared-library': { parsers: [null, parseInt, parseInt], | 161 'shared-library': { parsers: [null, parseInt, parseInt], |
161 processor: this.processSharedLibrary }, | 162 processor: this.processSharedLibrary }, |
162 'code-creation': { | 163 'code-creation': { |
163 parsers: [null, parseInt, parseInt, parseInt, null, 'var-args'], | 164 parsers: [null, parseInt, parseInt, parseInt, null, 'var-args'], |
164 processor: this.processCodeCreation }, | 165 processor: this.processCodeCreation }, |
165 'code-move': { parsers: [parseInt, parseInt], | 166 'code-move': { parsers: [parseInt, parseInt], |
166 processor: this.processCodeMove }, | 167 processor: this.processCodeMove }, |
167 'code-delete': { parsers: [parseInt], | 168 'code-delete': { parsers: [parseInt], |
168 processor: this.processCodeDelete }, | 169 processor: this.processCodeDelete }, |
(...skipping 17 matching lines...) Expand all Loading... |
186 'profiler': null, | 187 'profiler': null, |
187 'function-creation': null, | 188 'function-creation': null, |
188 'function-move': null, | 189 'function-move': null, |
189 'function-delete': null, | 190 'function-delete': null, |
190 'heap-sample-item': null, | 191 'heap-sample-item': null, |
191 'current-time': null, // Handled specially, not parsed. | 192 'current-time': null, // Handled specially, not parsed. |
192 // Obsolete row types. | 193 // Obsolete row types. |
193 'code-allocate': null, | 194 'code-allocate': null, |
194 'begin-code-region': null, | 195 'begin-code-region': null, |
195 'end-code-region': null }, | 196 'end-code-region': null }, |
196 timedRange); | 197 timedRange, |
| 198 pairwiseTimedRange); |
197 | 199 |
198 this.cppEntriesProvider_ = cppEntriesProvider; | 200 this.cppEntriesProvider_ = cppEntriesProvider; |
199 this.callGraphSize_ = callGraphSize; | 201 this.callGraphSize_ = callGraphSize; |
200 this.ignoreUnknown_ = ignoreUnknown; | 202 this.ignoreUnknown_ = ignoreUnknown; |
201 this.stateFilter_ = stateFilter; | 203 this.stateFilter_ = stateFilter; |
202 this.snapshotLogProcessor_ = snapshotLogProcessor; | 204 this.snapshotLogProcessor_ = snapshotLogProcessor; |
203 this.sourceMap = sourceMap; | 205 this.sourceMap = sourceMap; |
204 this.deserializedEntriesNames_ = []; | 206 this.deserializedEntriesNames_ = []; |
205 var ticks = this.ticks_ = | 207 var ticks = this.ticks_ = |
206 { total: 0, unaccounted: 0, excluded: 0, gc: 0 }; | 208 { total: 0, unaccounted: 0, excluded: 0, gc: 0 }; |
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 'Specify the target root directory for cross environment'], | 875 'Specify the target root directory for cross environment'], |
874 '--snapshot-log': ['snapshotLogFileName', 'snapshot.log', | 876 '--snapshot-log': ['snapshotLogFileName', 'snapshot.log', |
875 'Specify snapshot log file to use (e.g. --snapshot-log=snapshot.log)'], | 877 'Specify snapshot log file to use (e.g. --snapshot-log=snapshot.log)'], |
876 '--range': ['range', 'auto,auto', | 878 '--range': ['range', 'auto,auto', |
877 'Specify the range limit as [start],[end]'], | 879 'Specify the range limit as [start],[end]'], |
878 '--distortion': ['distortion', 0, | 880 '--distortion': ['distortion', 0, |
879 'Specify the logging overhead in picoseconds'], | 881 'Specify the logging overhead in picoseconds'], |
880 '--source-map': ['sourceMap', null, | 882 '--source-map': ['sourceMap', null, |
881 'Specify the source map that should be used for output'], | 883 'Specify the source map that should be used for output'], |
882 '--timed-range': ['timedRange', true, | 884 '--timed-range': ['timedRange', true, |
883 'Ignore ticks before first and after last Date.now() call'] | 885 'Ignore ticks before first and after last Date.now() call'], |
| 886 '--pairwise-timed-range': ['pairwiseTimedRange', true, |
| 887 'Ignore ticks outside pairs of Date.now() calls'] |
884 }; | 888 }; |
885 this.argsDispatch_['--js'] = this.argsDispatch_['-j']; | 889 this.argsDispatch_['--js'] = this.argsDispatch_['-j']; |
886 this.argsDispatch_['--gc'] = this.argsDispatch_['-g']; | 890 this.argsDispatch_['--gc'] = this.argsDispatch_['-g']; |
887 this.argsDispatch_['--compiler'] = this.argsDispatch_['-c']; | 891 this.argsDispatch_['--compiler'] = this.argsDispatch_['-c']; |
888 this.argsDispatch_['--other'] = this.argsDispatch_['-o']; | 892 this.argsDispatch_['--other'] = this.argsDispatch_['-o']; |
889 this.argsDispatch_['--external'] = this.argsDispatch_['-e']; | 893 this.argsDispatch_['--external'] = this.argsDispatch_['-e']; |
| 894 this.argsDispatch_['--ptr'] = this.argsDispatch_['--pairwise-timed-range']; |
890 }; | 895 }; |
891 | 896 |
892 | 897 |
893 ArgumentsProcessor.DEFAULTS = { | 898 ArgumentsProcessor.DEFAULTS = { |
894 logFileName: 'v8.log', | 899 logFileName: 'v8.log', |
895 snapshotLogFileName: null, | 900 snapshotLogFileName: null, |
896 platform: 'unix', | 901 platform: 'unix', |
897 stateFilter: null, | 902 stateFilter: null, |
898 callGraphSize: 5, | 903 callGraphSize: 5, |
899 ignoreUnknown: false, | 904 ignoreUnknown: false, |
900 separateIc: false, | 905 separateIc: false, |
901 targetRootFS: '', | 906 targetRootFS: '', |
902 nm: 'nm', | 907 nm: 'nm', |
903 range: 'auto,auto', | 908 range: 'auto,auto', |
904 distortion: 0, | 909 distortion: 0, |
905 timedRange: false | 910 timedRange: false, |
| 911 pairwiseTimedRange: false |
906 }; | 912 }; |
907 | 913 |
908 | 914 |
909 ArgumentsProcessor.prototype.parse = function() { | 915 ArgumentsProcessor.prototype.parse = function() { |
910 while (this.args_.length) { | 916 while (this.args_.length) { |
911 var arg = this.args_[0]; | 917 var arg = this.args_.shift(); |
912 if (arg.charAt(0) != '-') { | 918 if (arg.charAt(0) != '-') { |
913 break; | 919 this.result_.logFileName = arg; |
| 920 continue; |
914 } | 921 } |
915 this.args_.shift(); | |
916 var userValue = null; | 922 var userValue = null; |
917 var eqPos = arg.indexOf('='); | 923 var eqPos = arg.indexOf('='); |
918 if (eqPos != -1) { | 924 if (eqPos != -1) { |
919 userValue = arg.substr(eqPos + 1); | 925 userValue = arg.substr(eqPos + 1); |
920 arg = arg.substr(0, eqPos); | 926 arg = arg.substr(0, eqPos); |
921 } | 927 } |
922 if (arg in this.argsDispatch_) { | 928 if (arg in this.argsDispatch_) { |
923 var dispatch = this.argsDispatch_[arg]; | 929 var dispatch = this.argsDispatch_[arg]; |
924 this.result_[dispatch[0]] = userValue == null ? dispatch[1] : userValue; | 930 this.result_[dispatch[0]] = userValue == null ? dispatch[1] : userValue; |
925 } else { | 931 } else { |
926 return false; | 932 return false; |
927 } | 933 } |
928 } | 934 } |
929 | |
930 if (this.args_.length >= 1) { | |
931 this.result_.logFileName = this.args_.shift(); | |
932 } | |
933 return true; | 935 return true; |
934 }; | 936 }; |
935 | 937 |
936 | 938 |
937 ArgumentsProcessor.prototype.result = function() { | 939 ArgumentsProcessor.prototype.result = function() { |
938 return this.result_; | 940 return this.result_; |
939 }; | 941 }; |
940 | 942 |
941 | 943 |
942 ArgumentsProcessor.prototype.printUsageAndExit = function() { | 944 ArgumentsProcessor.prototype.printUsageAndExit = function() { |
943 | 945 |
944 function padRight(s, len) { | 946 function padRight(s, len) { |
945 s = s.toString(); | 947 s = s.toString(); |
946 if (s.length < len) { | 948 if (s.length < len) { |
947 s = s + (new Array(len - s.length + 1).join(' ')); | 949 s = s + (new Array(len - s.length + 1).join(' ')); |
948 } | 950 } |
949 return s; | 951 return s; |
950 } | 952 } |
951 | 953 |
952 print('Cmdline args: [options] [log-file-name]\n' + | 954 print('Cmdline args: [options] [log-file-name]\n' + |
953 'Default log file name is "' + | 955 'Default log file name is "' + |
954 ArgumentsProcessor.DEFAULTS.logFileName + '".\n'); | 956 ArgumentsProcessor.DEFAULTS.logFileName + '".\n'); |
955 print('Options:'); | 957 print('Options:'); |
956 for (var arg in this.argsDispatch_) { | 958 for (var arg in this.argsDispatch_) { |
957 var synonims = [arg]; | 959 var synonyms = [arg]; |
958 var dispatch = this.argsDispatch_[arg]; | 960 var dispatch = this.argsDispatch_[arg]; |
959 for (var synArg in this.argsDispatch_) { | 961 for (var synArg in this.argsDispatch_) { |
960 if (arg !== synArg && dispatch === this.argsDispatch_[synArg]) { | 962 if (arg !== synArg && dispatch === this.argsDispatch_[synArg]) { |
961 synonims.push(synArg); | 963 synonyms.push(synArg); |
962 delete this.argsDispatch_[synArg]; | 964 delete this.argsDispatch_[synArg]; |
963 } | 965 } |
964 } | 966 } |
965 print(' ' + padRight(synonims.join(', '), 20) + dispatch[2]); | 967 print(' ' + padRight(synonyms.join(', '), 20) + " " + dispatch[2]); |
966 } | 968 } |
967 quit(2); | 969 quit(2); |
968 }; | 970 }; |
OLD | NEW |