Esempio n. 1
0
def output_latency_stats(output_dir):
    """Output all statistics"""
    # older code: output read, write, overall stats
    output_stats(latencies, os.path.join(output_dir, 'all'))
    output_stats(read_latencies, os.path.join(output_dir, 'read'))
    output_stats(write_latencies, os.path.join(output_dir, 'write'))
    
    # output all tuples in a file, used in group-by-name, group-by-time script.
    write_tuple_array(all_tuples, os.path.join(output_dir,'all_tuples.txt'), p = True)
    
    # output ping latencies
    write_tuple_array(get_cdf(ping_latencies), os.path.join(output_dir,'ping_latency.txt'), p = True)
    
    # output closest NS latencies
    write_tuple_array(get_cdf(closest_ns_latencies), os.path.join(output_dir,'closest_ns_latency.txt'), p = True)
    
    # output mean and median query latencies ove time during the experiment.
    #output_by_time(output_dir, 'latency_by_time.txt')
    
    # output start and end times
    #get_start_end_times(all_tuples, os.path.join(output_dir,'start_end_times.txt'))
    
    # output key stats : mean-latency, median-write-latency-etc.
    latency_tuples = get_latency_stats_tuples(latencies, read_latencies, write_latencies, ping_latencies)
    write_tuple_array(latency_tuples, os.path.join(output_dir,'latency_stats.txt'), p = True)
    os.system('cat ' + os.path.join(output_dir,'latency_stats.txt'))
    
    # experiment summary stats:
    write_tuple_array(get_summary_stats(), output_dir + '/summary.txt', p = True)
    os.system('cat ' + output_dir + '/summary.txt')
    
    # results for this folder.
    plot(output_dir)
Esempio n. 2
0
def output_latency_stats(output_dir):
    """Output all statistics"""
    # output all tuples in a file, used in group-by-name, group-by-time script.
    write_tuple_array(all_tuples, os.path.join(output_dir,'all_tuples.txt'), p = True)
    
    # older code: output read, write, overall stats
    output_stats(latencies, os.path.join(output_dir, 'all'))
    output_stats(read_latencies, os.path.join(output_dir, 'read'))
    output_stats(write_latencies, os.path.join(output_dir, 'write'))
    
    
    # output ping latencies
    write_tuple_array(get_cdf(ping_latencies), os.path.join(output_dir,'ping_latency.txt'), p = True)
    
    # output closest NS latencies
    write_tuple_array(get_cdf(closest_ns_latencies), os.path.join(output_dir,'closest_ns_latency.txt'), p = True)
    
    # output mean and median query latencies ove time during the experiment.
    #output_by_time(output_dir, 'latency_by_time.txt')
    
    # output start and end times
    get_start_end_times(all_tuples, os.path.join(output_dir,'start_end_times.txt'))
    
    # output key stats : mean-latency, median-write-latency-etc.
    latency_tuples = get_latency_stats_tuples(latencies, read_latencies, write_latencies, ping_latencies)
    write_tuple_array(latency_tuples, os.path.join(output_dir,'latency_stats.txt'), p = True)
    os.system('cat ' + os.path.join(output_dir,'latency_stats.txt'))
    
    # experiment summary stats:
    write_tuple_array(get_summary_stats(), output_dir + '/summary.txt', p = True)
    os.system('cat ' + output_dir + '/summary.txt')
    
    # results for this folder.
    plot(output_dir)
