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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 finally: | 53 finally: |
54 pipe.close() | 54 pipe.close() |
55 | 55 |
56 | 56 |
57 def Usage(): | 57 def Usage(): |
58 print("Usage: linux-tick-processor.py --{js,gc,compiler,other} logfile-name")
; | 58 print("Usage: linux-tick-processor.py --{js,gc,compiler,other} logfile-name")
; |
59 sys.exit(2) | 59 sys.exit(2) |
60 | 60 |
61 def Main(): | 61 def Main(): |
62 # parse command line options | 62 # parse command line options |
| 63 ignore_unknown = False |
63 state = None; | 64 state = None; |
64 try: | 65 try: |
65 opts, args = getopt.getopt(sys.argv[1:], "jgco", ["js", "gc", "compiler", "o
ther"]) | 66 opts, args = getopt.getopt(sys.argv[1:], "jgco", ["js", "gc", "compiler", "o
ther", "ignore-unknown"]) |
66 except getopt.GetoptError: | 67 except getopt.GetoptError: |
67 usage() | 68 usage() |
68 # process options. | 69 # process options. |
69 for key, value in opts: | 70 for key, value in opts: |
70 if key in ("-j", "--js"): | 71 if key in ("-j", "--js"): |
71 state = 0 | 72 state = 0 |
72 if key in ("-g", "--gc"): | 73 if key in ("-g", "--gc"): |
73 state = 1 | 74 state = 1 |
74 if key in ("-c", "--compiler"): | 75 if key in ("-c", "--compiler"): |
75 state = 2 | 76 state = 2 |
76 if key in ("-o", "--other"): | 77 if key in ("-o", "--other"): |
77 state = 3 | 78 state = 3 |
| 79 if key in ("--ignore-unknown"): |
| 80 ignore_unknown = True |
78 # do the processing. | 81 # do the processing. |
79 if len(args) != 1: | 82 if len(args) != 1: |
80 Usage(); | 83 Usage(); |
81 tick_processor = LinuxTickProcessor() | 84 tick_processor = LinuxTickProcessor() |
82 tick_processor.ProcessLogfile(args[0], state) | 85 tick_processor.ProcessLogfile(args[0], state, ignore_unknown) |
83 tick_processor.PrintResults() | 86 tick_processor.PrintResults() |
84 | 87 |
85 if __name__ == '__main__': | 88 if __name__ == '__main__': |
86 Main() | 89 Main() |
OLD | NEW |