Example #1
0
def register_record(name, id, method, fmt, fields):
    '''Create record description from @fmt and @fields and map to @id, using
    @method to process parsed record.'''
    # Format of binary data (see python struct documentation)
    rec_fmt = HEADER_FORMAT + fmt

    # Corresponding field data
    rec_fields = HEADER_FIELDS + fields
    if "when" not in rec_fields: # Force a "when" field for everything
        rec_fields += ["when"]

    # Create mutable class with the given fields
    field_class = recordtype(name, list(rec_fields))
    clazz = type(name, (field_class, object), {})

    record_map[id] = RecordInfo(clazz, rec_fmt, method)
    'exp-heavy'     : rv.exponential(0, 1, 0.50),

    'bimo-light'    : rv.multimodal([(rv.uniform(0.001, 0.5), 8),
                                     (rv.uniform(  0.5, 0.9), 1)]),
    'bimo-medium'   : rv.multimodal([(rv.uniform(0.001, 0.5), 6),
                                     (rv.uniform(  0.5, 0.9), 3)]),
    'bimo-heavy'    : rv.multimodal([(rv.uniform(0.001, 0.5), 4),
                                     (rv.uniform(  0.5, 0.9), 5)]),
}

'''Components of Cheetah template for schedule file'''
TP_RM = """#if $release_master
release_master{0}
#end if"""

GenOptionT = recordtype('GenOption', ['name', 'types', 'default', 'help', 'hidden'])
def GenOption(name, types, default, help, hidden = False):
    return GenOptionT(name, types, default, help, hidden)

class Generator(object):
    '''Creates all combinations @options specified by @params.

    This class also performs checks of parameter values and prints out help.
    All subclasses must implement _create_exp.
    '''
    def __init__(self, scheduler, templates, options, params):
        self.options = self.__make_options(params) + options

        self.__setup_params(params)

        self.params    = params
Example #3
0
    rv.exponential(0, 1, 0.50),
    'bimo-light':
    rv.multimodal([(rv.uniform(0.001, 0.5), 8), (rv.uniform(0.5, 0.9), 1)]),
    'bimo-medium':
    rv.multimodal([(rv.uniform(0.001, 0.5), 6), (rv.uniform(0.5, 0.9), 3)]),
    'bimo-heavy':
    rv.multimodal([(rv.uniform(0.001, 0.5), 4), (rv.uniform(0.5, 0.9), 5)]),
    'bimo-hheavy':
    rv.multimodal([(rv.uniform(0.1, 0.5), 3), (rv.uniform(0.5, 0.9), 6)]),
}
'''Components of Cheetah template for schedule file'''
TP_RM = """#if $release_master
release_master{0}
#end if"""

GenOptionT = recordtype('GenOption',
                        ['name', 'types', 'default', 'help', 'hidden'])


def GenOption(name, types, default, help, hidden=False):
    return GenOptionT(name, types, default, help, hidden)


class Generator(object):
    '''Creates all combinations @options specified by @params.

    This class also performs checks of parameter values and prints out help.
    All subclasses must implement _create_exp.
    '''
    def __init__(self, scheduler, templates, options, params):
        self.options = self.__make_options(params) + options
Example #4
0
        else:
            self.disjoints += 1

    def start_time(self, record, time = None):
        '''Start duration of time.'''
        if self.last_record:
            if not time:
                self.begin = self.last_record.when
            else:
                self.begin = time

        self.next_job = record.job

# Data stored for each task
TaskParams = namedtuple('TaskParams',  ['wcet', 'period', 'cpu'])
TaskData   = recordtype('TaskData',    ['params', 'jobs', 'blocks', 'misses'])

# Map of event ids to corresponding class and format
record_map = {}

RECORD_SIZE   = 24
NSEC_PER_MSEC = 1000000

def bits_to_bytes(bits):
    '''Includes padding'''
    return bits / 8 + (1 if bits%8 else 0)

def field_bytes(fields):
    fbytes = 0
    fbits  = 0
    for f in fields:
Example #5
0
from config.config import PARAMS, DEFAULTS, FILES
from collections import namedtuple
from optparse import OptionParser, OptionGroup
from parse.enum import Enum
from run.executable.executable import Executable
from run.experiment import Experiment, ExperimentDone, SystemCorrupted
from run.proc_entry import ProcEntry
'''Customizable experiment parameters'''
ExpParams = namedtuple('ExpParams', [
    'scheduler', 'duration', 'tracers', 'kernel', 'config_options',
    'file_params', 'pre_script', 'post_script'
])
'''Tracked with each experiment'''
ExpState = Enum(['Failed', 'Succeeded', 'Invalid', 'Done', 'None'])
ExpData = com.recordtype(
    'ExpData', ['name', 'params', 'sched_file', 'out_dir', 'retries', 'state'])
'''Comparison of requested versus actual kernel compile parameter value'''
ConfigResult = namedtuple('ConfigResult', ['param', 'wanted', 'actual'])
'''Maximum times an experiment will be retried'''
MAX_RETRY = 5
'''Location experiment retry count is stored'''
TRIES_FNAME = ".tries.pkl"


class InvalidKernel(Exception):
    def __init__(self, kernel):
        self.kernel = kernel

    def __str__(self):
        return "Kernel name does not match '%s'." % self.kernel
Example #6
0
from config.config import PARAMS,DEFAULTS,FILES,BINS
from collections import namedtuple
from optparse import OptionParser,OptionGroup
from parse.enum import Enum
from run.executable.executable import Executable
from run.experiment import Experiment,ExperimentDone,SystemCorrupted
from run.proc_entry import ProcEntry

'''Customizable experiment parameters'''
ExpParams = namedtuple('ExpParams', ['scheduler', 'duration', 'tracers',
                                     'kernel', 'config_options', 'file_params',
                                     'pre_script', 'post_script'])
'''Tracked with each experiment'''
ExpState = Enum(['Failed', 'Succeeded', 'Invalid', 'Done', 'None'])
ExpData  = com.recordtype('ExpData', ['name', 'params', 'sched_file', 'out_dir',
                                      'retries', 'state'])
'''Comparison of requested versus actual kernel compile parameter value'''
ConfigResult = namedtuple('ConfigResult', ['param', 'wanted', 'actual'])

'''Maximum times an experiment will be retried'''
MAX_RETRY = 5
'''Location experiment retry count is stored'''
TRIES_FNAME = ".tries.pkl"


class InvalidKernel(Exception):
    def __init__(self, kernel):
        self.kernel = kernel

    def __str__(self):
        return "Kernel name does not match '%s'." % self.kernel