diff options
author | Julien Duraj <julien.duraj@linaro.org> | 2016-09-06 16:08:51 +0100 |
---|---|---|
committer | Alexandre Rames <alexandre.rames@linaro.org> | 2016-09-09 16:22:25 +0100 |
commit | ec9ad131ecf07660b5bdf9a9b6bbe98cdb2b4f36 (patch) | |
tree | 640118e7630bd6bdce2a581b214624c4886590b1 | |
parent | bc280f46693dd6fec666eaead0c18f3ca6b2e596 (diff) | |
download | art-testing-ec9ad131ecf07660b5bdf9a9b6bbe98cdb2b4f36.tar.gz |
Do geomean computation on filtered common keys
When we have 2 sets of statistics that are not equal
Change-Id: I3811b216f6dc8503df0ba22bb8cdf2bacfbe9009
-rwxr-xr-x | compare.py | 17 | ||||
-rw-r--r-- | tools/utils.py | 12 |
2 files changed, 20 insertions, 9 deletions
@@ -194,11 +194,12 @@ if __name__ == "__main__": print_extended=args.print_extended, order_by_diff=args.order_by_diff, filter_stats_warnings=args.output_for_linaro_automation) - if utils.HaveSameKeys(res_1, res_2): - utils_stats.ComputeAndPrintRelationGeomean( - utils.Unflatten(res_1), - utils.Unflatten(res_2), - args.print_extended >= print_extended_raw_data) - else: - utils.Info("Not comparing the geomeans because the two result sets " - "have different keys.") + + if not utils.HaveSameKeys(res_1, res_2): + utils.Warning("Computing geomean on a subset of statistics which only " \ + "includes keys common to both datasets.") + res_1, res_2 = utils.KeepSameKeys(res_1, res_2) + utils_stats.ComputeAndPrintRelationGeomean( + utils.Unflatten(res_1), + utils.Unflatten(res_2), + args.print_extended >= print_extended_raw_data) diff --git a/tools/utils.py b/tools/utils.py index 77d5965..409ee47 100644 --- a/tools/utils.py +++ b/tools/utils.py @@ -416,7 +416,17 @@ def Flatten(data, key=''): return res - +def KeepSameKeys(data_1, data_2): + for stats_type in data_1: + keys_1, keys_2 = data_1[stats_type].keys(), data_2[stats_type].keys() + diff_keys = keys_1 ^ keys_2 + for k in list(keys_1): + if k in diff_keys: + del data_1[stats_type][k] + for k in list(keys_2): + if k in diff_keys: + del data_2[stats_type][k] + return data_1, data_2 def HaveSameKeys(data_1, data_2): if IsDictionary(data_1) and IsDictionary(data_2): |