diff options
Diffstat (limited to 'testsuite/driver/perf_notes.py')
-rw-r--r-- | testsuite/driver/perf_notes.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/testsuite/driver/perf_notes.py b/testsuite/driver/perf_notes.py index 1fd37bcb4e..3f67f0d57c 100644 --- a/testsuite/driver/perf_notes.py +++ b/testsuite/driver/perf_notes.py @@ -19,7 +19,7 @@ import subprocess import time import sys -from collections import namedtuple +from collections import namedtuple, defaultdict from math import ceil, trunc from testutil import passed, failBecause, testing_metrics, print_table @@ -400,6 +400,24 @@ def commit_log(commitOrRange, n=None): print("Expected " + str(n) + " hashes, but git gave " + str(actualN) + ":\n" + output) return hashes +def add_new_changes(changes, new_changes): + for key, new_change in new_changes.items(): + changes[key].extend(new_change) + +def get_allowed_changes(baseline_ref: Optional[GitRef]) -> Dict[TestName, List[AllowedPerfChange]]: + if baseline_ref: + # The last 1000 commits in reverse order (starting from HEAD). + commit_hashes = baseline_commit_log(GitRef("HEAD")) + allowed_changes = defaultdict(list) # type: Dict[TestName, List[AllowedPerfChange]] + for commit in commit_hashes: + new_changes = get_allowed_perf_changes(commit) + if commit == baseline_ref: return dict(allowed_changes) + add_new_changes(allowed_changes, new_changes) + print("PERF_BASELINE_COMMIT not found in last 1000 commits...") + return dict() + else: + return get_allowed_perf_changes() + # Cache of baseline values. This is a dict of dicts indexed on: # (useCiNamespace, commit) -> (test_env, test, metric, way) -> baseline # (bool , str ) -> (str , str , str , str) -> float |