Ejemplo n.º 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)
Ejemplo n.º 2
0
def __write_profile(name, ts, frequency, overwrite=True):
    # Check if the profile exists
    if len(tc.connection().find(name)) > 0:
        # Double check if it is allowed to overwrite profiles in Times
        if overwrite:
            tc.connection().remove(name)
        else:
            print 'WARNING - will not overwrite profile %s' % name
            return
        
    # Create a new ts
    print '    writing profile handles %s' % (name)
    tc.connection().create(name, frequency)
    
    # Crete elements array
    elements = []
    for i in xrange(len(ts)):
        item = ts[i]
        
        element = ttypes.Element()
        element.timestamp = i * frequency
        element.value = item 
        elements.append(element)

    # Append elements to ts
    tc.connection().append(name, elements)
Ejemplo n.º 3
0
def __build_sampleday(mix, handles):
    # Build profiles from sample days
    for handle in handles:
        print 'processing sample day %s ...' % (handle.name)
        profile = profile_sampleday.process_trace(tc.connection(), wmeta.times_name(handle, wmeta.MUTATION_RAW),
                                                  wmeta.CYCLE_TIME, handle.htype.day)
        
        # Attach profile to handle
        handle.profile_frequency, handle.profile = profile
        
    # Max value in each set of TS
    normalizing_value = __get_normalizing_value(handles)

    # Store profiles
    for handle in handles:
        print 'storing sample day %s ...' % (handle.name)
        __store_profile_yarns(mix, handle, normalizing_value, handle.profile, handle.profile_frequency)
Ejemplo n.º 4
0
def __build_convolutions(mix, handles):
    # Build profiles by convolution
    for handle in handles:
        print 'processing convolution: %s ...' % (handle.name)
        profile = profile_convolution.process_trace(tc.connection(), wmeta.times_name(handle, wmeta.MUTATION_RAW),
                                                    wmeta.CYCLE_TIME)
        
        # Attach profile to handle
        handle.profile_frequency, handle.profile = profile
        
    # Get normalizing value for each handle type
    normalizing_value = __get_normalizing_value(handles)

    # Store profiles
    for handle in handles:
        print 'storing convolution: %s ...' % (handle.name)
        __store_profile_yarns(mix, handle, normalizing_value, handle.profile, handle.profile_frequency)
Ejemplo n.º 5
0
def createBenchmarkProfile(name, users, freq, duration):
    # Check if the profile exists
    if len(tc.connection().find(name)) > 0:
        # Double check if it is allowed to overwrite profiles in Times
        if overwrite:
            tc.connection().remove(name)
        else:
            print 'WARNING - will not overwrite profile %s' % name
            return
        
    # Create a new ts
    print '    writing profile handles %s' % (name)
    tc.connection().create(name, freq)
    
    # Crete elements array
    elements = []
    for i in xrange(duration / freq):
        element = ttypes.Element()
        element.timestamp = i * freq
        element.value = users 
        elements.append(element)

    # Append elements to ts
    tc.connection().append(name, elements)