Example #1
0
def main(encrypt=True):
    # Inject the delta data for every binary
    print('************ Injecting delta data **********')
    with concurrent.futures.ProcessPoolExecutor() as executor:
        for seed_tuple in support.all_seeds_gen():
            for subset in support.subsets_gen(seed_tuple, False):
                for (benchmark, name) in support.benchmarks_gen():
                    executor.submit(inject_data, benchmark, name, subset,
                                    encrypt)
Example #2
0
def main():
    # Start with destroying the previous directory structure, if it exists
    shutil.rmtree(config.data_dir, True)

    # Get the seeds and extract the data for the associated build
    with concurrent.futures.ProcessPoolExecutor() as executor:
        for seed_tuple in support.all_seeds_gen():
            for subset in support.subsets_gen(seed_tuple, False):
                executor.submit(extract_data, subset)

        executor.submit(extract_data, ())
Example #3
0
def main():
    # Start with destroying the previous directory structure, if it exists
    shutil.rmtree(config.patches_dir, True)

    # Create the patches by submitting tasks to the executor
    print('************ Creating patches **********')
    with concurrent.futures.ProcessPoolExecutor() as executor:
        for seed_tuple in support.all_seeds_gen():
            for subset in support.subsets_gen(seed_tuple, False):
                for (benchmark, _) in support.benchmarks_gen():
                    executor.submit(create_patch, benchmark, subset)
def main():
    # Create the sheet
    print('************ Creating report on binary sizes **********')
    sheet = pyexcel.Sheet()
    rownames = [benchmark for benchmark, _ in support.benchmarks_gen()]
    sheet.column += ['Binary default'] + rownames + ['Binary diversified'
                                                     ] + rownames

    # Get all the sizes of the default binaries
    sizes = ['']
    for (benchmark, name) in support.benchmarks_gen():
        binary = os.path.join(support.create_path_for_seeds(config.build_dir),
                              benchmark, name)
        if os.path.exists(binary):
            sizes.append(get_binary_stripped_size(binary))
        else:
            sizes.append('FAIL')

    # Create the AVG and MAX columns
    sheet.column += sizes + ['AVG'] + [''] * len(rownames)
    sheet.column += sizes + ['MAX'] + [''] * len(rownames)

    for seeds in support.all_seeds_gen():
        # Get all the sizes of the diversified binaries
        sizes = [''] * (len(rownames) + 2)
        for (benchmark, name) in support.benchmarks_gen():
            binary = os.path.join(
                support.create_path_for_seeds(config.build_dir, *seeds),
                benchmark, name)
            if os.path.exists(binary):
                sizes.append(get_binary_stripped_size(binary))
            else:
                sizes.append('FAIL')

        sheet.column += sizes

    # Calculate in the average and the max
    for row in (row for row in sheet.rows()
                if not row[0].startswith('Binary')):
        sizes = [elem for elem in row[3:] if isinstance(elem, int)]
        if sizes:
            row[1] = sum(sizes) // len(sizes)
            row[2] = max(sizes)

    # Create the report book and write it out
    report = pyexcel.Book(sheets={'Sizes': sheet})
    report.save_as(os.path.join(config.reports_dir, 'binary_sizes.ods'))
Example #5
0
def main():
    # Create the sheet
    print('************ Creating report on patch timing **********')
    sheet = pyexcel.Sheet()
    rownames = [benchmark for benchmark, _ in support.benchmarks_gen()]
    sheet.column += ['Patch creation'] + rownames + ['Patch application'
                                                     ] + rownames
    sheet.column += [''] * (len(rownames) + 1) + ['AVG'] + [''] * len(rownames)
    sheet.column += [''] * (len(rownames) + 1) + ['MAX'] + [''] * len(rownames)

    for seeds in support.all_seeds_gen():
        # Empty cell
        times = ['']

        for (benchmark, name) in support.benchmarks_gen():
            # Determine all paths
            base_data = os.path.join(
                support.create_path_for_seeds(config.data_dir), benchmark)
            div_symfile_path = os.path.join(
                support.create_path_for_seeds(config.data_dir, *seeds),
                benchmark, 'symfile')

            # Time patch creation
            def time_function1():
                patch.patch(base_data,
                            seeds,
                            div_symfile_path=div_symfile_path,
                            output_dir=config.tmp_dir)

            times.append(timeit.timeit(time_function1, number=1))
            shutil.copyfile(os.path.join(config.tmp_dir, 'patch'),
                            os.path.join(config.tmp_dir, 'patch.' + name))

        # Empty cell
        times.append('')

        for (benchmark, name) in support.benchmarks_gen():
            base_data = os.path.join(
                support.create_path_for_seeds(config.data_dir), benchmark)

            # Time patch application
            def time_function2():
                patch.patch(base_data,
                            seeds,
                            patch_path=os.path.join(config.tmp_dir,
                                                    'patch.' + name),
                            output_dir=config.tmp_dir)

            times.append(timeit.timeit(time_function2, number=1))

        sheet.column += times

    # Calculate in the average and the max
    for row in (row for row in sheet.rows() if not row[0].startswith('Patch')):
        times = [elem for elem in row[3:] if isinstance(elem, float)]
        if times:
            row[1] = float(sum(times) / len(times))
            row[2] = max(times)

    # Create the report book and write it out
    report = pyexcel.Book(sheets={'Timing': sheet})
    report.save_as(os.path.join(config.reports_dir, 'patch_timing.ods'))