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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
339 'stddev': stddev, 'min': low, 'max': high, 'ci': ci } | 339 'stddev': stddev, 'min': low, 'max': high, 'ci': ci } |
340 | 340 |
341 | 341 |
342 def read_stats(path, domain, args): | 342 def read_stats(path, domain, args): |
343 groups = []; | 343 groups = []; |
344 if args.aggregate: | 344 if args.aggregate: |
345 groups = [ | 345 groups = [ |
346 ('Group-IC', re.compile(".*IC_.*")), | 346 ('Group-IC', re.compile(".*IC_.*")), |
347 ('Group-Optimize', | 347 ('Group-Optimize', |
348 re.compile("StackGuard|.*Optimize.*|.*Deoptimize.*|Recompile.*")), | 348 re.compile("StackGuard|.*Optimize.*|.*Deoptimize.*|Recompile.*")), |
349 ('Group-CompileBackground', re.compile("(.*CompileBackground.*)")), | |
Camillo Bruni
2016/12/16 09:25:05
Could you add the same regexp entry in callstats.h
rmcilroy
2016/12/16 23:48:05
Done.
| |
349 ('Group-Compile', re.compile("(^Compile.*)|(.*_Compile.*)")), | 350 ('Group-Compile', re.compile("(^Compile.*)|(.*_Compile.*)")), |
350 ('Group-ParseBackground', re.compile(".*ParseBackground.*")), | 351 ('Group-ParseBackground', re.compile(".*ParseBackground.*")), |
351 ('Group-Parse', re.compile(".*Parse.*")), | 352 ('Group-Parse', re.compile(".*Parse.*")), |
352 ('Group-Callback', re.compile(".*Callback.*")), | 353 ('Group-Callback', re.compile(".*Callback.*")), |
353 ('Group-API', re.compile(".*API.*")), | 354 ('Group-API', re.compile(".*API.*")), |
354 ('Group-GC', re.compile("GC|AllocateInTargetSpace")), | 355 ('Group-GC', re.compile("GC|AllocateInTargetSpace")), |
355 ('Group-JavaScript', re.compile("JS_Execution")), | 356 ('Group-JavaScript', re.compile("JS_Execution")), |
356 ('Group-Runtime', re.compile(".*"))] | 357 ('Group-Runtime', re.compile(".*"))] |
357 with open(path, "rt") as f: | 358 with open(path, "rt") as f: |
358 # Process the whole file and sum repeating entries. | 359 # Process the whole file and sum repeating entries. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
392 group_data['time'] += entries[group_name]['time'] | 393 group_data['time'] += entries[group_name]['time'] |
393 group_data['count'] += entries[group_name]['count'] | 394 group_data['count'] += entries[group_name]['count'] |
394 entries['Group-Total-V8'] = group_data | 395 entries['Group-Total-V8'] = group_data |
395 # Calculate the Parse-Total group | 396 # Calculate the Parse-Total group |
396 group_data = { 'time': 0, 'count': 0 } | 397 group_data = { 'time': 0, 'count': 0 } |
397 for group_name, regexp in groups: | 398 for group_name, regexp in groups: |
398 if not group_name.startswith('Group-Parse'): continue | 399 if not group_name.startswith('Group-Parse'): continue |
399 group_data['time'] += entries[group_name]['time'] | 400 group_data['time'] += entries[group_name]['time'] |
400 group_data['count'] += entries[group_name]['count'] | 401 group_data['count'] += entries[group_name]['count'] |
401 entries['Group-Parse-Total'] = group_data | 402 entries['Group-Parse-Total'] = group_data |
403 # Calculate the Compile-Total group | |
404 group_data = { 'time': 0, 'count': 0 } | |
405 for group_name, regexp in groups: | |
406 if not group_name.startswith('Group-Compile'): continue | |
407 group_data['time'] += entries[group_name]['time'] | |
408 group_data['count'] += entries[group_name]['count'] | |
409 entries['Group-Compile-Total'] = group_data | |
402 # Append the sums as single entries to domain. | 410 # Append the sums as single entries to domain. |
403 for key in entries: | 411 for key in entries: |
404 if key not in domain: domain[key] = { 'time_list': [], 'count_list': [] } | 412 if key not in domain: domain[key] = { 'time_list': [], 'count_list': [] } |
405 domain[key]['time_list'].append(entries[key]['time']) | 413 domain[key]['time_list'].append(entries[key]['time']) |
406 domain[key]['count_list'].append(entries[key]['count']) | 414 domain[key]['count_list'].append(entries[key]['count']) |
407 | 415 |
408 | 416 |
409 def print_stats(S, args): | 417 def print_stats(S, args): |
410 # Sort by ascending/descending time average, then by ascending/descending | 418 # Sort by ascending/descending time average, then by ascending/descending |
411 # count average, then by ascending name. | 419 # count average, then by ascending name. |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
688 args.error("use either option --sites-file or site URLs") | 696 args.error("use either option --sites-file or site URLs") |
689 sys.exit(1) | 697 sys.exit(1) |
690 elif args.command == "run" and not coexist(args.replay_wpr, args.replay_bin): | 698 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") | 699 args.error("options --replay-wpr and --replay-bin must be used together") |
692 sys.exit(1) | 700 sys.exit(1) |
693 else: | 701 else: |
694 args.func(args) | 702 args.func(args) |
695 | 703 |
696 if __name__ == "__main__": | 704 if __name__ == "__main__": |
697 sys.exit(main()) | 705 sys.exit(main()) |
OLD | NEW |