Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: tools/testing/perf_testing/run_perf_tests.py

Issue 10252017: Improve posting format for size tests. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/testing/webdriver_test_setup.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
4 # for details. All rights reserved. Use of this source code is governed by a 4 # for details. All rights reserved. Use of this source code is governed by a
5 # BSD-style license that can be found in the LICENSE file. 5 # BSD-style license that can be found in the LICENSE file.
6 6
7 import datetime 7 import datetime
8 import optparse 8 import optparse
9 import os 9 import os
10 from os.path import dirname, abspath 10 from os.path import dirname, abspath
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 'benchmark_page_%s.html' % version) 465 'benchmark_page_%s.html' % version)
466 self.test.test_runner.run_cmd( 466 self.test.test_runner.run_cmd(
467 ['python', os.path.join('tools', 'testing', 'run_selenium.py'), 467 ['python', os.path.join('tools', 'testing', 'run_selenium.py'),
468 '--out', file_path, '--browser', browser, 468 '--out', file_path, '--browser', browser,
469 '--timeout', '600', '--mode', 'perf'], self.test.trace_file, 469 '--timeout', '600', '--mode', 'perf'], self.test.trace_file,
470 append=True) 470 append=True)
471 471
472 class CommonBrowserFileProcessor(Processor): 472 class CommonBrowserFileProcessor(Processor):
473 def process_file(self, afile): 473 def process_file(self, afile):
474 """Comb through the html to find the performance results. 474 """Comb through the html to find the performance results.
475 Returns: True if we successfullly posted our data to storage.""" 475 Returns: True if we successfully posted our data to storage and/or we can
476 delete the trace file."""
476 os.chdir(os.path.join(DART_INSTALL_LOCATION, 'tools', 477 os.chdir(os.path.join(DART_INSTALL_LOCATION, 'tools',
477 'testing', 'perf_testing')) 478 'testing', 'perf_testing'))
478 if self.test.test_runner.no_upload: 479 if self.test.test_runner.no_upload:
479 return 480 return
480 parts = afile.split('-') 481 parts = afile.split('-')
481 browser = parts[2] 482 browser = parts[2]
482 version = parts[3] 483 version = parts[3]
483 f = open(os.path.join(self.test.result_folder_name, afile)) 484 f = open(os.path.join(self.test.result_folder_name, afile))
484 lines = f.readlines() 485 lines = f.readlines()
485 line = '' 486 line = ''
486 i = 0 487 i = 0
487 revision_num = 0 488 revision_num = 0
488 while '<div id="results">' not in line and i < len(lines): 489 while '<div id="results">' not in line and i < len(lines):
489 if 'Revision' in line: 490 if 'Revision' in line:
490 revision_num = int(line.split()[1].strip('"')) 491 revision_num = int(line.split()[1].strip('"'))
491 line = lines[i] 492 line = lines[i]
492 i += 1 493 i += 1
493 494
494 if i >= len(lines) or revision_num == 0: 495 if i >= len(lines) or revision_num == 0:
495 # Then this run did not complete. Ignore this tracefile. 496 # Then this run did not complete. Ignore this tracefile.
496 return 497 return True
497 498
498 line = lines[i] 499 line = lines[i]
499 i += 1 500 i += 1
500 results = [] 501 results = []
501 if line.find('<br>') > -1: 502 if line.find('<br>') > -1:
502 results = line.split('<br>') 503 results = line.split('<br>')
503 else: 504 else:
504 results = line.split('<br />') 505 results = line.split('<br />')
505 upload_success = True 506 upload_success = True
506 for result in results: 507 for result in results:
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 if browser == 'dartium': 646 if browser == 'dartium':
646 version = version.replace('frog', 'dart') 647 version = version.replace('frog', 'dart')
647 version = version.replace('_','&') 648 version = version.replace('_','&')
648 tags = DromaeoTester.get_valid_dromaeo_tags() 649 tags = DromaeoTester.get_valid_dromaeo_tags()
649 return '|'.join([ '%s&%s' % (version, tag) for tag in tags]) 650 return '|'.join([ '%s&%s' % (version, tag) for tag in tags])
650 651
651 652
652 class DromaeoFileProcessor(Processor): 653 class DromaeoFileProcessor(Processor):
653 def process_file(self, afile): 654 def process_file(self, afile):
654 """Comb through the html to find the performance results. 655 """Comb through the html to find the performance results.
655 Returns: True if we successfullly posted our data to storage.""" 656 Returns: True if we successfully posted our data to storage."""
656 if self.test.test_runner.no_upload: 657 if self.test.test_runner.no_upload:
657 return 658 return
658 parts = afile.split('-') 659 parts = afile.split('-')
659 browser = parts[2] 660 browser = parts[2]
660 version = parts[3] 661 version = parts[3]
661 662
662 f = open(os.path.join(self.test.result_folder_name, afile)) 663 f = open(os.path.join(self.test.result_folder_name, afile))
663 lines = f.readlines() 664 lines = f.readlines()
664 i = 0 665 i = 0
665 revision_num = 0 666 revision_num = 0
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 total_size[variant])], 768 total_size[variant])],
768 self.test.trace_file, append=True) 769 self.test.trace_file, append=True)
769 770
770 771
771 class DromaeoSizeProcessor(Processor): 772 class DromaeoSizeProcessor(Processor):
772 def process_file(self, afile): 773 def process_file(self, afile):
773 """Pull all the relevant information out of a given tracefile. 774 """Pull all the relevant information out of a given tracefile.
774 775
775 Args: 776 Args:
776 afile: is the filename string we will be processing. 777 afile: is the filename string we will be processing.
777 Returns: True if we successfullly posted our data to storage.""" 778 Returns: True if we successfully posted our data to storage."""
778 os.chdir(os.path.join(DART_INSTALL_LOCATION, 'tools', 779 os.chdir(os.path.join(DART_INSTALL_LOCATION, 'tools',
779 'testing', 'perf_testing')) 780 'testing', 'perf_testing'))
780 if self.test.test_runner.no_upload: 781 if self.test.test_runner.no_upload:
781 return 782 return
782 f = open(os.path.join(self.test.result_folder_name, afile)) 783 f = open(os.path.join(self.test.result_folder_name, afile))
783 tabulate_data = False 784 tabulate_data = False
784 revision_num = 0 785 revision_num = 0
785 revision_pattern = r'Revision: (\d+)' 786 revision_pattern = r'Revision: (\d+)'
786 result_pattern = r'Size \((\w+), ([a-zA-Z0-9-]+)\): (\d+)' 787 result_pattern = r'Size \((\w+), ([a-zA-Z0-9-]+)\): (\d+)'
787 788
788 upload_success = True 789 upload_success = True
789 for line in f.readlines(): 790 for line in f.readlines():
790 rev = re.match(revision_pattern, line.strip()) 791 rev = re.match(revision_pattern, line.strip())
791 if rev: 792 if rev:
792 revision_num = int(rev.group(1)) 793 revision_num = int(rev.group(1))
793 continue 794 continue
794 795
795 result = re.match(result_pattern, line.strip()) 796 result = re.match(result_pattern, line.strip())
796 if result: 797 if result:
797 variant = result.group(1) 798 variant = result.group(1)
798 metric = result.group(2) 799 metric = result.group(2)
799 num = result.group(3) 800 num = result.group(3)
800 if num.find('.') == -1: 801 if num.find('.') == -1:
801 num = int(num) 802 num = int(num)
802 else: 803 else:
803 num = float(num) 804 num = float(num)
804 upload_success = upload_success and self.report_results( 805 upload_success = upload_success and self.report_results(
805 metric, num, 'browser', variant, revision_num, self.CODE_SIZE) 806 metric, num, 'commandline', variant, revision_num, self.CODE_SIZE)
806 807
807 f.close() 808 f.close()
808 return upload_success 809 return upload_success
809 810
810 811
811 class CompileTimeAndSizeTest(Test): 812 class CompileTimeAndSizeTest(Test):
812 """Run tests to determine how long frogc takes to compile, and the compiled 813 """Run tests to determine how long frogc takes to compile, and the compiled
813 file output size of some benchmarking files.""" 814 file output size of some benchmarking files."""
814 def __init__(self, test_runner): 815 def __init__(self, test_runner):
815 """Reference to the test_runner object that notifies us when to begin 816 """Reference to the test_runner object that notifies us when to begin
(...skipping 22 matching lines...) Expand all
838 os.chdir('frog') 839 os.chdir('frog')
839 self.test.trace_file = os.path.join( 840 self.test.trace_file = os.path.join(
840 '..', 'tools', 'testing', 'perf_testing', 841 '..', 'tools', 'testing', 'perf_testing',
841 self.test.result_folder_name, 842 self.test.result_folder_name,
842 self.test.result_folder_name + self.test.cur_time) 843 self.test.result_folder_name + self.test.cur_time)
843 844
844 self.add_svn_revision_to_trace(self.test.trace_file) 845 self.add_svn_revision_to_trace(self.test.trace_file)
845 846
846 self.test.test_runner.run_cmd( 847 self.test.test_runner.run_cmd(
847 [self.test.dart_vm, 'frogc.dart', '--out=swarm-result', 848 [self.test.dart_vm, 'frogc.dart', '--out=swarm-result',
848 os.path.join('..', 'samples', 'swarm', 849 os.path.join('..', 'internal', 'golem', 'benchmarks-dart2js', 'tests',
849 'swarm.dart')]) 850 'samples-r6461', 'swarm', 'swarm.dart')])
850 851
851 swarm_size = 0 852 swarm_size = 0
852 try: 853 try:
853 swarm_size = os.path.getsize('swarm-result') 854 swarm_size = os.path.getsize('swarm-result')
854 except OSError: 855 except OSError:
855 pass #If compilation failed, continue on running other tests. 856 pass #If compilation failed, continue on running other tests.
856 857
857 self.test.test_runner.run_cmd( 858 self.test.test_runner.run_cmd(
858 [self.test.dart_vm, 'frogc.dart', '--out=total-result', 859 [self.test.dart_vm, 'frogc.dart', '--out=total-result',
859 os.path.join('..', 'samples', 'total', 860 os.path.join('..', 'internal', 'golem', 'benchmarks-dart2js', 'tests',
860 'client', 'Total.dart')]) 861 'samples-r6461', 'total', 'client', 'Total.dart')])
861 total_size = 0 862 total_size = 0
862 try: 863 try:
863 total_size = os.path.getsize('total-result') 864 total_size = os.path.getsize('total-result')
864 except OSError: 865 except OSError:
865 pass #If compilation failed, continue on running other tests. 866 pass #If compilation failed, continue on running other tests.
866 867
867 self.test.test_runner.run_cmd( 868 self.test.test_runner.run_cmd(
868 ['echo', '%d Generated checked swarm size' % swarm_size], 869 ['echo', '%d Generated checked swarm size' % swarm_size],
869 self.test.trace_file, append=True) 870 self.test.trace_file, append=True)
870 871
871 self.test.test_runner.run_cmd( 872 self.test.test_runner.run_cmd(
872 ['echo', '%d Generated checked total size' % total_size], 873 ['echo', '%d Generated checked total size' % total_size],
873 self.test.trace_file, append=True) 874 self.test.trace_file, append=True)
874 875
875 os.chdir('..') 876 os.chdir('..')
876 877
877 878
878 class CompileProcessor(Processor): 879 class CompileProcessor(Processor):
879 880
880 def process_file(self, afile): 881 def process_file(self, afile):
881 """Pull all the relevant information out of a given tracefile. 882 """Pull all the relevant information out of a given tracefile.
882 883
883 Args: 884 Args:
884 afile: is the filename string we will be processing. 885 afile: is the filename string we will be processing.
885 Returns: True if we successfullly posted our data to storage.""" 886 Returns: True if we successfully posted our data to storage."""
886 os.chdir(os.path.join(DART_INSTALL_LOCATION, 'tools', 887 os.chdir(os.path.join(DART_INSTALL_LOCATION, 'tools',
887 'testing', 'perf_testing')) 888 'testing', 'perf_testing'))
888 if self.test.test_runner.no_upload: 889 if self.test.test_runner.no_upload:
889 return 890 return
890 f = open(os.path.join(self.test.result_folder_name, afile)) 891 f = open(os.path.join(self.test.result_folder_name, afile))
891 tabulate_data = False 892 tabulate_data = False
892 revision_num = 0 893 revision_num = 0
893 upload_success = True 894 upload_success = True
894 for line in f.readlines(): 895 for line in f.readlines():
895 tokens = line.split() 896 tokens = line.split()
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 while True: 935 while True:
935 if runner.has_new_code(): 936 if runner.has_new_code():
936 runner.run_test_sequence() 937 runner.run_test_sequence()
937 else: 938 else:
938 time.sleep(200) 939 time.sleep(200)
939 else: 940 else:
940 runner.run_test_sequence() 941 runner.run_test_sequence()
941 942
942 if __name__ == '__main__': 943 if __name__ == '__main__':
943 main() 944 main()
OLDNEW
« no previous file with comments | « no previous file | tools/testing/webdriver_test_setup.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698