예제 #1
0
    def __init__(self,
                 exp_id,
                 exp_name,
                 tasks,
                 sampled_data_retrievers=None,
                 **kwargs):
        """ Create an Experiment

            Args:
            exp_id:
            exp_name:
            task: tuple. Contains various Task for Marionette to perform
            sampled_data_retrievers: tuple. Contains various SampledDataRetriever
            Kwargs:
                duration: int. Default 60. # of seconds for Intel Power Gadget (IPG) to run.
            Return:
                Experiment
        """
        super(Experiment, self).__init__(exp_id, exp_name, **kwargs)
        clear_exp_dir = kwargs.get('clear_exp_dir', True)
        self.__perf_counters = None
        self.__results = []
        self.__tasks = tasks
        # self.__ff_process = None
        self.__ff_exe_path = kwargs.get('ff_exe_path',
                                        self.get_ff_default_path())
        self.__ipg = None
        # ensure the experiment results directory exists and is cleaned out
        make_dir(self.exp_dir_path, clear=clear_exp_dir)
        self.duration = kwargs.get('duration', 60)
        self.start_time = None
        self.sampled_data_retrievers = sampled_data_retrievers or (
            PerformanceCounterRetriever(), )
예제 #2
0
exp_id = 8


class TasksTest(Tasks):
    @property
    def tasks(self):
        tasks = [
            Task('time.sleep(300)', self.client, meta={'website': 'HOME'}),
            # go to Mozilla.org
            Task("self.client.navigate('https://slate.com')",
                 self.client,
                 meta={'website': 'https://slate.com/'}),
            # wait for 2 minutes
            Task('time.sleep(600)', self.client, meta={'website': 'HOME'}),
        ]
        return tasks


""" DON'T MODIFY THE BELOW!!!!"""

exp_name = path.splitext(path.basename(__file__))[0]
sampled_data_retrievers = (PerformanceCounterRetriever(),
                           PsutilDataRetriever())
exp = Experiment(exp_id=exp_id,
                 exp_name=exp_name,
                 tasks=TasksTest(),
                 duration=960,
                 sampled_data_retrievers=sampled_data_retrievers)
exp.run()
예제 #3
0
from energy_consumption.experiment import Experiment, Tasks, Task
from energy_consumption.helpers.io_helpers import log_to_stdout
from energy_consumption.data_streams.sampled_data import PerformanceCounterRetriever, PsutilDataRetriever


logger = logging.getLogger()
logger.setLevel(logging.INFO)
log_to_stdout(logger, level=logging.INFO)

exp_id = 7


class TasksTest(Tasks):
    @property
    def tasks(self):
        tasks = [
            # wait for 2 minutes
            Task('time.sleep(900)', self.client, meta={'website': 'HOME'}),
        ]
        return tasks


""" DON'T MODIFY THE BELOW!!!!"""

exp_name = path.splitext(path.basename(__file__))[0]
sampled_data_retrievers = (PerformanceCounterRetriever(), PsutilDataRetriever())
exp = Experiment(exp_id=exp_id, exp_name=exp_name, tasks=TasksTest(), duration=960,
                 sampled_data_retrievers=sampled_data_retrievers)

exp.run()