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.*)")), | |
353 ('Group-Compile', re.compile("(^Compile.*)|(.*_Compile.*)")), | 352 ('Group-Compile', re.compile("(^Compile.*)|(.*_Compile.*)")), |
354 ('Group-ParseBackground', re.compile(".*ParseBackground.*")), | 353 ('Group-ParseBackground', re.compile(".*ParseBackground.*")), |
355 ('Group-Parse', re.compile(".*Parse.*")), | 354 ('Group-Parse', re.compile(".*Parse.*")), |
356 ('Group-Callback', re.compile(".*Callback.*")), | 355 ('Group-Callback', re.compile(".*Callback.*")), |
357 ('Group-API', re.compile(".*API.*")), | 356 ('Group-API', re.compile(".*API.*")), |
358 ('Group-GC', re.compile("GC|AllocateInTargetSpace")), | 357 ('Group-GC', re.compile("GC|AllocateInTargetSpace")), |
359 ('Group-JavaScript', re.compile("JS_Execution")), | 358 ('Group-JavaScript', re.compile("JS_Execution")), |
360 ('Group-Runtime', re.compile(".*"))] | 359 ('Group-Runtime', re.compile(".*"))] |
361 with open(path, "rt") as f: | 360 with open(path, "rt") as f: |
362 # Process the whole file and sum repeating entries. | 361 # Process the whole file and sum repeating entries. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 group_data['time'] += entries[group_name]['time'] | 395 group_data['time'] += entries[group_name]['time'] |
397 group_data['count'] += entries[group_name]['count'] | 396 group_data['count'] += entries[group_name]['count'] |
398 entries['Group-Total-V8'] = group_data | 397 entries['Group-Total-V8'] = group_data |
399 # Calculate the Parse-Total group | 398 # Calculate the Parse-Total group |
400 group_data = { 'time': 0, 'count': 0 } | 399 group_data = { 'time': 0, 'count': 0 } |
401 for group_name, regexp in groups: | 400 for group_name, regexp in groups: |
402 if not group_name.startswith('Group-Parse'): continue | 401 if not group_name.startswith('Group-Parse'): continue |
403 group_data['time'] += entries[group_name]['time'] | 402 group_data['time'] += entries[group_name]['time'] |
404 group_data['count'] += entries[group_name]['count'] | 403 group_data['count'] += entries[group_name]['count'] |
405 entries['Group-Parse-Total'] = group_data | 404 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 | |
413 # Append the sums as single entries to domain. | 405 # Append the sums as single entries to domain. |
414 for key in entries: | 406 for key in entries: |
415 if key not in domain: domain[key] = { 'time_list': [], 'count_list': [] } | 407 if key not in domain: domain[key] = { 'time_list': [], 'count_list': [] } |
416 domain[key]['time_list'].append(entries[key]['time']) | 408 domain[key]['time_list'].append(entries[key]['time']) |
417 domain[key]['count_list'].append(entries[key]['count']) | 409 domain[key]['count_list'].append(entries[key]['count']) |
418 | 410 |
419 | 411 |
420 def print_stats(S, args): | 412 def print_stats(S, args): |
421 # Sort by ascending/descending time average, then by ascending/descending | 413 # Sort by ascending/descending time average, then by ascending/descending |
422 # count average, then by ascending name. | 414 # count average, then by ascending name. |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 args.error("use either option --sites-file or site URLs") | 691 args.error("use either option --sites-file or site URLs") |
700 sys.exit(1) | 692 sys.exit(1) |
701 elif args.command == "run" and not coexist(args.replay_wpr, args.replay_bin): | 693 elif args.command == "run" and not coexist(args.replay_wpr, args.replay_bin): |
702 args.error("options --replay-wpr and --replay-bin must be used together") | 694 args.error("options --replay-wpr and --replay-bin must be used together") |
703 sys.exit(1) | 695 sys.exit(1) |
704 else: | 696 else: |
705 args.func(args) | 697 args.func(args) |
706 | 698 |
707 if __name__ == "__main__": | 699 if __name__ == "__main__": |
708 sys.exit(main()) | 700 sys.exit(main()) |
OLD | NEW |