diff --git a/libs/utils/env.py b/libs/utils/env.py index 06d465813710dbd40e61cdebeafc3731982c4f87..ede1e5838e169d58b1a1ab63a5c029f7bf4a7528 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 diff --git a/libs/utils/trace.py b/libs/utils/trace.py index e7326d01913d081d34197e4f4073c7ec1152ade2..1df6cc98a8e1c3d5a954b8e1d7903b715901b228 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() diff --git a/libs/utils/trace_analysis.py b/libs/utils/trace_analysis.py index d3ea1fa1251085baff8985823a1acc6ea82191b3..07adadd8a47a9fc26017707959fd4f477d0f6339 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); diff --git a/tests/eas/rfc.py b/tests/eas/rfc.py index 03e726c1760ceac63977127d1490c5c6ad16aceb..6695cc55c6d6ee0d7fea15cac396288b3bd036d9 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