@@ -477,12 +477,10 @@ class ReportFormatter(object):
477
477
GitHub), `git` and `html`.
478
478
"""
479
479
480
- def __init__ (self , comparator , old_branch , new_branch , changes_only ,
480
+ def __init__ (self , comparator , changes_only ,
481
481
single_table = False ):
482
482
"""Initialize with `TestComparator` and names of branches."""
483
483
self .comparator = comparator
484
- self .old_branch = old_branch
485
- self .new_branch = new_branch
486
484
self .changes_only = changes_only
487
485
self .single_table = single_table
488
486
@@ -600,7 +598,6 @@ def table(title, results, is_strong=False, is_open=False):
600
598
])
601
599
602
600
return '' .join ([
603
- # FIXME print self.old_branch, self.new_branch
604
601
table ('Regression' , self .comparator .decreased , True , True ),
605
602
table ('Improvement' , self .comparator .increased , True ),
606
603
('' if self .changes_only else
@@ -675,7 +672,6 @@ def table(title, results, speedup_color):
675
672
676
673
return self .HTML .format (
677
674
'' .join ([
678
- # FIXME print self.old_branch, self.new_branch
679
675
table ('Regression' , self .comparator .decreased , 'red' ),
680
676
table ('Improvement' , self .comparator .increased , 'green' ),
681
677
('' if self .changes_only else
@@ -705,31 +701,33 @@ def parse_args(args):
705
701
'--single-table' ,
706
702
help = 'Combine data in a single table in git and markdown formats' ,
707
703
action = 'store_true' )
708
- parser .add_argument ('--new-branch' ,
709
- help = 'Name of the new branch' , default = 'NEW_MIN' )
710
- parser .add_argument ('--old-branch' ,
711
- help = 'Name of the old branch' , default = 'OLD_MIN' )
712
704
parser .add_argument ('--delta-threshold' ,
713
705
help = 'Delta threshold. Default 0.05.' ,
714
706
type = float , default = 0.05 )
715
707
return parser .parse_args (args )
716
708
717
709
718
- def main ():
719
- """Compare benchmarks for changes in a formatted report."""
720
- args = parse_args (sys .argv [1 :])
721
- comparator = TestComparator (LogParser .results_from_file (args .old_file ),
722
- LogParser .results_from_file (args .new_file ),
723
- args .delta_threshold )
724
- formatter = ReportFormatter (comparator , args .old_branch , args .new_branch ,
725
- args .changes_only , args .single_table )
710
+ def create_report (old_results , new_results , delta_threshold , format ,
711
+ changes_only = True , single_table = True ):
712
+ comparator = TestComparator (old_results , new_results , delta_threshold )
713
+ formatter = ReportFormatter (comparator , changes_only , single_table )
726
714
formats = {
727
715
'markdown' : formatter .markdown ,
728
716
'git' : formatter .git ,
729
717
'html' : formatter .html
730
718
}
731
719
732
- report = formats [args .format ]()
720
+ report = formats [format ]()
721
+ return report
722
+
723
+
724
+ def main ():
725
+ """Compare benchmarks for changes in a formatted report."""
726
+ args = parse_args (sys .argv [1 :])
727
+ report = create_report (LogParser .results_from_file (args .old_file ),
728
+ LogParser .results_from_file (args .new_file ),
729
+ args .delta_threshold , args .format ,
730
+ args .changes_only , args .single_table )
733
731
print (report )
734
732
735
733
if args .output :
0 commit comments