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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 # Calculate the V8-Total (all groups except Callback) | 388 # Calculate the V8-Total (all groups except Callback) |
389 group_data = { 'time': 0, 'count': 0 } | 389 group_data = { 'time': 0, 'count': 0 } |
390 for group_name, regexp in groups: | 390 for group_name, regexp in groups: |
391 if group_name == 'Group-Callback': continue | 391 if group_name == 'Group-Callback': continue |
392 group_data['time'] += entries[group_name]['time'] | 392 group_data['time'] += entries[group_name]['time'] |
393 group_data['count'] += entries[group_name]['count'] | 393 group_data['count'] += entries[group_name]['count'] |
394 entries['Group-Total-V8'] = group_data | 394 entries['Group-Total-V8'] = group_data |
395 # Calculate the Parse-Total group | 395 # Calculate the Parse-Total group |
396 group_data = { 'time': 0, 'count': 0 } | 396 group_data = { 'time': 0, 'count': 0 } |
397 for group_name, regexp in groups: | 397 for group_name, regexp in groups: |
398 if !group_name.startswith('Group-Parse'): continue | 398 if not group_name.startswith('Group-Parse'): continue |
399 group_data['time'] += entries[group_name]['time'] | 399 group_data['time'] += entries[group_name]['time'] |
400 group_data['count'] += entries[group_name]['count'] | 400 group_data['count'] += entries[group_name]['count'] |
401 entries['Group-Parse-Total'] = group_data | 401 entries['Group-Parse-Total'] = group_data |
402 # Append the sums as single entries to domain. | 402 # Append the sums as single entries to domain. |
403 for key in entries: | 403 for key in entries: |
404 if key not in domain: domain[key] = { 'time_list': [], 'count_list': [] } | 404 if key not in domain: domain[key] = { 'time_list': [], 'count_list': [] } |
405 domain[key]['time_list'].append(entries[key]['time']) | 405 domain[key]['time_list'].append(entries[key]['time']) |
406 domain[key]['count_list'].append(entries[key]['count']) | 406 domain[key]['count_list'].append(entries[key]['count']) |
407 | 407 |
408 | 408 |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 args.error("use either option --sites-file or site URLs") | 688 args.error("use either option --sites-file or site URLs") |
689 sys.exit(1) | 689 sys.exit(1) |
690 elif args.command == "run" and not coexist(args.replay_wpr, args.replay_bin): | 690 elif args.command == "run" and not coexist(args.replay_wpr, args.replay_bin): |
691 args.error("options --replay-wpr and --replay-bin must be used together") | 691 args.error("options --replay-wpr and --replay-bin must be used together") |
692 sys.exit(1) | 692 sys.exit(1) |
693 else: | 693 else: |
694 args.func(args) | 694 args.func(args) |
695 | 695 |
696 if __name__ == "__main__": | 696 if __name__ == "__main__": |
697 sys.exit(main()) | 697 sys.exit(main()) |
OLD | NEW |