OLD | NEW |
1 # Copyright 2008 the V8 project authors. All rights reserved. | 1 # Copyright 2008 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 | 140 |
141 | 141 |
142 class Assembler(object): | 142 class Assembler(object): |
143 | 143 |
144 def __init__(self): | 144 def __init__(self): |
145 # Mapping from region ids to open regions | 145 # Mapping from region ids to open regions |
146 self.pending_regions = {} | 146 self.pending_regions = {} |
147 self.regions = [] | 147 self.regions = [] |
148 | 148 |
149 | 149 |
150 VMStates = { 'JS': 0, 'GC': 1, 'COMPILER': 2, 'OTHER': 3 } | 150 VMStates = { 'JS': 0, 'GC': 1, 'COMPILER': 2, 'OTHER': 3, 'EXTERNAL' : 4 } |
151 | 151 |
152 | 152 |
153 class TickProcessor(object): | 153 class TickProcessor(object): |
154 | 154 |
155 def __init__(self): | 155 def __init__(self): |
156 self.log_file = '' | 156 self.log_file = '' |
157 self.deleted_code = [] | 157 self.deleted_code = [] |
158 self.vm_extent = {} | 158 self.vm_extent = {} |
159 # Map from assembler ids to the pending assembler objects | 159 # Map from assembler ids to the pending assembler objects |
160 self.pending_assemblers = {} | 160 self.pending_assemblers = {} |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 print(' %(ticks)5d %(total)5.1f%% %(call_path)s' % { | 409 print(' %(ticks)5d %(total)5.1f%% %(call_path)s' % { |
410 'ticks' : count, | 410 'ticks' : count, |
411 'total' : total_percentage, | 411 'total' : total_percentage, |
412 'call_path' : stack[0] + ' <- ' + stack[1] | 412 'call_path' : stack[0] + ' <- ' + stack[1] |
413 }) | 413 }) |
414 | 414 |
415 | 415 |
416 class CmdLineProcessor(object): | 416 class CmdLineProcessor(object): |
417 | 417 |
418 def __init__(self): | 418 def __init__(self): |
419 self.options = ["js", "gc", "compiler", "other", "ignore-unknown", "separate
-ic"] | 419 self.options = ["js", |
| 420 "gc", |
| 421 "compiler", |
| 422 "other", |
| 423 "external", |
| 424 "ignore-unknown", |
| 425 "separate-ic"] |
420 # default values | 426 # default values |
421 self.state = None | 427 self.state = None |
422 self.ignore_unknown = False | 428 self.ignore_unknown = False |
423 self.log_file = None | 429 self.log_file = None |
424 self.separate_ic = False | 430 self.separate_ic = False |
425 | 431 |
426 def ProcessArguments(self): | 432 def ProcessArguments(self): |
427 try: | 433 try: |
428 opts, args = getopt.getopt(sys.argv[1:], "jgco", self.options) | 434 opts, args = getopt.getopt(sys.argv[1:], "jgcoe", self.options) |
429 except getopt.GetoptError: | 435 except getopt.GetoptError: |
430 self.PrintUsageAndExit() | 436 self.PrintUsageAndExit() |
431 for key, value in opts: | 437 for key, value in opts: |
432 if key in ("-j", "--js"): | 438 if key in ("-j", "--js"): |
433 self.state = VMStates['JS'] | 439 self.state = VMStates['JS'] |
434 if key in ("-g", "--gc"): | 440 if key in ("-g", "--gc"): |
435 self.state = VMStates['GC'] | 441 self.state = VMStates['GC'] |
436 if key in ("-c", "--compiler"): | 442 if key in ("-c", "--compiler"): |
437 self.state = VMStates['COMPILER'] | 443 self.state = VMStates['COMPILER'] |
438 if key in ("-o", "--other"): | 444 if key in ("-o", "--other"): |
439 self.state = VMStates['OTHER'] | 445 self.state = VMStates['OTHER'] |
| 446 if key in ("-e", "--external"): |
| 447 self.state = VMStates['EXTERNAL'] |
440 if key in ("--ignore-unknown"): | 448 if key in ("--ignore-unknown"): |
441 self.ignore_unknown = True | 449 self.ignore_unknown = True |
442 if key in ("--separate-ic"): | 450 if key in ("--separate-ic"): |
443 self.separate_ic = True | 451 self.separate_ic = True |
444 self.ProcessRequiredArgs(args) | 452 self.ProcessRequiredArgs(args) |
445 | 453 |
446 def ProcessRequiredArgs(self, args): | 454 def ProcessRequiredArgs(self, args): |
447 return | 455 return |
448 | 456 |
449 def GetRequiredArgsNames(self): | 457 def GetRequiredArgsNames(self): |
450 return | 458 return |
451 | 459 |
452 def PrintUsageAndExit(self): | 460 def PrintUsageAndExit(self): |
453 print('Usage: %(script_name)s --{%(opts)s} %(req_opts)s' % { | 461 print('Usage: %(script_name)s --{%(opts)s} %(req_opts)s' % { |
454 'script_name': os.path.basename(sys.argv[0]), | 462 'script_name': os.path.basename(sys.argv[0]), |
455 'opts': string.join(self.options, ','), | 463 'opts': string.join(self.options, ','), |
456 'req_opts': self.GetRequiredArgsNames() | 464 'req_opts': self.GetRequiredArgsNames() |
457 }) | 465 }) |
458 sys.exit(2) | 466 sys.exit(2) |
459 | 467 |
460 def RunLogfileProcessing(self, tick_processor): | 468 def RunLogfileProcessing(self, tick_processor): |
461 tick_processor.ProcessLogfile(self.log_file, self.state, self.ignore_unknown
, self.separate_ic) | 469 tick_processor.ProcessLogfile(self.log_file, self.state, self.ignore_unknown
, self.separate_ic) |
462 | 470 |
463 | 471 |
464 if __name__ == '__main__': | 472 if __name__ == '__main__': |
465 sys.exit('You probably want to run windows-tick-processor.py or linux-tick-pro
cessor.py.') | 473 sys.exit('You probably want to run windows-tick-processor.py or linux-tick-pro
cessor.py.') |
OLD | NEW |