diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2017-09-15 15:54:50 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-09-18 11:07:30 +0100 |
commit | 062bdb044cc2517256e02daf012415c51fb4d430 (patch) | |
tree | c578273fe529461f15886f3c8ad474e9ddbedddd | |
parent | ec5a5f28e2b517b04add20768d09e33b5c62d292 (diff) | |
download | poky-062bdb044cc2517256e02daf012415c51fb4d430.tar.gz |
scripts/oe-build-perf-report: add AggregateTestData class
Making the code a bit more readable.
(From OE-Core rev: 25351c7cac167b1a3e8b531e2cdf708192c6fa1f)
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | scripts/lib/build_perf/report.py | 5 | ||||
-rwxr-xr-x | scripts/oe-build-perf-report | 16 |
2 files changed, 13 insertions, 8 deletions
diff --git a/scripts/lib/build_perf/report.py b/scripts/lib/build_perf/report.py index eb00ccca2d..d99a36797f 100644 --- a/scripts/lib/build_perf/report.py +++ b/scripts/lib/build_perf/report.py | |||
@@ -11,12 +11,15 @@ | |||
11 | # more details. | 11 | # more details. |
12 | # | 12 | # |
13 | """Handling of build perf test reports""" | 13 | """Handling of build perf test reports""" |
14 | from collections import OrderedDict, Mapping | 14 | from collections import OrderedDict, Mapping, namedtuple |
15 | from datetime import datetime, timezone | 15 | from datetime import datetime, timezone |
16 | from numbers import Number | 16 | from numbers import Number |
17 | from statistics import mean, stdev, variance | 17 | from statistics import mean, stdev, variance |
18 | 18 | ||
19 | 19 | ||
20 | AggregateTestData = namedtuple('AggregateTestData', ['metadata', 'results']) | ||
21 | |||
22 | |||
20 | def isofmt_to_timestamp(string): | 23 | def isofmt_to_timestamp(string): |
21 | """Convert timestamp string in ISO 8601 format into unix timestamp""" | 24 | """Convert timestamp string in ISO 8601 format into unix timestamp""" |
22 | if '.' in string: | 25 | if '.' in string: |
diff --git a/scripts/oe-build-perf-report b/scripts/oe-build-perf-report index 23081db173..3a76ab621d 100755 --- a/scripts/oe-build-perf-report +++ b/scripts/oe-build-perf-report | |||
@@ -29,7 +29,8 @@ sys.path.append(os.path.join(scripts_path, 'lib')) | |||
29 | import scriptpath | 29 | import scriptpath |
30 | from build_perf import print_table | 30 | from build_perf import print_table |
31 | from build_perf.report import (metadata_xml_to_json, results_xml_to_json, | 31 | from build_perf.report import (metadata_xml_to_json, results_xml_to_json, |
32 | aggregate_data, aggregate_metadata, measurement_stats) | 32 | aggregate_data, aggregate_metadata, measurement_stats, |
33 | AggregateTestData) | ||
33 | from build_perf import html | 34 | from build_perf import html |
34 | 35 | ||
35 | scriptpath.add_oe_lib_path() | 36 | scriptpath.add_oe_lib_path() |
@@ -337,13 +338,13 @@ def print_html_report(data, id_comp): | |||
337 | 'hostname': {'title': 'Hostname', 'value': 'foobar'}, | 338 | 'hostname': {'title': 'Hostname', 'value': 'foobar'}, |
338 | 'commit': {'title': 'Commit', 'value': '1234'} | 339 | 'commit': {'title': 'Commit', 'value': '1234'} |
339 | } | 340 | } |
340 | metadata = metadata_diff(data[id_comp][0], data[-1][0]) | 341 | metadata = metadata_diff(data[id_comp].metadata, data[-1].metadata) |
341 | 342 | ||
342 | 343 | ||
343 | # Generate list of tests | 344 | # Generate list of tests |
344 | tests = [] | 345 | tests = [] |
345 | for test in data[-1][1]['tests'].keys(): | 346 | for test in data[-1].results['tests'].keys(): |
346 | test_r = data[-1][1]['tests'][test] | 347 | test_r = data[-1].results['tests'][test] |
347 | new_test = {'name': test_r['name'], | 348 | new_test = {'name': test_r['name'], |
348 | 'description': test_r['description'], | 349 | 'description': test_r['description'], |
349 | 'status': test_r['status'], | 350 | 'status': test_r['status'], |
@@ -576,7 +577,8 @@ def main(argv=None): | |||
576 | 577 | ||
577 | data = [] | 578 | data = [] |
578 | for raw_m, raw_d in raw_data: | 579 | for raw_m, raw_d in raw_data: |
579 | data.append((aggregate_metadata(raw_m), aggregate_data(raw_d))) | 580 | data.append(AggregateTestData(aggregate_metadata(raw_m), |
581 | aggregate_data(raw_d))) | ||
580 | 582 | ||
581 | # Re-map list indexes to the new table starting from index 0 | 583 | # Re-map list indexes to the new table starting from index 0 |
582 | index_r = index_r - index_0 | 584 | index_r = index_r - index_0 |
@@ -584,8 +586,8 @@ def main(argv=None): | |||
584 | 586 | ||
585 | # Print report | 587 | # Print report |
586 | if not args.html: | 588 | if not args.html: |
587 | print_diff_report(data[index_l][0], data[index_l][1], | 589 | print_diff_report(data[index_l].metadata, data[index_l].results, |
588 | data[index_r][0], data[index_r][1]) | 590 | data[index_r].metadata, data[index_r].results) |
589 | else: | 591 | else: |
590 | print_html_report(data, index_l) | 592 | print_html_report(data, index_l) |
591 | 593 | ||