From a62925c0f3888a804fa123d2f7d57804e8dc4b23 Mon Sep 17 00:00:00 2001 From: Chris Redpath Date: Mon, 22 Jan 2018 17:55:04 +0000 Subject: [PATCH] wltests/wa_results_collector: Add composite energy for Monsoon results Ideally, one would rewrite the monsoon devlib instrument to provide the data in a form which allows the DerivedEnergyMeasurement class to give summed energy & power values. However, the monsoon python driver does not appear to be written in such a way that this could be done easily. For the time being, lets make our own combosite measurement here if it not supplied by Devlib and we have the known monsoon EM channels. Signed-off-by: Chris Redpath --- libs/utils/wa_results_collector.py | 31 ++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/libs/utils/wa_results_collector.py b/libs/utils/wa_results_collector.py index fbb035ca2..2261a8549 100644 --- a/libs/utils/wa_results_collector.py +++ b/libs/utils/wa_results_collector.py @@ -213,6 +213,37 @@ class WaResultsCollector(object): # results.csv contains all the metrics reported by WA for all jobs. df = pd.read_csv(os.path.join(wa_dir, 'results.csv')) + # When using Monsoon, the device is a single channel which reports + # two metrics. This means that devlib's DerivedEnergymeasurements class + # cannot see the output. Due to the way that the monsoon.py script + # works, it looks difficult to change Monsoon over to the Acme way of + # operating. As a workaround, let's mangle the results here instead. + unique_metrics = df['metric'].unique() + if 'device_total_energy' not in unique_metrics: + # potentially, we need to assemble a device_total_energy from + # other energy values we can add together. + if 'output_total_energy' in unique_metrics and 'USB_total_energy' in unique_metrics: + new_rows = [] + output_df = df[df['metric'] == 'output_total_energy'] + usb_df = df[df['metric'] == 'USB_total_energy'] + # for each 'output_total_energy' metric, we will find + # the matching 'USB_total_energy' metric and assemble + # a 'device_total_energy' metric by adding them. + for row in output_df.iterrows(): + vals = row[1] + _id = vals['id'] + _workload = vals['workload'] + _iteration = vals['iteration'] + _value = vals['value'] + usb_row = usb_df[(usb_df['workload'] == _workload) & (usb_df['id'] == _id) & (usb_df['iteration'] == _iteration)] + new_val = float(_value) + float(usb_row['value']) + # instead of creating a new row, just change the name + # and value of this one + vals['metric'] = 'device_total_energy' + vals['value'] = new_val + new_rows.append(vals) + # add all the new rows in one go at the end + df = df.append(new_rows, ignore_index=True) # __meta/jobs.json describes the jobs that were run - we can use this to # find extra artifacts (like traces and detailed energy measurement -- GitLab