From bf06b93a9d3deef590c5aba111fca5843f2182cf Mon Sep 17 00:00:00 2001 From: Valentin Schneider Date: Mon, 4 Dec 2017 17:14:51 +0000 Subject: [PATCH 1/6] tests/eas/generic: Clean up imports Removes a duplicate import and re-arranges the order of the imports. --- tests/eas/generic.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/tests/eas/generic.py b/tests/eas/generic.py index da9aa9742..d1d66ce23 100644 --- a/tests/eas/generic.py +++ b/tests/eas/generic.py @@ -15,23 +15,21 @@ # limitations under the License. # -from math import isnan - +import os import numpy as np import pandas as pd +import matplotlib.pyplot as plt +import pylab as pl -from bart.common.Utils import area_under_curve +from math import isnan -from energy_model import EnergyModel, EnergyModelCapacityError -from perf_analysis import PerfAnalysis from test import LisaTest, experiment_test -from trace import Trace from unittest import SkipTest +from trace import Trace -import matplotlib.pyplot as plt -import numpy as np -import pylab as pl -import os +from bart.common.Utils import area_under_curve +from energy_model import EnergyModel, EnergyModelCapacityError +from perf_analysis import PerfAnalysis WORKLOAD_PERIOD_MS = 16 SET_IS_BIG_LITTLE = True -- GitLab From e89a45c3af09d3236c4f6547e7b8c04d0414261e Mon Sep 17 00:00:00 2001 From: Valentin Schneider Date: Mon, 4 Dec 2017 17:15:34 +0000 Subject: [PATCH 2/6] tests/eas/generic: Add expected_placement plot title --- tests/eas/generic.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/eas/generic.py b/tests/eas/generic.py index d1d66ce23..524578507 100644 --- a/tests/eas/generic.py +++ b/tests/eas/generic.py @@ -285,7 +285,9 @@ class _EnergyModelTest(LisaTest): nrg_model = self.te.nrg_model trace = self.get_trace(experiment) + fig, ax = plt.subplots(len(nrg_model.cpus), 1, figsize=(16, 1.8 * len(nrg_model.cpus))) + fig.suptitle('Per-CPU expected utilization') # Check if big.LITTLE data is available for a more detailled plot if trace.has_big_little: @@ -305,7 +307,7 @@ class _EnergyModelTest(LisaTest): tdf.plot(ax=ax[cpu], drawstyle='steps-post', title="CPU{}".format(cpu), color=color) ax[cpu].fill_between(tdf.index, tdf, 0, step='post', color=color) - ax[cpu].set_ylabel('Expected utilization') + ax[cpu].set_ylabel('Utilization') # Grey-out areas where utilization == 0 ffill = False -- GitLab From 2bb032457fe3ed36131a7abbcdedecf946ae56e0 Mon Sep 17 00:00:00 2001 From: Valentin Schneider Date: Fri, 8 Dec 2017 14:06:24 +0000 Subject: [PATCH 3/6] tests/eas/generic: Close exp_placement figure It seems like closing unused figures isn't a default behaviour, and we are getting some warning about that. --- tests/eas/generic.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/eas/generic.py b/tests/eas/generic.py index 524578507..fc5542207 100644 --- a/tests/eas/generic.py +++ b/tests/eas/generic.py @@ -323,6 +323,7 @@ class _EnergyModelTest(LisaTest): figname = os.path.join(experiment.out_dir, 'expected_placement.png') pl.savefig(figname, bbox_inches='tight') + plt.close() def _test_slack(self, experiment, tasks): """ -- GitLab From 9b5deba66510df3a4858e38ec9fc0a8228451829 Mon Sep 17 00:00:00 2001 From: Valentin Schneider Date: Wed, 13 Dec 2017 17:48:42 +0000 Subject: [PATCH 4/6] tests/eas/generic: Fix matplotlib import tests/eas/ was missing an __init__.py, which meant the backend set in tests/__init__.py wouldn't be used. This commit also removes the fill_between() call that is used to draw the expected_placement figure, as it seems the desired behaviour is not supported with the Agg backend ("Unknown property step"). --- tests/eas/__init__.py | 0 tests/eas/generic.py | 1 - 2 files changed, 1 deletion(-) create mode 100644 tests/eas/__init__.py diff --git a/tests/eas/__init__.py b/tests/eas/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/eas/generic.py b/tests/eas/generic.py index fc5542207..252b79162 100644 --- a/tests/eas/generic.py +++ b/tests/eas/generic.py @@ -306,7 +306,6 @@ class _EnergyModelTest(LisaTest): color = 'red' tdf.plot(ax=ax[cpu], drawstyle='steps-post', title="CPU{}".format(cpu), color=color) - ax[cpu].fill_between(tdf.index, tdf, 0, step='post', color=color) ax[cpu].set_ylabel('Utilization') # Grey-out areas where utilization == 0 -- GitLab From 22cce6620e51399bf5c75a3838ba40db8bd14666 Mon Sep 17 00:00:00 2001 From: Valentin Schneider Date: Wed, 13 Dec 2017 15:38:05 +0000 Subject: [PATCH 5/6] utils/env: Reinstore use of target.conf workdir Seems like the use of `self.workdir` got thrown away at some point. This commit reconnects it to the devlib target constructor, and also gets rid of the `WORKING_DIR_DEFAULT` definition since devlib already defines default workdirs for its targets. --- libs/utils/env.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libs/utils/env.py b/libs/utils/env.py index 42b8d9d91..4a845fb99 100644 --- a/libs/utils/env.py +++ b/libs/utils/env.py @@ -40,7 +40,6 @@ from platforms.pixel_energy import pixel_energy USERNAME_DEFAULT = 'root' PASSWORD_DEFAULT = '' -WORKING_DIR_DEFAULT = '/data/local/schedtest' FTRACE_EVENTS_DEFAULT = ['sched:*'] FTRACE_BUFSIZE_DEFAULT = 10240 OUT_PREFIX = 'results' @@ -164,7 +163,7 @@ class TestEnv(ShareState): self.test_conf = {} self.target = None self.ftrace = None - self.workdir = WORKING_DIR_DEFAULT + self.workdir = None self.__installed_tools = set() self.__modules = [] self.__connection_settings = None @@ -518,6 +517,7 @@ class TestEnv(ShareState): self.target = devlib.LinuxTarget( platform = platform, connection_settings = self.__connection_settings, + working_directory = self.workdir, load_default_modules = False, modules = self.__modules) elif platform_type.lower() == 'android': @@ -525,12 +525,14 @@ class TestEnv(ShareState): self.target = devlib.AndroidTarget( platform = platform, connection_settings = self.__connection_settings, + working_directory = self.workdir, load_default_modules = False, modules = self.__modules) elif platform_type.lower() == 'host': self._log.debug('Setup HOST target...') self.target = devlib.LocalLinuxTarget( platform = platform, + working_directory = self.workdir, load_default_modules = False, modules = self.__modules, connection_settings = {'unrooted': True}) -- GitLab From c21eacc1764db668d75f094666855dd94a9d2a52 Mon Sep 17 00:00:00 2001 From: Valentin Schneider Date: Thu, 14 Dec 2017 11:08:50 +0000 Subject: [PATCH 6/6] utils/env: Reinstore old AndroidTarget working directory As mentionned in ARM-software/devlib#225, using /sdcard causes some issues with the HiKey960. As we haven't had any issues with using /data/local/tmp/ as a devlib working directory, we now the use this directory by default. --- libs/utils/env.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libs/utils/env.py b/libs/utils/env.py index 4a845fb99..013f44f99 100644 --- a/libs/utils/env.py +++ b/libs/utils/env.py @@ -489,6 +489,11 @@ class TestEnv(ShareState): if platform_type.lower() == 'android': self.__connection_settings = None device = 'DEFAULT' + + # Workaround for ARM-software/devlib#225 + if not self.workdir: + self.workdir = '/data/local/tmp/devlib-target' + if 'device' in self.conf: device = self.conf['device'] self.__connection_settings = {'device' : device} -- GitLab