mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 21:09:03 +02:00
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>
This commit is contained in:
parent
ec5a5f28e2
commit
062bdb044c
|
@ -11,12 +11,15 @@
|
||||||
# more details.
|
# more details.
|
||||||
#
|
#
|
||||||
"""Handling of build perf test reports"""
|
"""Handling of build perf test reports"""
|
||||||
from collections import OrderedDict, Mapping
|
from collections import OrderedDict, Mapping, namedtuple
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
from numbers import Number
|
from numbers import Number
|
||||||
from statistics import mean, stdev, variance
|
from statistics import mean, stdev, variance
|
||||||
|
|
||||||
|
|
||||||
|
AggregateTestData = namedtuple('AggregateTestData', ['metadata', 'results'])
|
||||||
|
|
||||||
|
|
||||||
def isofmt_to_timestamp(string):
|
def isofmt_to_timestamp(string):
|
||||||
"""Convert timestamp string in ISO 8601 format into unix timestamp"""
|
"""Convert timestamp string in ISO 8601 format into unix timestamp"""
|
||||||
if '.' in string:
|
if '.' in string:
|
||||||
|
|
|
@ -29,7 +29,8 @@ sys.path.append(os.path.join(scripts_path, 'lib'))
|
||||||
import scriptpath
|
import scriptpath
|
||||||
from build_perf import print_table
|
from build_perf import print_table
|
||||||
from build_perf.report import (metadata_xml_to_json, results_xml_to_json,
|
from build_perf.report import (metadata_xml_to_json, results_xml_to_json,
|
||||||
aggregate_data, aggregate_metadata, measurement_stats)
|
aggregate_data, aggregate_metadata, measurement_stats,
|
||||||
|
AggregateTestData)
|
||||||
from build_perf import html
|
from build_perf import html
|
||||||
|
|
||||||
scriptpath.add_oe_lib_path()
|
scriptpath.add_oe_lib_path()
|
||||||
|
@ -337,13 +338,13 @@ def print_html_report(data, id_comp):
|
||||||
'hostname': {'title': 'Hostname', 'value': 'foobar'},
|
'hostname': {'title': 'Hostname', 'value': 'foobar'},
|
||||||
'commit': {'title': 'Commit', 'value': '1234'}
|
'commit': {'title': 'Commit', 'value': '1234'}
|
||||||
}
|
}
|
||||||
metadata = metadata_diff(data[id_comp][0], data[-1][0])
|
metadata = metadata_diff(data[id_comp].metadata, data[-1].metadata)
|
||||||
|
|
||||||
|
|
||||||
# Generate list of tests
|
# Generate list of tests
|
||||||
tests = []
|
tests = []
|
||||||
for test in data[-1][1]['tests'].keys():
|
for test in data[-1].results['tests'].keys():
|
||||||
test_r = data[-1][1]['tests'][test]
|
test_r = data[-1].results['tests'][test]
|
||||||
new_test = {'name': test_r['name'],
|
new_test = {'name': test_r['name'],
|
||||||
'description': test_r['description'],
|
'description': test_r['description'],
|
||||||
'status': test_r['status'],
|
'status': test_r['status'],
|
||||||
|
@ -576,7 +577,8 @@ def main(argv=None):
|
||||||
|
|
||||||
data = []
|
data = []
|
||||||
for raw_m, raw_d in raw_data:
|
for raw_m, raw_d in raw_data:
|
||||||
data.append((aggregate_metadata(raw_m), aggregate_data(raw_d)))
|
data.append(AggregateTestData(aggregate_metadata(raw_m),
|
||||||
|
aggregate_data(raw_d)))
|
||||||
|
|
||||||
# Re-map list indexes to the new table starting from index 0
|
# Re-map list indexes to the new table starting from index 0
|
||||||
index_r = index_r - index_0
|
index_r = index_r - index_0
|
||||||
|
@ -584,8 +586,8 @@ def main(argv=None):
|
||||||
|
|
||||||
# Print report
|
# Print report
|
||||||
if not args.html:
|
if not args.html:
|
||||||
print_diff_report(data[index_l][0], data[index_l][1],
|
print_diff_report(data[index_l].metadata, data[index_l].results,
|
||||||
data[index_r][0], data[index_r][1])
|
data[index_r].metadata, data[index_r].results)
|
||||||
else:
|
else:
|
||||||
print_html_report(data, index_l)
|
print_html_report(data, index_l)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user