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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 cppEntriesProvider, | 74 cppEntriesProvider, |
75 separateIc, | 75 separateIc, |
76 callGraphSize, | 76 callGraphSize, |
77 ignoreUnknown, | 77 ignoreUnknown, |
78 stateFilter, | 78 stateFilter, |
79 distortion, | 79 distortion, |
80 range, | 80 range, |
81 sourceMap, | 81 sourceMap, |
82 timedRange, | 82 timedRange, |
83 pairwiseTimedRange, | 83 pairwiseTimedRange, |
84 onlySummary) { | 84 onlySummary, |
| 85 runtimeTimerFilter) { |
85 LogReader.call(this, { | 86 LogReader.call(this, { |
86 'shared-library': { parsers: [null, parseInt, parseInt, parseInt], | 87 'shared-library': { parsers: [null, parseInt, parseInt, parseInt], |
87 processor: this.processSharedLibrary }, | 88 processor: this.processSharedLibrary }, |
88 'code-creation': { | 89 'code-creation': { |
89 parsers: [null, parseInt, parseInt, parseInt, null, 'var-args'], | 90 parsers: [null, parseInt, parseInt, parseInt, null, 'var-args'], |
90 processor: this.processCodeCreation }, | 91 processor: this.processCodeCreation }, |
91 'code-move': { parsers: [parseInt, parseInt], | 92 'code-move': { parsers: [parseInt, parseInt], |
92 processor: this.processCodeMove }, | 93 processor: this.processCodeMove }, |
93 'code-delete': { parsers: [parseInt], | 94 'code-delete': { parsers: [parseInt], |
94 processor: this.processCodeDelete }, | 95 processor: this.processCodeDelete }, |
95 'sfi-move': { parsers: [parseInt, parseInt], | 96 'sfi-move': { parsers: [parseInt, parseInt], |
96 processor: this.processFunctionMove }, | 97 processor: this.processFunctionMove }, |
| 98 'active-runtime-timer': { |
| 99 parsers: [null], |
| 100 processor: this.processRuntimeTimerEvent }, |
97 'tick': { | 101 'tick': { |
98 parsers: [parseInt, parseInt, parseInt, | 102 parsers: [parseInt, parseInt, parseInt, |
99 parseInt, parseInt, 'var-args'], | 103 parseInt, parseInt, 'var-args'], |
100 processor: this.processTick }, | 104 processor: this.processTick }, |
101 'heap-sample-begin': { parsers: [null, null, parseInt], | 105 'heap-sample-begin': { parsers: [null, null, parseInt], |
102 processor: this.processHeapSampleBegin }, | 106 processor: this.processHeapSampleBegin }, |
103 'heap-sample-end': { parsers: [null, null], | 107 'heap-sample-end': { parsers: [null, null], |
104 processor: this.processHeapSampleEnd }, | 108 processor: this.processHeapSampleEnd }, |
105 'timer-event-start' : { parsers: [null, null, null], | 109 'timer-event-start' : { parsers: [null, null, null], |
106 processor: this.advanceDistortion }, | 110 processor: this.advanceDistortion }, |
(...skipping 10 matching lines...) Expand all Loading... |
117 'code-allocate': null, | 121 'code-allocate': null, |
118 'begin-code-region': null, | 122 'begin-code-region': null, |
119 'end-code-region': null }, | 123 'end-code-region': null }, |
120 timedRange, | 124 timedRange, |
121 pairwiseTimedRange); | 125 pairwiseTimedRange); |
122 | 126 |
123 this.cppEntriesProvider_ = cppEntriesProvider; | 127 this.cppEntriesProvider_ = cppEntriesProvider; |
124 this.callGraphSize_ = callGraphSize; | 128 this.callGraphSize_ = callGraphSize; |
125 this.ignoreUnknown_ = ignoreUnknown; | 129 this.ignoreUnknown_ = ignoreUnknown; |
126 this.stateFilter_ = stateFilter; | 130 this.stateFilter_ = stateFilter; |
| 131 this.runtimeTimerFilter_ = runtimeTimerFilter; |
127 this.sourceMap = sourceMap; | 132 this.sourceMap = sourceMap; |
128 this.deserializedEntriesNames_ = []; | 133 this.deserializedEntriesNames_ = []; |
129 var ticks = this.ticks_ = | 134 var ticks = this.ticks_ = |
130 { total: 0, unaccounted: 0, excluded: 0, gc: 0 }; | 135 { total: 0, unaccounted: 0, excluded: 0, gc: 0 }; |
131 | 136 |
132 distortion = parseInt(distortion); | 137 distortion = parseInt(distortion); |
133 // Convert picoseconds to nanoseconds. | 138 // Convert picoseconds to nanoseconds. |
134 this.distortion_per_entry = isNaN(distortion) ? 0 : (distortion / 1000); | 139 this.distortion_per_entry = isNaN(distortion) ? 0 : (distortion / 1000); |
135 this.distortion = 0; | 140 this.distortion = 0; |
136 var rangelimits = range ? range.split(",") : []; | 141 var rangelimits = range ? range.split(",") : []; |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 this.profile_.deleteCode(start); | 282 this.profile_.deleteCode(start); |
278 }; | 283 }; |
279 | 284 |
280 | 285 |
281 TickProcessor.prototype.processFunctionMove = function(from, to) { | 286 TickProcessor.prototype.processFunctionMove = function(from, to) { |
282 this.profile_.moveFunc(from, to); | 287 this.profile_.moveFunc(from, to); |
283 }; | 288 }; |
284 | 289 |
285 | 290 |
286 TickProcessor.prototype.includeTick = function(vmState) { | 291 TickProcessor.prototype.includeTick = function(vmState) { |
287 return this.stateFilter_ == null || this.stateFilter_ == vmState; | 292 if (this.stateFilter_ !== null) { |
| 293 return this.stateFilter_ == vmState; |
| 294 } else if (this.runtimeTimerFilter_ !== null) { |
| 295 return this.currentRuntimeTimer == this.runtimeTimerFilter_; |
| 296 } |
| 297 return true; |
288 }; | 298 }; |
289 | 299 |
| 300 TickProcessor.prototype.processRuntimeTimerEvent = function(name) { |
| 301 this.currentRuntimeTimer = name; |
| 302 } |
| 303 |
290 TickProcessor.prototype.processTick = function(pc, | 304 TickProcessor.prototype.processTick = function(pc, |
291 ns_since_start, | 305 ns_since_start, |
292 is_external_callback, | 306 is_external_callback, |
293 tos_or_external_callback, | 307 tos_or_external_callback, |
294 vmState, | 308 vmState, |
295 stack) { | 309 stack) { |
296 this.distortion += this.distortion_per_entry; | 310 this.distortion += this.distortion_per_entry; |
297 ns_since_start -= this.distortion; | 311 ns_since_start -= this.distortion; |
298 if (ns_since_start < this.range_start || ns_since_start > this.range_end) { | 312 if (ns_since_start < this.range_start || ns_since_start > this.range_end) { |
299 return; | 313 return; |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 '-j': ['stateFilter', TickProcessor.VmStates.JS, | 788 '-j': ['stateFilter', TickProcessor.VmStates.JS, |
775 'Show only ticks from JS VM state'], | 789 'Show only ticks from JS VM state'], |
776 '-g': ['stateFilter', TickProcessor.VmStates.GC, | 790 '-g': ['stateFilter', TickProcessor.VmStates.GC, |
777 'Show only ticks from GC VM state'], | 791 'Show only ticks from GC VM state'], |
778 '-c': ['stateFilter', TickProcessor.VmStates.COMPILER, | 792 '-c': ['stateFilter', TickProcessor.VmStates.COMPILER, |
779 'Show only ticks from COMPILER VM state'], | 793 'Show only ticks from COMPILER VM state'], |
780 '-o': ['stateFilter', TickProcessor.VmStates.OTHER, | 794 '-o': ['stateFilter', TickProcessor.VmStates.OTHER, |
781 'Show only ticks from OTHER VM state'], | 795 'Show only ticks from OTHER VM state'], |
782 '-e': ['stateFilter', TickProcessor.VmStates.EXTERNAL, | 796 '-e': ['stateFilter', TickProcessor.VmStates.EXTERNAL, |
783 'Show only ticks from EXTERNAL VM state'], | 797 'Show only ticks from EXTERNAL VM state'], |
| 798 '--filter-runtime-timer': ['runtimeTimerFilter', null, |
| 799 'Show only ticks matching the given runtime timer scope'], |
784 '--call-graph-size': ['callGraphSize', TickProcessor.CALL_GRAPH_SIZE, | 800 '--call-graph-size': ['callGraphSize', TickProcessor.CALL_GRAPH_SIZE, |
785 'Set the call graph size'], | 801 'Set the call graph size'], |
786 '--ignore-unknown': ['ignoreUnknown', true, | 802 '--ignore-unknown': ['ignoreUnknown', true, |
787 'Exclude ticks of unknown code entries from processing'], | 803 'Exclude ticks of unknown code entries from processing'], |
788 '--separate-ic': ['separateIc', true, | 804 '--separate-ic': ['separateIc', true, |
789 'Separate IC entries'], | 805 'Separate IC entries'], |
790 '--unix': ['platform', 'unix', | 806 '--unix': ['platform', 'unix', |
791 'Specify that we are running on *nix platform'], | 807 'Specify that we are running on *nix platform'], |
792 '--windows': ['platform', 'windows', | 808 '--windows': ['platform', 'windows', |
793 'Specify that we are running on Windows platform'], | 809 'Specify that we are running on Windows platform'], |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 stateFilter: null, | 841 stateFilter: null, |
826 callGraphSize: 5, | 842 callGraphSize: 5, |
827 ignoreUnknown: false, | 843 ignoreUnknown: false, |
828 separateIc: false, | 844 separateIc: false, |
829 targetRootFS: '', | 845 targetRootFS: '', |
830 nm: 'nm', | 846 nm: 'nm', |
831 range: 'auto,auto', | 847 range: 'auto,auto', |
832 distortion: 0, | 848 distortion: 0, |
833 timedRange: false, | 849 timedRange: false, |
834 pairwiseTimedRange: false, | 850 pairwiseTimedRange: false, |
835 onlySummary: false | 851 onlySummary: false, |
| 852 runtimeTimerFilter: null, |
836 }; | 853 }; |
837 | 854 |
838 | 855 |
839 ArgumentsProcessor.prototype.parse = function() { | 856 ArgumentsProcessor.prototype.parse = function() { |
840 while (this.args_.length) { | 857 while (this.args_.length) { |
841 var arg = this.args_.shift(); | 858 var arg = this.args_.shift(); |
842 if (arg.charAt(0) != '-') { | 859 if (arg.charAt(0) != '-') { |
843 this.result_.logFileName = arg; | 860 this.result_.logFileName = arg; |
844 continue; | 861 continue; |
845 } | 862 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 for (var synArg in this.argsDispatch_) { | 902 for (var synArg in this.argsDispatch_) { |
886 if (arg !== synArg && dispatch === this.argsDispatch_[synArg]) { | 903 if (arg !== synArg && dispatch === this.argsDispatch_[synArg]) { |
887 synonyms.push(synArg); | 904 synonyms.push(synArg); |
888 delete this.argsDispatch_[synArg]; | 905 delete this.argsDispatch_[synArg]; |
889 } | 906 } |
890 } | 907 } |
891 print(' ' + padRight(synonyms.join(', '), 20) + " " + dispatch[2]); | 908 print(' ' + padRight(synonyms.join(', '), 20) + " " + dispatch[2]); |
892 } | 909 } |
893 quit(2); | 910 quit(2); |
894 }; | 911 }; |
OLD | NEW |