From 394e75823323f8f4c02d8dbca465a4641f8301e2 Mon Sep 17 00:00:00 2001 From: Patrick Bellasi Date: Tue, 26 Jan 2016 09:48:07 +0000 Subject: [PATCH 1/4] libs/utils/trace_analysis: report capacity thresholds when available When an energy model if available we can add big/LITTLE capacities and TIP thresholds in the task signals plot. Signed-off-by: Patrick Bellasi --- libs/utils/trace_analysis.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/libs/utils/trace_analysis.py b/libs/utils/trace_analysis.py index d3ea1fa12..07adadd8a 100644 --- a/libs/utils/trace_analysis.py +++ b/libs/utils/trace_analysis.py @@ -286,6 +286,20 @@ class TraceAnalysis(object): data = df2[df2.comm == task_name][['boosted_util']] if len(data): data.plot(ax=axes, style=['y-'], drawstyle='steps-post'); + + # Add Capacities data if avilable + if 'nrg_model' in self.trace.platform: + nrg_model = self.trace.platform['nrg_model'] + max_lcap = nrg_model['little']['cpu']['cap_max'] + max_bcap = nrg_model['big']['cpu']['cap_max'] + tip_lcap = 0.8 * max_lcap + tip_bcap = 0.8 * max_bcap + logging.info('%d %d %d %d', tip_lcap, max_lcap, tip_bcap, max_bcap) + axes.axhline(tip_lcap, color='g', linestyle='--', linewidth=1); + axes.axhline(max_lcap, color='g', linestyle='-', linewidth=2); + axes.axhline(tip_bcap, color='r', linestyle='--', linewidth=1); + axes.axhline(max_bcap, color='r', linestyle='-', linewidth=2); + axes.set_ylim(0, 1100); axes.set_xlim(self.x_min, self.x_max); axes.grid(True); -- GitLab From bc75666eaa4d7a624e8c917a89a49ed7b8d692c5 Mon Sep 17 00:00:00 2001 From: Patrick Bellasi Date: Wed, 27 Jan 2016 09:59:42 +0000 Subject: [PATCH 2/4] tests/eas/rfc: keep track of kernel configuration and version info For each experiment configuration we generate a couple of files in the output folder which reports the kernel version string and the configuration used to build that kernel. NOTE: for a proper usage of that patch the kernel should be better build with the following options enabled: CONFIG_LOCALVERSION_AUTO CONFIG_IKCONFIG Signed-off-by: Patrick Bellasi --- tests/eas/rfc.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/eas/rfc.py b/tests/eas/rfc.py index 03e726c17..6695cc55c 100644 --- a/tests/eas/rfc.py +++ b/tests/eas/rfc.py @@ -18,6 +18,7 @@ from bart.common.Analyzer import Analyzer import collections import datetime +import gzip import json import os import re @@ -493,6 +494,15 @@ class TestBase(unittest.TestCase): os.system('mkdir -p ' + cls.env.test_dir) cls.env.platform_dump(cls.env.test_dir) + # Keep track of kernel configuration and version + config = cls.env.target.config + with gzip.open(os.path.join(cls.env.test_dir, 'kernel.config'), 'wb') as fh: + fh.write(config.text) + output = cls.env.target.execute('{} uname -a'\ + .format(cls.env.target.busybox)) + with open(os.path.join(cls.env.test_dir, 'kernel.version'), 'w') as fh: + fh.write(output) + return wload @classmethod -- GitLab From eb15932f10c0de3ace88a0876711af5d913f33b6 Mon Sep 17 00:00:00 2001 From: Patrick Bellasi Date: Wed, 3 Feb 2016 11:25:15 +0000 Subject: [PATCH 3/4] libs/utils/env: add support to specify a test results folder Currently, each time we create TestEnv object we create a new results folder which has a timestamp based name. That approach is not flexible enough when for example we want to run multiple notebooks which produces experiments for the same "test case". Moreover, sometimes could be useful to have a more meaningful name for a set of tests. This patch adds the possibility to specify an "ID" for a test configuration. This ID, when specified, is used to name a sub-folder of "results" which will contains all the output of the test. Signed-off-by: Patrick Bellasi --- libs/utils/env.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/libs/utils/env.py b/libs/utils/env.py index 06d465813..ede1e5838 100644 --- a/libs/utils/env.py +++ b/libs/utils/env.py @@ -164,16 +164,28 @@ class TestEnv(ShareState): self.calibration() # Initialize local results folder - res_dir = os.path.join(basepath, OUT_PREFIX) - self.res_dir = datetime.datetime.now()\ - .strftime(res_dir + '/%Y%m%d_%H%M%S') - os.makedirs(self.res_dir) + if self.test_conf and 'id' in self.test_conf: + res_dir = self.test_conf['id'] + if not os.path.isabs(res_dir): + res_dir = os.path.join(basepath, 'results', res_dir) + else: + res_dir = os.path.join(basepath, OUT_PREFIX) + res_dir = datetime.datetime.now()\ + .strftime(res_dir + '/%Y%m%d_%H%M%S') + self.res_dir = res_dir + if not os.path.exists(self.res_dir): + os.makedirs(self.res_dir) res_lnk = os.path.join(basepath, LATEST_LINK) if os.path.islink(res_lnk): os.remove(res_lnk) os.symlink(self.res_dir, res_lnk) + logging.info('%14s - Set results folder to:', 'TestEnv') + logging.info('%14s - %s', 'TestEnv', res_dir) + logging.info('%14s - Experiment results available also in:', 'TestEnv') + logging.info('%14s - %s', 'TestEnv', res_lnk) + self._initialized = True @staticmethod -- GitLab From a8fdc5fe3719b498318e0451f5b4cdfac1f5015e Mon Sep 17 00:00:00 2001 From: Patrick Bellasi Date: Wed, 3 Feb 2016 16:09:25 +0000 Subject: [PATCH 4/4] libs/utils/trace: add support to specify a trace window Trappy allows to limit the parsing of a trace to a window of interest. This is a convenient support to speedup the analysis big traces by focusing on just a portion of interest. This patch exposes that interface via the ctor of the Trace object. Signed-off-by: Patrick Bellasi --- libs/utils/trace.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libs/utils/trace.py b/libs/utils/trace.py index e7326d019..1df6cc98a 100644 --- a/libs/utils/trace.py +++ b/libs/utils/trace.py @@ -31,7 +31,7 @@ import logging class Trace(object): - def __init__(self, platform, datadir, events, tasks=None): + def __init__(self, platform, datadir, events, tasks=None, window=(0,None)): # The platform used to run the experiments self.platform = None @@ -45,6 +45,9 @@ class Trace(object): # TRAPpy run object self.run = None + # The time window used to limit trace parsing to + self.window = window + # Dynamically registered TRAPpy events self.trappy_cls = {} @@ -67,7 +70,7 @@ class Trace(object): self.platform = platform self.__registerTraceEvents(events) - self.__parseTrace(datadir, tasks) + self.__parseTrace(datadir, tasks, window) self.__computeTimeSpan() def __registerTraceEvents(self, events): @@ -80,10 +83,10 @@ class Trace(object): raise ValueError('Events must be a string or a list of strings') - def __parseTrace(self, datadir, tasks): + def __parseTrace(self, datadir, tasks, window): logging.debug('Loading [sched] events from trace in [%s]...', datadir) logging.debug("Parsing events: %s", self.events) - self.run = trappy.Run(datadir, scope="custom", events=self.events) + self.run = trappy.Run(datadir, scope="custom", events=self.events, window=window) # Check for events available on the parsed trace self.__checkAvailableEvents() -- GitLab