OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2008 the V8 project authors. All rights reserved. | 3 # Copyright 2008 the V8 project authors. All rights reserved. |
4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
6 # met: | 6 # met: |
7 # | 7 # |
8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 i += 4096 | 106 i += 4096 |
107 finally: | 107 finally: |
108 map_file.close() | 108 map_file.close() |
109 | 109 |
110 def Usage(): | 110 def Usage(): |
111 print("Usage: windows-tick-processor.py binary logfile-name"); | 111 print("Usage: windows-tick-processor.py binary logfile-name"); |
112 sys.exit(2) | 112 sys.exit(2) |
113 | 113 |
114 def Main(): | 114 def Main(): |
115 # parse command line options | 115 # parse command line options |
| 116 ignore_unknown = False |
116 state = None; | 117 state = None; |
117 try: | 118 try: |
118 opts, args = getopt.getopt(sys.argv[1:], "jgco", ["js", "gc", "compiler", "o
ther"]) | 119 opts, args = getopt.getopt(sys.argv[1:], "jgco", ["js", "gc", "compiler", "o
ther", "ignore-unknown"]) |
119 except getopt.GetoptError: | 120 except getopt.GetoptError: |
120 usage() | 121 usage() |
121 # process options. | 122 # process options. |
122 for key, value in opts: | 123 for key, value in opts: |
123 if key in ("-j", "--js"): | 124 if key in ("-j", "--js"): |
124 state = 0 | 125 state = 0 |
125 if key in ("-g", "--gc"): | 126 if key in ("-g", "--gc"): |
126 state = 1 | 127 state = 1 |
127 if key in ("-c", "--compiler"): | 128 if key in ("-c", "--compiler"): |
128 state = 2 | 129 state = 2 |
129 if key in ("-o", "--other"): | 130 if key in ("-o", "--other"): |
130 state = 3 | 131 state = 3 |
| 132 if key in ("--ignore-unknown"): |
| 133 ignore_unknown = True |
131 # do the processing. | 134 # do the processing. |
132 if len(args) != 2: | 135 if len(args) != 2: |
133 Usage(); | 136 Usage(); |
134 tickprocessor = WindowsTickProcessor() | 137 tickprocessor = WindowsTickProcessor() |
135 tickprocessor.ParseMapFile(args[0]) | 138 tickprocessor.ParseMapFile(args[0]) |
136 tickprocessor.ProcessLogfile(args[1], state) | 139 tickprocessor.ProcessLogfile(args[1], state, ignore_unknown) |
137 tickprocessor.PrintResults() | 140 tickprocessor.PrintResults() |
138 | 141 |
139 if __name__ == '__main__': | 142 if __name__ == '__main__': |
140 Main() | 143 Main() |
OLD | NEW |