Пример #1
0
def run_simulation_scenario(t, a, c, s):
    """Run a single simulation scenario with given topology, alpha, cache size
    and strategy
    """
    use_events_file = config.USE_EVENTS_FILE
    n_contents = config.N_CONTENTS
    scenarios_dir = config.SCENARIOS_DIR
    topo_prefix = config.TOPO_PREFIX
    es_prefix = config.ES_PREFIX
    
    topo_file = path.join(scenarios_dir, topo_prefix + 'T=%s@C=%s.xml' % (t, str(c)))
    scenario_id = 'T=%s@C=%s@A=%s@S=%s' % (t, str(c), str(a), s)
    topo = read_topology(topo_file)
    if use_events_file:
        es_file = path.join(scenarios_dir, es_prefix + 'T=%s@A=%s.xml' % (t, str(a)))
        es = read_event_schedule(es_file)
    else:
        es = req_generator(topo, n_contents, a)
    run(topo, es, scenario_id, s)