Пример #1
0
def __build_modified_profiles(mix):
    for handle in mix.handles:
        print 'processing modified profile %s ...' % (handle.name)
        
        # Load TS
        ts_name = wmeta.times_name(handle, wmeta.MUTATION_PNORM, mix)

        # Modify CPU normal profile     
        profile = profile_modifier.process_trace(tc.connection(), ts_name,
                                                            handle.modifier, handle.additive,
                                                            handle.scale, handle.shift)
        
        # Attach profile to handle
        handle.profile_frequency, handle.profile = profile
        
    # Store profiles
    for handle in mix.handles:
        profile = np.array(handle.profile)
        profile_frequency = handle.profile_frequency
        
        for size in xrange(conf_domainsize.count_domain_sizes()):
            size = conf_domainsize.get_domain_spec(size).max_user_demand()
            user_profile = (profile / 100.0) * size.users
            profile_frequency = profile_frequency / (wmeta.CYCLE_TIME / schedule_builder.EXPERIMENT_DURATION)
            user_profile = np.array(user_profile)
            user_profile += 5
            if not DRY_RUN:
                print 'storing modified profile %s ...' % (handle.name)
                __write_profile(wmeta.times_name(handle, wmeta.MUTATION_PUSER, mix), user_profile,
                                profile_frequency)
Пример #2
0
def __store_profile_yarns(mix, handle, normalizing_value, profile, profile_frequency):
    # 1) RAW profile (e.g. for plotting)
    raw_profile = np.array(profile)
    if not DRY_RUN:
        __write_profile(wmeta.times_name(handle, wmeta.MUTATION_PRAW, mix), raw_profile, profile_frequency)
    
    # 2) NORMALIZED profile (normalized with the set maximum, see above) (e.g. to feed into SSAPv)
    maxval = float(normalizing_value[handle.htype.id])
    profile /= maxval
    norm_profile = np.array(profile)
    norm_profile[norm_profile > 1] = 1
    norm_profile *= 100  # Times does not support float values
    if not DRY_RUN:
        __write_profile(wmeta.times_name(handle, wmeta.MUTATION_PNORM, mix), norm_profile, profile_frequency)
    
    # 3) Store USER profiles (-> e.g. for Rain workload driver)
    
    for size in xrange(conf_domainsize.count_domain_sizes()):
        size = conf_domainsize.get_domain_spec(size).max_user_demand()
        user_profile = profile * size.users
        user_profile = np.array(user_profile)
        user_profile += 5
        user_profile_frequency = profile_frequency / (wmeta.CYCLE_TIME / schedule_builder.EXPERIMENT_DURATION)
        user_profile_name = wmeta.times_name(handle, wmeta.MUTATION_PUSER, mix, size)
        print 'FREQ - USER YARN: %s @ %f' % (user_profile_name, user_profile_frequency)
        if not DRY_RUN:
            __write_profile(user_profile_name, user_profile, user_profile_frequency)
Пример #3
0
    def __init__(self, model, pump, placement_strategy):
        # Model references
        self.model = model
        self.pump = pump
        
        # Placement strategy
        self.placement = placement_strategy

        # Available domains sorted by their size        
        self.available = []
        for s in xrange(conf_domainsize.count_domain_sizes()):
            self.available.append(conf_domains.get_available_domains_by_size(s))
                     
        # Wasted lists
        self.wasted = []
                               
        # List of lists that hold all online domains
        self.online = [] 
Пример #4
0
def plot_all():
    print 'Total profiles: %i' % load.count()
    
    # For each workload profile available
    for i in xrange(load.count()):
        # For all domain sizes configured
        for s in xrange(conf_domainsize.count_domain_sizes()):
            # Load user profile
            ts = load.get_user_profile(i, s)[1]
            #ts = load.get_cpu_profile(i, s)[1]
            
            # Create figure
            fig = plt.figure()
            subplot = fig.add_subplot(111)
            subplot.set_ylim(ymax=100, ymin=0)
            subplot.plot(range(len(ts)), ts)
            
            # Path and save 
            path = configuration.path('%s_%i_%i' % (conf_load.TIMES_SELECTED_MIX.name, i, s),'png') 
            print path
            plt.savefig(path)