Esempio n. 3
0
def output_latency_stats(output_dir):
    """Output all statistics"""
    # older code: output read, write, overall stats
    output_stats(latencies, os.path.join(output_dir, 'all'))
    output_stats(read_latencies, os.path.join(output_dir, 'read'))
    output_stats(write_latencies, os.path.join(output_dir, 'write'))
    output_stats(add_latencies, os.path.join(output_dir, 'add'))
    output_stats(remove_latencies, os.path.join(output_dir, 'remove'))
    output_stats(group_change_latencies, os.path.join(output_dir, 'group_change'))

    # output all tuples in a file, used in group-by-name, group-by-time script.
    write_tuple_array(all_tuples, os.path.join(output_dir, 'all_tuples.txt'), p=True)

    # output ping latencies
    write_tuple_array(get_cdf(ping_latencies), os.path.join(output_dir, 'ping_latency.txt'), p=True)

    # output closest NS latencies
    write_tuple_array(get_cdf(closest_ns_latencies), os.path.join(output_dir, 'closest_ns_latency.txt'), p=True)

    # output mean and median query latencies ove time during the experiment.
    from output_by_time import output_by_time
    output_by_time(output_dir, 'latency_by_time.txt')

    # output start and end times
    #get_start_end_times(all_tuples, os.path.join(output_dir,'start_end_times.txt'))

    # output key stats : mean-latency, median-write-latency-etc.
    latency_tuples = get_latency_stats_tuples()
    # latencies, read_latencies, write_latencies, add_latencies,
    #                                           remove_latencies, ping_latencies
    write_tuple_array(latency_tuples, os.path.join(output_dir, 'latency_stats.txt'), p=True)
    os.system('cat ' + os.path.join(output_dir, 'latency_stats.txt'))

    # experiment summary stats:
    write_tuple_array(get_summary_stats(), output_dir + '/summary.txt', p=True)
    os.system('cat ' + output_dir + '/summary.txt')

    # plot results for this experiment.
    plot(output_dir)

    if len(time_to_connect_values) > 0:
        time_to_connect_stats = get_stat_in_tuples(time_to_connect_values, 'time_to_connect')
        timeout_value = 5000
        timeout_count = 0
        for t in time_to_connect_values:
            if t > timeout_value:
                timeout_count += 1
        fraction_timeout = timeout_count*1.0/len(time_to_connect_values)
        time_to_connect_stats.append(['fraction-timeouts', fraction_timeout])

        write_tuple_array(time_to_connect_stats, os.path.join(output_dir, 'time_to_connect.txt'), p=True)
        os.system('cat ' + os.path.join(output_dir, 'time_to_connect.txt'))
def plot_groupchange_latency(folder):
    search_terms = ['GroupChangeDuration','OldActiveStopDuration']
    latency_index = 4
    stats_folder = get_stats_folder(folder)
    os.system('mkdir -p ' + stats_folder)
    for term in search_terms:
        file_output = os.path.join(stats_folder,term)
        os.system('grep ' + term + ' ' + folder + '/*/*/* > ' + file_output)
        from read_array_from_file import read_col_from_file2
        values = read_col_from_file2(file_output, 4)
        temp = [float(v) for v in values]
        values = temp
        from stats import get_cdf
        cdf_values = get_cdf(values)
        cdf_file = file_output + '_cdf'
        from write_array_to_file import write_tuple_array
        write_tuple_array(cdf_values, cdf_file, p = True)
        os.system('cp ' + cdf_file + ' .')

    try:
        os.system('gnuplot ' + gnuplot_file)
        os.system('mv groupchange_cdf.pdf ' + stats_folder)
    except:
        print 'ERROR: gnuplot error'
    os.system('rm GroupChangeDuration_cdf OldActiveStopDuration_cdf')
Esempio n. 5
0
def plot_groupchange_latency(folder):
    search_terms = ['GroupChangeDuration', 'OldActiveStopDuration']
    latency_index = 4
    stats_folder = get_stats_folder(folder)
    os.system('mkdir -p ' + stats_folder)
    for term in search_terms:
        file_output = os.path.join(stats_folder, term)
        os.system('grep ' + term + ' ' + folder + '/*/*/* > ' + file_output)
        from read_array_from_file import read_col_from_file2
        values = read_col_from_file2(file_output, 4)
        temp = [float(v) for v in values]
        values = temp
        from stats import get_cdf
        cdf_values = get_cdf(values)
        cdf_file = file_output + '_cdf'
        from write_array_to_file import write_tuple_array
        write_tuple_array(cdf_values, cdf_file, p=True)
        os.system('cp ' + cdf_file + ' .')

    try:
        os.system('gnuplot ' + gnuplot_file)
        os.system('mv groupchange_cdf.pdf ' + stats_folder)
    except:
        print 'ERROR: gnuplot error'
    os.system('rm GroupChangeDuration_cdf OldActiveStopDuration_cdf')
def generate_data_for_log_folder(log_folder, ping_file):

    urp_output_file = log_folder + '/URP'
    referenceTS_output_file = log_folder + '/ReferenceTS'
    os.system('grep URP ' + log_folder + '/*/log/* > ' + urp_output_file)
    os.system('grep ReferenceTS ' + log_folder + '/*/log/* > ' + referenceTS_output_file)
    os.system('wc -l ' + referenceTS_output_file)
    os.system('wc -l ' + urp_output_file)
    node_offset = calculate_timestamps(referenceTS_output_file, ping_file)
    client, majority, last = compute_latencies(urp_output_file, node_offset)

    from stats import get_cdf
    client_cdf = get_cdf(client)
    majority_cdf = get_cdf(majority)
    last_cdf = get_cdf(last)
    indir, outdir = get_indir_outdir(log_folder)

    from write_array_to_file import write_tuple_array
    write_tuple_array(client_cdf, os.path.join(outdir, 'client_write_cdf.txt'))
    write_tuple_array(majority_cdf, os.path.join(outdir, 'majority_write_cdf.txt'))
    write_tuple_array(last_cdf, os.path.join(outdir, 'last_write_cdf.txt'))
