diff options
author | Emma Foley <emma.l.foley@intel.com> | 2019-01-25 14:42:55 +0000 |
---|---|---|
committer | Emma Foley <emma.l.foley@intel.com> | 2019-02-11 11:53:27 +0000 |
commit | 6a0ab66ed2890c7236db8ff49cde909f24f5d92a (patch) | |
tree | 7c6317d448265799e0216b46fca13d6c923faba5 /yardstick/benchmark/core/report.py | |
parent | 498fcc39a9f948f6911157c5cba27986e3f78208 (diff) |
benchmark.core.report: Add _combine_times
_combine_times() combines and interleves separate lists of
timestamps.
This will allow the Yardstick and Barometer timestamps to
be combined for the dynamic HTML report created with
``yardstick report generate-nsb`` command.
JIRA: YARDSTICK-1593
Change-Id: I0f5ea4d001775495fb9b9b4de2d2360c9c61cc51
Signed-off-by: Emma Foley <emma.l.foley@intel.com>
Diffstat (limited to 'yardstick/benchmark/core/report.py')
-rw-r--r-- | yardstick/benchmark/core/report.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/yardstick/benchmark/core/report.py b/yardstick/benchmark/core/report.py index 3d5912471..587c85a14 100644 --- a/yardstick/benchmark/core/report.py +++ b/yardstick/benchmark/core/report.py @@ -305,6 +305,37 @@ class Report(object): print("Report generated. View %s" % consts.DEFAULT_HTML_FILE) + def _combine_times(self, *args): + times = [] + # Combines an arbitrary number of lists + [times.extend(x) for x in args] + times = list(set(times)) + times.sort() + return times + + def _combine_metrics(self, *args): + baro_data, baro_time, yard_data, yard_time = args + combo_time = self._combine_times(baro_time, yard_time) + + data = {} + [data.update(x) for x in (baro_data, yard_data)] + + table_data = {} + table_data['Timestamp'] = combo_time + combo = {} + keys = sorted(data.keys()) + for met_name in data: + dataset = [] + for point in data[met_name]: + dataset.append({'x': point, 'y': data[met_name][point]}) + # the metrics need to be ordered by time + combo[met_name] = sorted(dataset, key=lambda i: i['x']) + for met_name in data: + table_data[met_name] = [] + for t in combo_time: + table_data[met_name].append(data[met_name].get(t, '')) + return combo, keys, table_data + @cliargs("task_id", type=str, help=" task id", nargs=1) @cliargs("yaml_name", type=str, help=" Yaml file Name", nargs=1) def generate_nsb(self, args): |