예제 #1
0
def parse_the_command_line(): 
    parser = argparse.ArgumentParser(description=
                                     'Do WCET calculation using super blocks '
                                     'analysis')
    
    parser.add_argument('program_file',
                        help='a file containing program information'
                        ' (with .txt extension)')
    
    parser.add_argument('--repeat',
                        type=int,
                        help='repeat the calculation this many times',
                        default=1,
                        metavar='<INT>')
    
    parser.add_argument('--max-loop-bound',
                        type=int,
                        help='set the maximum possible value for automatically '
                        'generated loop bounds',
                        default=10,
                        metavar='<INT>')
    
    parser.add_argument('--functions',
                        nargs='*',
                        help='analyse these functions only')
    
    globals.add_common_command_line_arguments(parser)
    globals.args = vars(parser.parse_args())
    globals.set_filename_prefix(globals.args['program_file'])
예제 #2
0
def parse_the_command_line(): 
    parser = argparse.ArgumentParser(description=
                                     'Compute path expressions from a CFG')
    
    parser.add_argument('program_file',
                        help='a file containing program information'
                        ' (with .txt extension)')
    
    globals.add_common_command_line_arguments(parser)
    globals.args = vars(parser.parse_args())
    globals.set_filename_prefix(globals.args['program_file'])
예제 #3
0
def parse_the_command_line():
    parser = argparse.ArgumentParser(
        description='Compute path expressions from a CFG')

    parser.add_argument('program_file',
                        help='a file containing program information'
                        ' (with .txt extension)')

    globals.add_common_command_line_arguments(parser)
    globals.args = vars(parser.parse_args())
    globals.set_filename_prefix(globals.args['program_file'])
예제 #4
0
def parse_the_command_line(): 
    parser = argparse.ArgumentParser(description=
                                     'Instrument program to collect execution '
                                     'profiles at run time')
    
    parser.add_argument('program_file',
                        help='a file containing program information'
                        ' (with .txt extension)')
    
    parser.add_argument('--instrument',
                        choices=['vertices', 'edges', 'mixed'],
                        required=True,
                        help='instrument vertices, edges, or both')
    
    parser.add_argument('--repeat',
                        type=int,
                        help='repeat the calculation this many times',
                        default=1,
                        metavar='<INT>')
    
    parser.add_argument('--functions',
                        nargs='*',
                        help='analyse these functions only')
    
    parser.add_argument('--super-blocks',
                        action='store_true',
                        help='use super blocks to work out where to place ' 
                        'instrumentaton',
                        default=False)
    
    parser.add_argument('--ipg',
                        action='store_true',
                        help='use instrumentation point graph to work out '
                        'where to place instrumentaton',
                        default=False)
    
    globals.add_common_command_line_arguments(parser)
    globals.args = vars(parser.parse_args())
    globals.set_filename_prefix(globals.args['program_file'])
예제 #5
0
def parse_the_command_line(): 
    
    class CheckForPositiveValue(Action):
        def __call__(self, parser, namespace, value, option_string=None):
            if value <= 0: 
                raise ArgumentError('Argument {} requires a positive integer'.\
                                    format(option_string))
            setattr(namespace, self.dest, value)
    
    parser = ArgumentParser(description='Generate a random program')
    
    parser.add_argument('--directory',
                        help='write the program file to this directory',
                        default=os.path.abspath(os.curdir))
    
    parser.add_argument('--program_file',
                        help='write the program to this file',
                        default=None)
    
    parser.add_argument('--subprograms',
                        action=CheckForPositiveValue,
                        type=int,
                        help='number of subprograms',
                        metavar='<INT>',
                        default=1)
    
    parser.add_argument('--loops',
                        type=int,
                        help='maximum number of loops in a control flow graph',
                        metavar='<INT>',
                        default=0)
    
    parser.add_argument('--nesting-depth',
                        type=int,
                        help='maximum nesting depth of loops',
                        metavar='<INT>',
                        default=1)
    
    parser.add_argument('--fan-out',
                        action=CheckForPositiveValue,
                        type=int,
                        help='select maximum fan out of a basic block',
                        metavar='<INT>',
                        default=2)
    
    parser.add_argument('--vertices',
                        type=int,
                        action=CheckForPositiveValue,
                        help='maximum number of basic blocks in a control flow graph',
                        metavar='<INT>',
                        default=10)
    
    globals.add_common_command_line_arguments(parser)
    globals.args = vars(parser.parse_args())
    base_directory = os.path.abspath(globals.args['directory'])
    if globals.args['program_file'] is None:
        globals.args['program_file'] = create_program_filename(base_directory)
    globals.args['program_file'] = base_directory + os.sep + globals.args['program_file']
    globals.set_filename_prefix(globals.args['program_file']) 
    
    if globals.args['vertices'] < globals.args['loops'] * 2:
        debug.exit_message('The number of vertices in a control flow graph ' 
                           'must be at least twice the number of loops')