Esempio n. 7
0
def generate_data_for_log_folder(log_folder, ping_file):

    urp_output_file = log_folder + '/URP'
    referenceTS_output_file = log_folder + '/ReferenceTS'
    os.system('grep URP ' + log_folder + '/*/log/* > ' + urp_output_file)
    os.system('grep ReferenceTS ' + log_folder + '/*/log/* > ' +
              referenceTS_output_file)
    os.system('wc -l ' + referenceTS_output_file)
    os.system('wc -l ' + urp_output_file)
    node_offset = calculate_timestamps(referenceTS_output_file, ping_file)
    client, majority, last = compute_latencies(urp_output_file, node_offset)

    from stats import get_cdf
    client_cdf = get_cdf(client)
    majority_cdf = get_cdf(majority)
    last_cdf = get_cdf(last)
    indir, outdir = get_indir_outdir(log_folder)

    from write_array_to_file import write_tuple_array
    write_tuple_array(client_cdf, os.path.join(outdir, 'client_write_cdf.txt'))
    write_tuple_array(majority_cdf,
                      os.path.join(outdir, 'majority_write_cdf.txt'))
    write_tuple_array(last_cdf, os.path.join(outdir, 'last_write_cdf.txt'))
Esempio n. 8
0
def main():
    files = os.listdir(sys.argv[1])
    latencies = []
    for filename in files:
        array_values = read_array_from_file(os.path.join(
            sys.argv[1], filename))
        values = [float(t[3]) for t in array_values]
        from stats import get_stats_with_names
        stats = get_stats_with_names(values)
        print filename, stats['median'], '\t', stats['minimum']
        latencies.append(stats['median'])
    from stats import get_cdf
    cdf2 = get_cdf(latencies)
    from write_array_to_file import write_tuple_array
    write_tuple_array(cdf2, 'ultradns')
Esempio n. 9
0
def main():
    files = os.listdir(sys.argv[1])
    latencies = []
    for filename in files:
        array_values = read_array_from_file(os.path.join(sys.argv[1], filename))
        values = [float(t[3]) for t in array_values]
        from stats import get_stats_with_names

        stats = get_stats_with_names(values)
        print filename, stats["median"], "\t", stats["minimum"]
        latencies.append(stats["median"])
    from stats import get_cdf

    cdf2 = get_cdf(latencies)
    from write_array_to_file import write_tuple_array

    write_tuple_array(cdf2, "ultradns")
Esempio n. 10
0
def update_bw_by_name(write_rate_file, active_counts_file, output_file):
    f = open(write_rate_file)
    write_rates = {}
    for line in f:
        tokens = line.strip().split()
        write_rates[tokens[0]] = float(tokens[1])

    updatecosts = []
    f = open(active_counts_file)
    for line in f:
        tokens = line.split()
        if tokens[0] in write_rates:
            name = int(tokens[0])
            replicas = int(tokens[1])
            # exlcude mobiles with zero write rates
            updatecosts.append(replicas * write_rates[tokens[0]])

    from stats import get_cdf
    cdf = get_cdf(updatecosts)

    from write_array_to_file import write_tuple_array
    write_tuple_array(cdf, output_file, p = True)
Esempio n. 11
0
def update_bw_by_name(write_rate_file, active_counts_file, output_file):
    f = open(write_rate_file)
    write_rates = {}
    for line in f:
        tokens = line.strip().split()
        write_rates[tokens[0]] = float(tokens[1])

    updatecosts = []
    f = open(active_counts_file)
    for line in f:
        tokens = line.split()
        if tokens[0] in write_rates:
            name = int(tokens[0])
            replicas = int(tokens[1])
            # exlcude mobiles with zero write rates
            updatecosts.append(replicas * write_rates[tokens[0]])

    from stats import get_cdf
    cdf = get_cdf(updatecosts)

    from write_array_to_file import write_tuple_array
    write_tuple_array(cdf, output_file, p=True)
Esempio n. 12
0
def write_cdf(filename, col_no, output_filename):
    values = extract_column_from_file(filename, col_no)
    #print values
    cdf_values = get_cdf(values)
    #print cdf_values
    write_tuple_array(cdf_values, output_filename, p=True)
Esempio n. 13
0
def write_cdf(filename, col_no, output_filename):
    values = extract_column_from_file(filename, col_no)
    #print values
    cdf_values = get_cdf(values)
    #print cdf_values
    write_tuple_array(cdf_values, output_filename, p = True)