| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2016 the V8 project authors. All rights reserved. | 2 # Copyright 2016 the V8 project authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 ''' | 5 ''' |
| 6 Usage: callstats.py [-h] <command> ... | 6 Usage: callstats.py [-h] <command> ... |
| 7 | 7 |
| 8 Optional arguments: | 8 Optional arguments: |
| 9 -h, --help show this help message and exit | 9 -h, --help show this help message and exit |
| 10 | 10 |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 'stddev': stddev, 'min': low, 'max': high, 'ci': ci } | 342 'stddev': stddev, 'min': low, 'max': high, 'ci': ci } |
| 343 | 343 |
| 344 | 344 |
| 345 def read_stats(path, domain, args): | 345 def read_stats(path, domain, args): |
| 346 groups = []; | 346 groups = []; |
| 347 if args.aggregate: | 347 if args.aggregate: |
| 348 groups = [ | 348 groups = [ |
| 349 ('Group-IC', re.compile(".*IC_.*")), | 349 ('Group-IC', re.compile(".*IC_.*")), |
| 350 ('Group-Optimize', | 350 ('Group-Optimize', |
| 351 re.compile("StackGuard|.*Optimize.*|.*Deoptimize.*|Recompile.*")), | 351 re.compile("StackGuard|.*Optimize.*|.*Deoptimize.*|Recompile.*")), |
| 352 ('Group-CompileBackground', re.compile("(.*CompileBackground.*)")), |
| 352 ('Group-Compile', re.compile("(^Compile.*)|(.*_Compile.*)")), | 353 ('Group-Compile', re.compile("(^Compile.*)|(.*_Compile.*)")), |
| 353 ('Group-ParseBackground', re.compile(".*ParseBackground.*")), | 354 ('Group-ParseBackground', re.compile(".*ParseBackground.*")), |
| 354 ('Group-Parse', re.compile(".*Parse.*")), | 355 ('Group-Parse', re.compile(".*Parse.*")), |
| 355 ('Group-Callback', re.compile(".*Callback.*")), | 356 ('Group-Callback', re.compile(".*Callback.*")), |
| 356 ('Group-API', re.compile(".*API.*")), | 357 ('Group-API', re.compile(".*API.*")), |
| 357 ('Group-GC', re.compile("GC|AllocateInTargetSpace")), | 358 ('Group-GC', re.compile("GC|AllocateInTargetSpace")), |
| 358 ('Group-JavaScript', re.compile("JS_Execution")), | 359 ('Group-JavaScript', re.compile("JS_Execution")), |
| 359 ('Group-Runtime', re.compile(".*"))] | 360 ('Group-Runtime', re.compile(".*"))] |
| 360 with open(path, "rt") as f: | 361 with open(path, "rt") as f: |
| 361 # Process the whole file and sum repeating entries. | 362 # Process the whole file and sum repeating entries. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 group_data['time'] += entries[group_name]['time'] | 396 group_data['time'] += entries[group_name]['time'] |
| 396 group_data['count'] += entries[group_name]['count'] | 397 group_data['count'] += entries[group_name]['count'] |
| 397 entries['Group-Total-V8'] = group_data | 398 entries['Group-Total-V8'] = group_data |
| 398 # Calculate the Parse-Total group | 399 # Calculate the Parse-Total group |
| 399 group_data = { 'time': 0, 'count': 0 } | 400 group_data = { 'time': 0, 'count': 0 } |
| 400 for group_name, regexp in groups: | 401 for group_name, regexp in groups: |
| 401 if not group_name.startswith('Group-Parse'): continue | 402 if not group_name.startswith('Group-Parse'): continue |
| 402 group_data['time'] += entries[group_name]['time'] | 403 group_data['time'] += entries[group_name]['time'] |
| 403 group_data['count'] += entries[group_name]['count'] | 404 group_data['count'] += entries[group_name]['count'] |
| 404 entries['Group-Parse-Total'] = group_data | 405 entries['Group-Parse-Total'] = group_data |
| 406 # Calculate the Compile-Total group |
| 407 group_data = { 'time': 0, 'count': 0 } |
| 408 for group_name, regexp in groups: |
| 409 if not group_name.startswith('Group-Compile'): continue |
| 410 group_data['time'] += entries[group_name]['time'] |
| 411 group_data['count'] += entries[group_name]['count'] |
| 412 entries['Group-Compile-Total'] = group_data |
| 405 # Append the sums as single entries to domain. | 413 # Append the sums as single entries to domain. |
| 406 for key in entries: | 414 for key in entries: |
| 407 if key not in domain: domain[key] = { 'time_list': [], 'count_list': [] } | 415 if key not in domain: domain[key] = { 'time_list': [], 'count_list': [] } |
| 408 domain[key]['time_list'].append(entries[key]['time']) | 416 domain[key]['time_list'].append(entries[key]['time']) |
| 409 domain[key]['count_list'].append(entries[key]['count']) | 417 domain[key]['count_list'].append(entries[key]['count']) |
| 410 | 418 |
| 411 | 419 |
| 412 def print_stats(S, args): | 420 def print_stats(S, args): |
| 413 # Sort by ascending/descending time average, then by ascending/descending | 421 # Sort by ascending/descending time average, then by ascending/descending |
| 414 # count average, then by ascending name. | 422 # count average, then by ascending name. |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 args.error("use either option --sites-file or site URLs") | 699 args.error("use either option --sites-file or site URLs") |
| 692 sys.exit(1) | 700 sys.exit(1) |
| 693 elif args.command == "run" and not coexist(args.replay_wpr, args.replay_bin): | 701 elif args.command == "run" and not coexist(args.replay_wpr, args.replay_bin): |
| 694 args.error("options --replay-wpr and --replay-bin must be used together") | 702 args.error("options --replay-wpr and --replay-bin must be used together") |
| 695 sys.exit(1) | 703 sys.exit(1) |
| 696 else: | 704 else: |
| 697 args.func(args) | 705 args.func(args) |
| 698 | 706 |
| 699 if __name__ == "__main__": | 707 if __name__ == "__main__": |
| 700 sys.exit(main()) | 708 sys.exit(main()) |
| OLD | NEW |