def GetOptions():
    """
    Get users command line options/args and check to make sure they are correct.

    @return List of options and one argument: base name for traces
    """

    version = '$Revision: 1.6 $'
    version = version.replace('$Revision: ', '')
    ver = version.replace(' $', '')
    us = '%prog [options] trace_base_name'
    desc = 'Generate the traceinfo XML files for a set of traces.'

    util.CheckNonPrintChar(sys.argv)
    parser = optparse.OptionParser(usage=us, version=ver, description=desc)

    # Command line options to control script behavior.
    #
    # import pdb;  pdb.set_trace()
    # cmd_options.weight_file(parser, '')

    # Parse command line options and get any arguments.
    #
    (options, args) = parser.parse_args()

    # Is the required argument given on the command line.
    #
    if len(args) < 1:
        msg.PrintAndExit(
            'Not enough arguments given to script.  Use -h to get help')

    # Check to make sure the required 'blank' XML file are in the
    # current directory.
    #
    # import pdb;  pdb.set_trace()
    for blank_file in config.traceinfo_blank_files:
        if not os.path.isfile(blank_file):
            msg.PrintAndExit(
                'Required \'blank\' xml traceinfo file not found.\n     ' +
                blank_file)

    return options, args
Ejemplo n.º 2
0
def GetOptions():
    """Get users command line options."""

    version = '$Revision: 1.20 $'
    version = version.replace(' ', '')
    ver = version.replace(' $', '')
    us = '%prog [options] app_version compiler_version input_name platform program_name'
    desc = \
    'Renames tracing files generated by PinPlay tools to conform to the GTR requirements.  ' \
    'There are 5 arguments required to run the script.  Details are given below in the ' \
    'section \'Required arguments\'.'

    # Print arguments passed to the script.
    #
    # import pdb;  pdb.set_trace()
    msg.PrintMsgNoCR('Script args: '),
    for string in sys.argv[1:]:
        msg.PrintMsgNoCR(string + ' '),
    msg.PrintMsg('')
    msg.PrintMsg('')

    util.CheckNonPrintChar(sys.argv)
    parser = optparse.OptionParser(
        usage=us,
        version=ver,
        description=desc,
        formatter=cmd_options.BlankLinesIndentedHelpFormatter())

    # Command line options to control the scripts behavior.
    #
    # import pdb;  pdb.set_trace()
    cmd_options.config_file(parser)
    cmd_options.debug(parser)
    cmd_options.date(parser, '')
    cmd_options.processor(parser, '')
    cmd_options.verbose(parser)

    # Define a separate option group for the require arguments.
    #
    required_opts = cmd_options.RenameRequiredOpts(parser)

    cmd_options.app_version(parser, required_opts)
    cmd_options.compiler_version(parser, required_opts)
    cmd_options.input_name(parser, required_opts)
    cmd_options.platform(parser, required_opts)
    cmd_options.program_name(parser, required_opts)

    parser.add_option_group(required_opts)

    (options, args) = parser.parse_args()

    # Read in the configuration file.
    #
    Config.GetCfgGlobals(options, True)  # 2 required parameters are needed

    # Ensure the required variables are defined.
    #
    CheckRequiredVariables(options)

    # If the user didn't give a date, use the current date.
    #
    if options.date == '':
        today = datetime.date.today()
        options.date = today.strftime('%y%m')
    CheckField(options.date)

    # If user didn't give a separate processor name, get it from the platform info.
    #
    if options.processor == '':
        # Use the first 3 char as the processor type
        options.processor = options.platform[:3]
    CheckField(options.processor)

    return options
Ejemplo n.º 3
0
    def ParseCommandLine(self):
        """
        Process command line arguments and read in config file/globals.

        @return List of options parsed from command line
        """

        version = '$Revision: 1.100 $'
        version = version.replace(' ', '')
        ver = version.replace(' $', '')
        us = '%prog phase [options] \nVersion: ' + ver
        desc = 'The script generates traces for an application using the PinPoints methodology '\
               '(based on PinPlay: Pin-based record/replay tools). '\
               'At least one command line option must be given to chose the phases to run. ' \
               'Use option \'--default_phases\' to run all the default phases. '  \
               'See section "Phase options" for a list of phases. \n\n'\
               '' \
               'The two parameters \'program_name\' and \'input_name\' must be defined in order '\
               'to run this script.  If running the logging phase (-l), then two more parameters, '\
               '\'command\' and \'mode\', must also be defined.  '\
               'Parameters can be given either in a tracing configuration file or with command '\
               'line options.  \n\n'\
               '' \
               'The default configuration file is "tracing.cfg". '\
               'If it exists, the script will always read this cfg file first. '\
               'Use the option "--cfg" to select additional files. '\
               'Each cfg file on the command line is processed in order.  '\
               'Command line options over-ride values read from configuration files. '\
               'All parameters listed in the three parameter '\
               'sections below can be defined in a cfg file.  The long option name, '\
               'not the single letter option, must be used in the cfg files.\n\n'\
               '' \
               'Example parameter configuration file:'\
               '                                                            '\
               '--------------------------------------------'\
               '                                                            '\
               '[Parameters]'\
               '                                                            '\
               'program_name:   omnetpp'\
               '                                                            '\
               'input_name:     p10000-s10'\
               '                                                            '\
               'command:        ./dtlb5-lin64 -p10000 -s10'\
               '                                                            '\
               'mode:           st'\
               '                                                            '\
               '--------------------------------------------'

        util.CheckNonPrintChar(sys.argv)
        parser = optparse.OptionParser(
            usage=us,
            description=desc,
            version=ver,
            formatter=cmd_options.BlankLinesIndentedHelpFormatter())

        # Command line options to control the tools behavior. These are not in any
        # of the option groups.
        #
        # import pdb;  pdb.set_trace()
        cmd_options.add_program_wp(parser)
        cmd_options.append_status(parser)
        cmd_options.config_file(parser)
        cmd_options.debug(parser)
        cmd_options.delete(parser)
        cmd_options.delete_all(parser)
        cmd_options.delete_wp(parser)
        cmd_options.dir_separator(parser)
        cmd_options.log_options(parser)
        cmd_options.msgfile_ext(parser)
        cmd_options.no_glob(parser)
        cmd_options.pintool(parser)
        cmd_options.pin_options(parser)
        cmd_options.replay_options(parser)
        cmd_options.save_global(parser)
        cmd_options.verbose(parser)

        self.AddAdditionalOptions(parser)

        # Top level command line options in the default group allow the user
        # to choose the phases to run.
        #
        phase_group = cmd_options.PhaseGroup(parser)

        cmd_options.default_phases(parser, phase_group)
        cmd_options.native_pure(parser, phase_group)
        cmd_options.log(parser, phase_group)
        cmd_options.replay(parser, phase_group)
        cmd_options.basic_block_vector(parser, phase_group)
        cmd_options.simpoint(parser, phase_group)
        cmd_options.region_pinball(parser, phase_group)
        cmd_options.replay_region(parser, phase_group)

        self.AddAdditionalPhaseOptions(parser, phase_group)

        parser.add_option_group(phase_group)

        # Top level command line options in param group are used to set various
        # tracing parameters.
        #
        param_group = cmd_options.ParameterGroup(parser)

        cmd_options.command(parser, param_group)
        cmd_options.compressed(parser, param_group)
        cmd_options.focus_thread(parser, param_group)
        cmd_options.input_name(parser, param_group)
        cmd_options.mpi_options(parser, param_group)
        cmd_options.mode(parser, param_group)
        cmd_options.num_cores(parser, param_group)
        cmd_options.num_proc(parser, param_group)
        cmd_options.program_name(parser, param_group)
        self.KitOption(parser, param_group)

        parser.add_option_group(param_group)

        # Top level command line options which only apply to the Simpoint phase.
        #
        simpoint_phase_group = cmd_options.SimpointPhaseGroup(parser)

        cmd_options.combine(parser, simpoint_phase_group)
        cmd_options.cutoff(parser, simpoint_phase_group)
        cmd_options.ldv(parser, simpoint_phase_group)
        cmd_options.maxk(parser, simpoint_phase_group)
        cmd_options.slice_size(parser, simpoint_phase_group)
        cmd_options.warmup_factor(parser, simpoint_phase_group)
        cmd_options.pccount_regions(parser, simpoint_phase_group)
        cmd_options.global_regions(parser, simpoint_phase_group)
        cmd_options.simpoint_options(parser, simpoint_phase_group)

        parser.add_option_group(simpoint_phase_group)

        # Top level command line options which only apply to the region pinball generation phase.
        #
        region_pb_phase_group = cmd_options.RegionPBPhaseGroup(parser)

        cmd_options.epilog_length(parser, region_pb_phase_group)
        cmd_options.prolog_length(parser, region_pb_phase_group)
        cmd_options.warmup_length(parser, region_pb_phase_group)

        parser.add_option_group(region_pb_phase_group)

        # Add verify options.
        #
        self.AddVerifyOptions(parser)

        # Top level command line options in modify group modify the behavior of phases.
        #
        modify_group = cmd_options.ModifyGroup(parser)

        # These should go before the rest of the modify options.
        #
        cmd_options.coop_pinball(parser, modify_group)
        cmd_options.cross_os(parser, modify_group)
        cmd_options.list(parser, modify_group)
        cmd_options.native_pin(parser, modify_group)
        cmd_options.no_focus_thread(parser, modify_group)
        cmd_options.whole_pgm_dir(parser, modify_group)

        self.AddAdditionalModifyOptions(parser, modify_group)

        parser.add_option_group(modify_group)

        # Top level command line options in which only apply to the region pinball generation phase.
        #
        wp_filter_group = cmd_options.WPFilterGroup(parser)

        cmd_options.relog_name(parser, wp_filter_group)
        cmd_options.relog_focus(parser, wp_filter_group)
        cmd_options.relog_no_init(parser, wp_filter_group)
        cmd_options.relog_no_cleanup(parser, wp_filter_group)
        cmd_options.relog_code_exclude(parser, wp_filter_group)
        cmd_options.relog_no_omp_spin(parser, wp_filter_group)
        cmd_options.relog_no_mpi_spin(parser, wp_filter_group)
        cmd_options.use_relog_name(parser, wp_filter_group)
        cmd_options.use_relog_focus(parser, wp_filter_group)
        cmd_options.use_relog_no_cleanup(parser, wp_filter_group)
        cmd_options.use_relog_no_init(parser, wp_filter_group)
        cmd_options.use_relog_code_exclude(parser, wp_filter_group)
        cmd_options.use_relog_no_omp_spin(parser, wp_filter_group)
        cmd_options.use_relog_no_mpi_spin(parser, wp_filter_group)

        parser.add_option_group(wp_filter_group)

        # Parse the command line options.
        #
        # import pdb;  pdb.set_trace()
        (options, args) = parser.parse_args()

        # Added method cbsp() to 'options' to check if running CBSP.
        #
        util.AddMethodcbsp(options)

        # Check to make sure there was at least one command line option given.
        #
        # import pdb;  pdb.set_trace()
        if len(sys.argv) == 1:
            msg.PrintMsg(
                "ERROR: Must use command line options to chose at least one phase to run.\n"
                "Use the option '--default_phases' to run the default phases. Use '--help' for more info.")
            util.CheckResult(-1, options, 'Checking command line options')

        # If user does not just want to delete all the files, then
        # read in configuration files and set global variables.
        #
        # import pdb;  pdb.set_trace()
        if not options.delete_all:
            self.Config.GetCfgGlobals(options,
                                      True)  # Yes, need 4 required parameters

            # Once the tracing configuration parameters are read, get the kit
            # in case pinplayhome was set on the command line.  Also, need to
            # reset the path in object 'self' and set the kit in self.phases.
            #
            # import pdb;  pdb.set_trace()
            kit_obj = self.GetKit()
            self.path = kit_obj.path
            self.script_path = kit_obj.path
            self.phases.SetKit(kit_obj)

        # If required, check to see if there any 'forbidden' char in some of
        # the parameters.
        #
        # import pdb;  pdb.set_trace()
        if self.kit_type == config.SDE and hasattr(options,
                                                   'spec') and not options.spec:
            self.Config.CheckForbiddenChar()

        # If doing code exclusion, check to make sure the file exists.
        #
        if options.relog_code_exclude:
            if not os.path.exists(options.relog_code_exclude):
                msg.PrintMsg(
                    'ERROR: The code exclusion file used for filtering does not exist:\n'
                    '    ' + options.relog_code_exclude)
                util.CheckResult(-1, options, 'Checking command line options')

        # Do some 'special' things on native Windows.
        #
        util.WindowsNativeCheck(options)

        return options
Ejemplo n.º 4
0
    def ParseCommandLine(self):
        """
        Parse command line arguments and check to make sure all required options were given.

        @return List of options
        """

        # command line options for the driver
        #
        version = '$Revision: 1.14 $'
        version = version.replace(' ', '')
        ver = version.replace(' $', '')
        us = '%prog [options] --mode MODE binary args'
        desc = 'Runs binary with the logger Pintool and generates whole program '\
               'pinballs. Required arguments include:\n'\
               '   1) Binary to run and it\'s arguments.\n'\
               '   2) Mode of the binary using \'--mode MODE\'.\n'\
               'If the option \'--log_file\' is not given, the default pinball name is \'log\'.'

        util.CheckNonPrintChar(sys.argv)
        parser = optparse.OptionParser(
            usage=us,
            version=ver,
            description=desc,
            formatter=cmd_options.BlankLinesIndentedHelpFormatter())

        # Define the command line options which control the behavior of the
        # script.  Some of these methods take a 2nd argument which is the empty
        # string ''.   If the script uses option groups, then this parameter is
        # the group.  However, this script does not use option groups, so the
        # argument is empty.
        #
        cmd_options.arch(parser, '')
        cmd_options.compressed(parser, '')
        cmd_options.config_file(parser)
        cmd_options.debug(parser)
        cmd_options.global_file(parser)
        cmd_options.log_file(parser)
        cmd_options.log_options(parser)
        cmd_options.mode(parser, '')
        cmd_options.mpi_options(parser, '')
        cmd_options.msgfile_ext(parser)
        cmd_options.no_log(parser)
        cmd_options.no_print_cmd(parser)
        cmd_options.pid(parser)
        cmd_options.pinplayhome(parser, '')
        cmd_options.pintool(parser)
        cmd_options.pintool_help(parser)
        cmd_options.pin_options(parser)
        cmd_options.save_global(parser)
        cmd_options.sdehome(parser, '')
        cmd_options.verbose(parser)

        # import pdb;  pdb.set_trace()
        (options, args) = parser.parse_args()

        # Added method cbsp() to 'options' to check if running CBSP.
        #
        util.AddMethodcbsp(options)

        # Translate the 'arch' string given by the user into
        # the internal arch type used by the scripts.
        #
        util.SetArch(options)

        # If user just wants pintool_help, return
        #
        if (hasattr(options, 'pintool_help') and options.pintool_help):

            return options

        # Read in configuration files and set global variables.
        # No requirment to read in a config file, but it's OK
        # to give one.
        #
        config_obj = config.ConfigClass()
        config_obj.GetCfgGlobals(options,
                                 False)  # No, don't need required parameters

        # Make sure user gave an application mode
        #
        if options.mode:
            options.mode = util.ParseMode(options.mode)
        else:
            parser.error("Application mode was not given.\n" \
                "Need to use option --mode MODE. Choose MODE from: 'st', 'mt', 'mpi', 'mpi_mt', 'mp', 'mp_mt'")

        # Get the application command line
        #
        # import pdb;  pdb.set_trace()
        cmd_line = " ".join(args)
        if not options.pid:
            if cmd_line:
                setattr(options, 'command', cmd_line)
            else:
                parser.error('no program command line specified.\n'
                             'Need to add binary and it\'s arguments.')

        return options
Ejemplo n.º 5
0
    def ParseCommandLine(self):
        """
        Process command line arguments and ensure they are valid.

        @return List of command line options
        """

        # import pdb ; pdb.set_trace()
        version = '$Revision: 1.78 $'
        version = version.replace('$Revision: ', '')
        ver = version.replace(' $', '')
        us = '%prog [options]\nVersion: ' + ver
        desc = 'Replays one, or more, pinball(s). Must use one of '\
               'the following options: \n'\
               '--replay_file, --all_file, --all_dir'

        util.CheckNonPrintChar(sys.argv)
        parser = optparse.OptionParser(usage=us, version=ver, description=desc)

        # Define the command line options which control the behavior of the
        # script.  Some of these methods take a 2nd argument which is the empty
        # string ''. If the script uses option groups, then this parameter is
        # the group. However, this script does not use option groups, so the
        # argument is empty.
        #
        cmd_options.debug(parser)
        cmd_options.verbose(parser)
        cmd_options.all_dir(parser)
        cmd_options.all_file(parser)
        cmd_options.config_file(parser)
        cmd_options.global_file(parser)
        cmd_options.list(parser, '')
        cmd_options.no_glob(parser)
        cmd_options.num_cores(parser, '')
        cmd_options.replay_dir(parser)
        cmd_options.replay_file(parser)
        cmd_options.replay_filter(parser)
        cmd_options.save_global(parser)

        self.AddAdditionalOptions(parser)

        # import pdb ; pdb.set_trace()
        (options, args) = parser.parse_args()

        # Added method cbsp() to 'options' to check if running CBSP.
        #
        util.AddMethodcbsp(options)

        # Read in configuration files and set global variables.
        # No need to read in a config file.
        #
        # import pdb;  pdb.set_trace()
        config_obj = config.ConfigClass()
        config_obj.GetCfgGlobals(options,
                                 False)  # Don't need to require 4 variables

        # Once the tracing configuration parameters are read, get the kit in
        # case pinplayhome was set on the command line.
        #
        self.kit_obj = self.GetKit()

        # Print out the version number
        #
        # import pdb;  pdb.set_trace()
        if config.debug:
            print(os.path.basename(sys.argv[0]) + " $Revision: 1.78 $")

        # Some error checking.
        #
        if options.replay_file == '' and options.all_dir == '' and options.all_file == '' and \
                options.replay_dir == '':
            msg.PrintAndExit(
                "Either a replay directory or replay file must be specified!")

        elif (options.all_dir != '' and options.all_file != '') or  \
             (options.all_dir != '' and options.replay_file != '') or \
             (options.all_file != '' and options.replay_file != ''):

            msg.PrintAndExit(
                "Specify either a replay directory or a replay file, not both!")

        return options
Ejemplo n.º 6
0
    def ParseCommandLine(self):
        """
        Get the options from the command line and check for errors.

        @return tuple with parsed options and unparsed args
        """

        # Define and get command line options.
        #
        version = '$Revision: 1.33 $'
        version = version.replace('$Revision: ', '')
        ver = version.replace(' $', '')
        us = '%prog --bbv_file FILE --data_dir DIR FILE --simpoint_file FILE [options]'
        desc = 'Runs Simpoint and then generates the region CSV file.  ' \
               'Input to Simpoint can be just an BBV file or a combination of BBV/LDV files. \n\n' \
                'Required options: --bbv_file, --data_dir, --simpoint_file'

        util.CheckNonPrintChar(sys.argv)
        parser = optparse.OptionParser(
            usage=us,
            version=ver,
            description=desc,
            formatter=cmd_options.BlankLinesIndentedHelpFormatter())

        cmd_options.debug(parser)
        cmd_options.global_file(parser)
        cmd_options.list(parser, '')
        cmd_options.bbv_file(parser, '')
        cmd_options.data_dir(parser)
        cmd_options.simpoint_file(parser)
        cmd_options.ldv(parser, '')
        cmd_options.combine(parser, '')
        cmd_options.cutoff(parser, '')
        cmd_options.focus_thread(parser, '')
        cmd_options.maxk(parser, '')
        cmd_options.num_cores(parser, '')
        cmd_options.simpoint_options(parser, '')

        (options, args) = parser.parse_args()

        # Added method cbsp() to 'options' to check if running CBSP.
        #
        util.AddMethodcbsp(options)

        # Must have option '--ldv', even if using option '--combine', in order to
        # process BBV/LDV both.  Let user know if '--combine' used w/o '--ldv'.
        #
        if not options.ldv and options.combine != -1.0:
            msg.PrintMsgPlus('WARNING: Option \'--combine\' detected without \'--ldv\'.  Only using BBV for ' \
                'Simpoint.  \n              Must explicitly specify \'--ldv\' in order to use both BBV/LDV.\n')
        if options.ldv:
            msg.PrintMsgPlus(
                'Using both BBV/LDV files when running Simpoint\n')

        # If option combine is not set, then set it to the default value.
        # Check to make sure combine an acceptable value.
        #
        util.SetCombineDefault(options)
        util.CheckCombine(options)

        # Read in an optional configuration files and set global variables.
        #
        config_obj = config.ConfigClass()
        config_obj.GetCfgGlobals(options,
                                 False)  # Don't need to require 4 variables

        # Error check input to make sure all required options are on the command line.
        #
        if options.bbv_file == '':
            msg.PrintAndExit(
                'Basic block vector file must be defined with option: --bbv_file FILE'
            )
        if options.data_dir == '':
            msg.PrintAndExit(
                'Simpoint data directory must be defined with option: --data_dir DIR'
            )
        if options.simpoint_file == '':
            msg.PrintAndExit(
                'Simpoint output must be defined with option: --simpoint_file FILE'
            )

        # The data_dir should exist and contain the BBV file.
        #
        if not os.path.isdir(options.data_dir):
            msg.PrintAndExit('Data directory does not exist: ' +
                             options.data_dir)
        if not os.path.isfile(os.path.join(options.data_dir,
                                           options.bbv_file)):
            msg.PrintAndExit('Basic block vector file does not exist: ' +
                             options.bbv_file)

        # Do some 'special' things on native Windows.
        #
        util.WindowsNativeCheck(options)

        return (options, args)
Ejemplo n.º 7
0
    def ParseCommandLine(self):
        """
        Process command line arguments, get Kit, tool options, and their paths.

        @return List containing: pin_options, pintool_options, options.replay_file, kit_obj
        """

        # import pdb;  pdb.set_trace()
        version = '$Revision: 1.63 $'
        version = version.replace(' ', '')
        ver = version.replace(' $', '')
        us = '%prog [options] pinball_basename \nVersion: ' + ver
        desc = 'Replays one pinball. Use \'--replay_options\' or ' \
               '\'--log_options\' to modify the pintool behavior during replay.'
        util.CheckNonPrintChar(sys.argv)
        parser = optparse.OptionParser(usage=us, version=ver, description=desc)

        # Define the command line options which control the behavior of the
        # script.
        #
        # Some of these methods take a 2nd argument which is the empty string
        # ''.  If this script used option groups, then the 2nd parameter would
        # be the group.  However, this script does not use option groups, so
        # the argument is empty.
        #
        cmd_options.arch(parser, '')
        cmd_options.config_file(parser)
        cmd_options.cross_os(parser, '')
        cmd_options.debug(parser)
        cmd_options.global_file(parser)
        cmd_options.log_options(parser)
        cmd_options.msgfile_ext(parser)
        cmd_options.no_print_cmd(parser)
        cmd_options.pintool(parser)
        cmd_options.pintool_help(parser)
        cmd_options.pin_options(parser)
        cmd_options.pinplayhome(parser, '')
        cmd_options.playout(parser)
        cmd_options.replay_file(parser)
        cmd_options.replay_options(parser)
        cmd_options.save_global(parser)
        cmd_options.sdehome(parser, '')
        cmd_options.verbose(parser)

        # import pdb;  pdb.set_trace()
        (options, args) = parser.parse_args()

        if options.verbose:
            msg.PrintMsg('Started replayer.py')
        # Check to make sure the pinball basename has been given as an argument or
        # command line option.
        #
        # import pdb;  pdb.set_trace()
        if options.replay_file == '' and \
           not (hasattr(options, 'pintool_help') and options.pintool_help):
            if len(sys.argv) == 1 or len(args) == 0:
                msg.PrintMsg(
                    "ERROR: Must have a trace basename on the command line.\n"
                    "Usage: %s [options] pinball_basename" %
                    os.path.basename(sys.argv[0]))
                util.CheckResult(-1, options, 'Checking command line options')
            options.replay_file = args[0]

        # Read in an optional configuration files and set global variables.
        #
        config_obj = config.ConfigClass()
        config_obj.GetCfgGlobals(options,
                                 False)  # Don't need to require 4 variables

        # Once the tracing configuration parameters are read, get the kit in
        # case pinplayhome was set on the command line.
        #
        # import pdb;  pdb.set_trace()
        kit_obj = self.GetKit()

        # If user just wants 'pintool_help' go ahead and print it, then exit
        # the script.
        #
        if hasattr(options, 'pintool_help') and options.pintool_help:
            result = util.PintoolHelpKit(kit_obj, options)
            sys.exit(result)

        # Translate the 'arch' value given by the user into
        # the internal arch type used by the scripts.
        #
        if hasattr(options, 'arch') and options.arch:
            if 'intel64' in options.arch:
                options.arch = config.ARCH_INTEL64
            elif 'ia32' in options.arch:
                options.arch = config.ARCH_IA32
            else:
                options.arch = config.ARCH_INVALID

        # Now that we know the type of the binary, set the user defined pintool,
        # if one exists.  Need to wait until now to set the tool because the
        # user may only have the tool in the architecture dependent directory
        # for this type of application.  Thus we need the binary type in order
        # to find it.
        #
        # import pdb;  pdb.set_trace()
        kit_obj.binary_type = options.arch

        pin_options = ''
        pintool_options = ''

        # Check to see if there is a pinball to replay.
        #
        if options.replay_file == "":
            msg.PrintHelpAndExit('Replay file not specified!')

        # If the user specified a pintool, replace the default pintool in the kit with
        # it.
        #
        if hasattr(options, "pintool") and options.pintool:
            kit_obj.SetPinTool(options.pintool, options.replay_file)

        platform = util.Platform()
        if platform == config.LINUX:
            pin_options = ' ' + kit_obj.prefix + ' -xyzzy '

            # If using NOT using Linux tools to work with whole program pinballs generated on Windows,
            # then need a set of  knobs for the pin binary itself.
            #
            if not options.cross_os:
                pin_options += kit_obj.prefix + ' -reserve_memory '
                pin_options += kit_obj.prefix + ' ' + options.replay_file + '.address '

        pintool_options += ' -replay:basename ' + options.replay_file
        if options.playout or '-replay:playout 1' in options.replay_options:
            # If present, need to remove the knob '-replay:playout 1' from
            # options.replay_options because it can only be given once on the
            # command line.
            #
            pintool_options += ' -replay:playout 1 '
            options.replay_options = options.replay_options.replace(
                '-replay:playout 1', '')
        else:
            pintool_options += ' -replay:playout 0 '

        # If running Windows WP pinballs on Linux, then need this knob for the replayer pintool.
        #
        if options.cross_os:
            pintool_options += ' -replay:addr_trans'

        # Add knobs for Pin and replay/logging user gave on the command line.
        #
        pin_options += ' ' + options.pin_options
        pintool_options += ' ' + options.replay_options + ' ' + options.log_options

        # If user has log options, then may need to at multi-thread knob.
        #
        if options.log_options:
            pintool_options += util.AddMt(options, options.replay_file)

        return pin_options, pintool_options, options.replay_file, kit_obj, options
Ejemplo n.º 8
0
    def ParseCommandLine(self):
        """
        Process command line arguments. Generate pin and tool options, and their paths.
        """

        # import pdb;  pdb.set_trace()
        version = '$Revision: 1.14 $'
        version = version.replace(' ', '')
        ver = version.replace(' $', '')
        us = '%prog [options] trace_basename \nVersion: ' + ver
        desc = 'Run a simulator on a trace.'
        util.CheckNonPrintChar(sys.argv)
        parser = optparse.OptionParser(usage=us, version=ver, description=desc)

        # Define the command line options which control the behavior of the
        # script.
        #
        # Some of these methods take a 2nd argument which is the empty string
        # ''.  If this script used option groups, then the 2nd parameter would
        # be the group.  However, this script does not use option groups, so
        # the argument is empty.
        #
        cmd_options.config_file(parser)
        cmd_options.debug(parser)
        cmd_options.global_file(parser)
        cmd_options.list(parser, '')
        cmd_options.processor(parser, '')
        cmd_options.save_global(parser)
        cmd_options.simhome(parser, '')
        cmd_options.sim_options(parser, '')
        cmd_options.trace_basename(parser)
        cmd_options.verbose(parser)
        cmd_options.verify(parser, '')

        self.AddAdditionalCmdOptions(parser)

        # import pdb;  pdb.set_trace()
        (options, args) = parser.parse_args()

        # Check to make sure the trace basename has been given as an argument.
        #
        # import pdb;  pdb.set_trace()
        if len(sys.argv) == 1 or len(args) == 0:
            msg.PrintMsg(
                "ERROR: Must have a trace basename on the command line.\n"
                "Usage: %s [options] trace_basename" %
                os.path.basename(sys.argv[0]))
            util.CheckResult(-1, options, 'Checking command line options')
        options.trace_basename = args[0]

        # Read in optional configuration files and set global variables.
        #
        config_obj = config.ConfigClass()
        config_obj.GetCfgGlobals(options,
                                 False)  # Don't need all 4 required parameters

        # Just need this parameter.
        #
        self.Config.CheckRequiredParameter('processor')

        # Initialize the kit after reading in parameters, in case the user
        # specified anything which is used to intialize the kit.
        #
        self.kit = self.GetKit()

        return options
Ejemplo n.º 9
0
def GetOptions():
    """
    Get users command line options/args and check to make sure they are correct.

    @return List of options and 3 file pointers for bbv, simpoint and weights files
    """

    version = '$Revision: 1.30 $'
    version = version.replace(' ', '')
    ver = version.replace(' $', '')
    us = '%prog [options] action file_name [file_name]'
    desc = 'Implements several actions used to process FV (Frequency Vector) files.  ' \
           'One action, and only one, must be defined in order for the script to run.  '\
           'All actions require at least one file name be given using an option. \n\n'\
           '' \
           'There are two types of frequency vector files:  '\
           '                                                            '\
           'BBV = Basic Block Vector, '\
           '                                                            '\
           'LDV = LRU stack Distance Vector'

    def combine(parser, group):
        """
        IMPORTANT NOTE:
        This is a local definition for the option which has more help
        information than the default defined in cmd_options.py.  This info is
        specific to this script and is not applicable to the other locations
        where the option is used.

        Default value for combine to 'none' instead of setting it to a value
        (as it is in cmd_options.py).  This allows the option to be used to
        determine what to do.

        @return  No return value
        """

        method = cmd_options.GetMethod(parser, group)
        method(
            "--combine",
            dest="combine",
            default=None,
            help=
            "Combine the vectors for BBV and LDV files into a single FV file, use scaling "
            "factor COMBINE (0.0 >= COMBINE <= 1.0).  The BB vectors "
            "are scaled by COMBINE, while the LD vectors are scaled by 1-COMBINE.  Default: 0.5  "
            "Assumes both files have already been transformed by the appropriate process "
            "(project/normal for BBV, weight/normal for LDV). "
            "Must use --normal_bbv and --normal_ldv to define files to process."
        )

    util.CheckNonPrintChar(sys.argv)
    parser = optparse.OptionParser(
        usage=us,
        version=ver,
        description=desc,
        formatter=cmd_options.BlankLinesIndentedHelpFormatter())

    cmd_options.dimensions(parser, '')
    cmd_options.focus_thread(parser, '')

    # Options which define the actions the script to execute
    #
    action_group = cmd_options.ActionGroup(parser)

    combine(parser, action_group)
    cmd_options.csv_region(parser, action_group)
    cmd_options.project_bbv(parser, action_group)
    cmd_options.weight_ldv(parser, action_group)

    parser.add_option_group(action_group)

    # Options which list the files the script can process
    #
    # import pdb;  pdb.set_trace()
    file_group = cmd_options.FileGroup(parser)

    cmd_options.bbv_file(parser, file_group)
    cmd_options.ldv_file(parser, file_group)
    cmd_options.normal_bbv(parser, file_group)
    cmd_options.normal_ldv(parser, file_group)
    cmd_options.region_file(parser, file_group)
    cmd_options.vector_file(parser, file_group)
    cmd_options.weight_file(parser, file_group)

    parser.add_option_group(file_group)

    # Parse command line options and get any arguments.
    #
    (options, args) = parser.parse_args()

    # Added method cbsp() to 'options' to check if running CBSP.
    #
    util.AddMethodcbsp(options)

    def TrueXor(*args):
        """Return xor of some booleans."""
        return sum(args) == 1

    # Must have one, and only one, action on command line.
    #
    # import pdb;  pdb.set_trace()
    if not TrueXor(options.csv_region, options.project_bbv, options.weight_ldv, \
       options.combine != None, options.vector_file != None):
        msg.PrintAndExit(
            'Must give one, and only one, action for script to execute.\n'
            'Use -h to get help.')

    # Check to see if options required for the various actions are given.
    #
    file_error = lambda file, action: msg.PrintAndExit("Must use option '" + file + \
        "' to define the file to use with '" + action + "'.   \nUse -h for help.")

    # import pdb;  pdb.set_trace()
    fp_bbv = fp_ldv = fp_simp = fp_weight = None

    if options.combine:
        # Check to make sure the option 'combine' is an acceptable value.  If so, then turn it into a float.
        #
        util.CheckCombine(options)
        options.combine = float(options.combine)

        # Then check to make sure required files are given.
        #
        if not options.normal_bbv:
            file_error('--normal_bbv', '--combine')
        if not options.normal_ldv:
            file_error('--normal_ldv', '--combine')
        fp_bbv = OpenNormalFVFile(options.normal_bbv,
                                  'projected, normalized BBV file: ')
        fp_ldv = OpenNormalFVFile(options.normal_ldv,
                                  'projected, normalized BBV file: ')

    if options.csv_region:
        if not options.bbv_file:
            file_error('--bbv_file', '--csv_region')
        if not options.region_file:
            file_error('--region_file', '--csv_region')
        if not options.weight_file:
            file_error('--weight_file', '--csv_region')
        fp_bbv = OpenFVFile(options.bbv_file,
                            'Basic Block Vector (bbv) file: ')
        fp_simp = OpenSimpointFile(options.region_file, 'simpoints file: ')
        fp_weight = OpenWeightsFile(options.weight_file, 'weights file: ')

    if options.project_bbv:
        if not options.bbv_file:
            file_error('--bbv_file', '--project_bbv')
        fp_bbv = OpenFVFile(options.bbv_file,
                            'Basic Block Vector (bbv) file: ')

    if options.weight_ldv:
        if not options.ldv_file:
            file_error('--ldv_file', '--weight_ldv')
        fp_ldv = util.OpenCompressFile(options.ldv_file)

    return (options, fp_bbv, fp_ldv, fp_simp, fp_weight)
Ejemplo n.º 10
0
    def ParseCommandLine(self):
        """Process command line arguments and do error checking."""

        version = '$Revision: 1.28 $'
        version = version.replace(' ', '')
        ver = version.replace(' $', '')
        us = '%prog sim_data_dir | options \nVersion: ' + ver
        desc = 'When run with only the argument \'sim_data_dir\', the script calculates the predicted '\
               'metric of interest from the simulator data file contained in this directory. '\
               'If any options are given, then only the actions defined by the options will be executed. '\
               '                                                            '\
               '                                                            '\
               'NOTE: Must specify both options \'--actual_metric\' and \'--predicted_metric\' '\
               'when using the option \'--pred_error\'.'

        # Command line options to control the tool's behavior.
        #
        util.CheckNonPrintChar(sys.argv)
        parser = optparse.OptionParser(usage=us, description=desc, version=ver)
        cmd_options.debug(parser)
        cmd_options.pred_error(parser, '')
        cmd_options.actual_metric(parser)
        cmd_options.pinplayhome(parser, '')
        cmd_options.predicted_metric(parser)
        cmd_options.verbose(parser)

        # Parse the command line options.
        #
        (options, args) = parser.parse_args()

        # Added method cbsp() to 'options' to check if running CBSP.
        #
        util.AddMethodcbsp(options)

        # Error if no arguments or options on command line.
        #
        if len(sys.argv) == 1:
            msg.PrintAndExit(
                'Give either the name of a directory containing\n'
                'simulator data files or one, or more, options on the command line.\n'
                'See \'-h\' for more info.')

        # Make sure all required options are given if user wants prediction
        # error.
        #
        if options.pred_error:
            if options.predicted_metric == '' or options.actual_metric == '':
                msg.PrintAndExit('Must give both \'--predicted_metric\' and '
                                 '\'--actual_metric\' with \'--pred_error\'.')

        predicted_dir = ''
        actual_dir = ''
        if len(args) == 1:
            # If there are only 2 arguments, assume just calculating predicted
            # metric.  Check to see if a valid directory name was given on the
            # command line.
            #
            dir_found = False
            for dir_name in args:
                if os.path.isdir(os.path.realpath(dir_name)):
                    dir_found = True
                    break
            if not dir_found:
                msg.PrintAndExit(
                    '\'' + sys.argv[1] + '\' is not a valid directory.\n'
                    'Give either the name of a directory containing simulator data files \n'
                    'or one, or more, options on the command line.\n'
                    'See \'-h\' for more info.')
            predicted_dir = os.path.realpath(dir_name)
        else:
            # Check directories given as arguments to options to make sure they exist.
            #
            if options.predicted_metric:
                predicted_dir = os.path.realpath(options.predicted_metric)
                if not os.path.isdir(predicted_dir):
                    msg.PrintAndExit('Predicted metric directory does not exist: ' + \
                        options.predicted_metric)
            if options.actual_metric:
                actual_dir = os.path.realpath(options.actual_metric)
                if not os.path.isdir(actual_dir):
                    msg.PrintAndExit('Actual metric directory does not exist: ' + \
                        options.actual_metric)

        # Set the global variables in config object from the options.  Thus, if the
        # user sets option 'pinplayhome' on the command line, it will be used when
        # determining which kit to use.
        #
        # import pdb;  pdb.set_trace()
        gv = config.GlobalVar()
        gv.SetGlobalVars(options)
        self.kit_obj = self.GetKit()

        return (predicted_dir, actual_dir, options)
Ejemplo n.º 11
0
    def ParseCommandLine(self):
        """
        Process command line arguments and read in config file/globals.

        @return List of options parsed from command line
        """

        version = '$Revision: 1.11 $'
        version = version.replace(' ', '')
        ver = version.replace(' $', '')
        us = '%prog <phase> --cbsp_cfgs CFG_FILE,CFG_FILE[,CFG_FILE]  [options] '
        desc = 'This script uses Cross Binary SimPoint (CBSP) and PinPlay tools ' \
               'to create a set of equal-work traces from two, or more, binaries compiled from the same source.\n\n'\
               '' \
               'At least one command line option must be given to chose the phase(s) of the script to run. ' \
               'Use option \'--default_phases\' to run all phases. '  \
               'See section "Phase options" for a list of phases. \n\n'\
               '' \
               'The option \'--cbsp_cfgs\' is also required to run this scripts.  It contains a list of PinPlay configuration '\
               'files.  Each file defines one of the binaries to be traced.  (See \'sde_pinpoints.py -h\' for more info on PinPlay config files.)\n\n'\
               '' \
               'Optional master CBSP config files may be given with the option \'-cfg\'.  The parameters '\
               'defined in each master cfg file are used for every binary.  Master CBSP config files are not required.\n\n'\
               '' \
               'Master CBSP cfg files are processed in order.  '\
               'Command line options over-ride values read from master CBSP configuration files. '\
               'The long option name, '\
               'not the single letter option, must be used in the config files.\n\n'\
               '' \
               'The parameter \'cbsp_name\' MUST be defined in at least one configuration file in order '\
               'to run this script.  It may be defined in master/binary CBSP config files or by command line option.\n\n'\
               '' \
               'Example configuration file:'\
               '                                                            '\
               '--------------------------------------------'\
               '                                                            '\
               '[Parameters]'\
               '                                                            '\
               'cbsp_name:     lipack_test'\
               '                                                            '\
               'program_name:  linpack'\
               '                                                            '\
               'input_name:    avx'\
               '                                                            '\
               'command:       AVX_linpack 8'\
               '                                                            '\
               'mode:          st'\
               '                                                            '\
               '--------------------------------------------\n\n'\
               '' \
               'Advanced Usage: Since CBSP is an extension of PinPlay, it\'s possible to combine the two '\
               'tool chains to generate traces.   For example, you can use sde_pinplay.py to generate whole program '\
               'pinballs in parallel (possibly using NetBatch).  Then use the CBSP script to run the \'cb_match\' '\
               'and \'simpoint\' phases to select equivalent work clusters in each binary.  Finally, you can run '\
               'sde_pinpoints.py with NetBatch to generate region pinballs/LIT files in parallel.\n\n'\
               '' \
               'If using this method, you must use the configuration file for just one binary with each invocation of '\
               'the sde_pinpoints.py script.  Also, in order to combine these tools, you must add the option '\
               '\'--add_program_wp\' to each sde_pinpoints.py run.  This is required so the directories names '\
               'generated/used by the two chains are compatible.  '\
               '' 


        util.CheckNonPrintChar(sys.argv)
        parser = optparse.OptionParser(
            usage=us,
            description=desc,
            version=ver,
            formatter=cmd_options.BlankLinesIndentedHelpFormatter())

        # Command line options to control the tools behavior. These are not in any
        # of the option groups.
        #
        # import pdb;  pdb.set_trace()
        cmd_options.add_program_wp(parser)
        cmd_options.append_status(parser)
        cmd_options.cbsp_cfgs(parser)
        cmd_options.config_file(parser)
        cmd_options.debug(parser)
        cmd_options.delete(parser)
        cmd_options.delete_all(parser)
        # cmd_options.dir_separator(parser)  # Only works for PinPlay, need to fix for CBSP
        cmd_options.log_options(parser)
        cmd_options.pintool(parser)
        cmd_options.pin_options(parser)
        cmd_options.replay_options(parser)
        cmd_options.save_global(parser)
        cmd_options.verbose(parser)

        self.AddAdditionalOptions(parser)

        # Top level command line options in the default group allow the user
        # to choose the phases to run.
        #
        phase_group = cmd_options.PhaseGroup(parser)

        self.default_phases(parser, phase_group)
        cmd_options.log(parser, phase_group)
        cmd_options.cb_match(parser, phase_group)
        cmd_options.simpoint(parser, phase_group)
        cmd_options.region_pinball(parser, phase_group)

        self.AddAdditionalPhaseOptions(parser, phase_group)

        parser.add_option_group(phase_group)

        # Top level command line options in param group are used to set various
        # tracing parameters.
        #
        param_group = cmd_options.ParameterGroup(parser)

        cmd_options.cbsp_name(parser, param_group)
        cmd_options.input_name(parser, param_group)
        cmd_options.num_cores(parser, param_group)
        cmd_options.program_name(parser, param_group)
        self.KitOption(parser, param_group)

        parser.add_option_group(param_group)

        # Top level command line options which only apply to the Simpoint phase.
        #
        simpoint_phase_group = cmd_options.SimpointPhaseGroup(parser)

        cmd_options.maxk(parser, simpoint_phase_group)
        cmd_options.simpoint_options(parser, simpoint_phase_group)
        cmd_options.slice_size(parser, simpoint_phase_group)

        parser.add_option_group(simpoint_phase_group)

        # Top level command line options which only apply to the region pinball generation phase.
        #
        region_pb_phase_group = cmd_options.RegionPBPhaseGroup(parser)

        cmd_options.epilog_length(parser, region_pb_phase_group)
        cmd_options.prolog_length(parser, region_pb_phase_group)
        cmd_options.warmup_length(parser, region_pb_phase_group)

        parser.add_option_group(region_pb_phase_group)

        # Top level command line options in modify group modify the behavior of phases.
        #
        modify_group = cmd_options.ModifyGroup(parser)

        # These should go before the rest of the modify options.
        #
        # cmd_options.coop_pinball(parser, modify_group)
        cmd_options.cross_os(parser, modify_group)
        cmd_options.list(parser, modify_group)

        parser.add_option_group(modify_group)

        # Parse the command line options.
        #
        # import pdb;  pdb.set_trace()
        (options, args) = parser.parse_args()

        # Added method cbsp() to 'options' to check if running CBSP.
        #
        util.AddMethodcbsp(options)

        # Check to make sure there was at least one command line option given.
        #
        # import pdb;  pdb.set_trace()
        if len(sys.argv) == 1:
            msg.PrintMsg(
                "\nERROR: Must use command line options to chose at least one phase to run.\n"
                "Use the option '--default_phases' to run the default phases. Use '--help' for more info.")
            util.CheckResult(-1, options,
                             'Check command line options - no phase given')

        # User must give option/parameter 'cbsp_cfgs' (unless deleting files).
        #
        # import pdb;  pdb.set_trace()
        if not options.delete_all and \
           (not hasattr(options, 'cbsp_cfgs') or not options.cbsp_cfgs):
            msg.PrintMsg(
                '\nERROR: Must give list of configuration files for the CBSP binaries\n'
                'using parameter \'--cbsp_cfgs\'.')
            util.CheckResult(-1, options, 'Check command line options - '
                             'Looking for parameter \'cbsp_cfgs\'.')

        # Get a list of the parameters for each CBSP binary.  
        #
        # import pdb;  pdb.set_trace()
        bin_options = self.Config.GetAllCBSPBinParams(options)

        # Added method cbsp() to 'options' to check if running CBSP.
        #
        util.AddMethodcbsp(options)

        # Now that we have all the parameters, create a new status file or,
        # zero out the file if it already exists.  Need all the parameters
        # because 'cbsp_name' is used as part of the status file name. If user
        # sets parameter 'append_status', the old file is not deleted.
        #
        util.NewStatusFile(options, cbsp=True)

        # Ensure each binary has a unique program_name/input_name
        #
        all_names = set()
        for bopts in bin_options:
            name = '%s %s' % (bopts.program_name, bopts.input_name)
            if name in all_names:
                msg.PrintMsg(
                    '\nERROR: Must have unique program_name & input_name for '
                    'each binary.\n'
                    'Found duplicates: %s' % name)
                util.CheckResult(-1, options, 'Check command line options - '
                                 'Found duplicate program_name & input_name')
            all_names.add(name)

        # For debugging, print out the WP directory names for each binary
        #
        if hasattr(options, 'verbose') and options.verbose:
            for bopts in bin_options:
                msg.PrintMsg('WP dir: ' + util.GetDefaultWPDir(bopts))

        # Once the tracing configuration parameters are read, get the kit in
        # case sdehome/pinplayhome was set on the command line or in a config
        # file.  Also, need to reset paths to kit/scripts in object 'self' and
        # set the kit in self.phases.
        #
        kit_obj = self.GetKit()
        self.path = kit_obj.path
        self.script_path = kit_obj.script_path
        self.phases.SetKit(kit_obj)

        # If required, check to see if there any 'forbidden' char in some of
        # the parameters.
        #
        if self.kit_type == config.SDE and hasattr(options,
                                                   'spec') and not options.spec:
            self.Config.CheckForbiddenChar()

        # Do some 'special' things on native Windows.
        #
        util.WindowsNativeCheck(options)

        return options, bin_options
Ejemplo n.º 12
0
    def ParseCommandLine(self):
        """
        Parse command line arguments and returns pin and tools options and app command line.

        @return List containing: options
        """

        # command line options for the driver
        #
        version = '$Revision: 1.81 $'
        version = version.replace('$Revision: ', '')
        ver = version.replace(' $', '')
        us = '%prog [options] --mode MODE --log_file FILE binary args'
        desc = 'Runs binary with the logger Pintool and generates whole program '\
               'pinballs. Required arguments include:\n'\
               '   1) Binary to run and it\'s arguments.\n'\
               '   2) Name for the log file (pinball) using \'--log_file FILE\'\n'\
               '         Name can include a dir as well as a file.\n' \
               '   3) Mode of the binary using \'--mode MODE\'.'

        util.CheckNonPrintChar(sys.argv)
        parser = optparse.OptionParser(
            usage=us,
            description=desc,
            version=ver,
            formatter=cmd_options.BlankLinesIndentedHelpFormatter())

        # Define the command line options which control the behavior of the
        # script.  Some of these methods take a 2nd argument which is the empty
        # string ''.   If the script uses option groups, then this parameter is
        # the group.  However, this script does not use option groups, so the
        # argument is empty.
        #

        cmd_options.compressed(parser, '')
        cmd_options.config_file(parser)
        cmd_options.debug(parser)
        cmd_options.global_file(parser)
        cmd_options.list(parser, '')
        cmd_options.log_file(parser)
        cmd_options.log_options(parser)
        cmd_options.mode(parser, '')
        cmd_options.mpi_options(parser, '')
        cmd_options.msgfile_ext(parser)
        cmd_options.no_log(parser)
        cmd_options.num_proc(parser, '')
        cmd_options.pid(parser)
        cmd_options.pinplayhome(parser, '')
        cmd_options.pintool(parser)
        cmd_options.pin_options(parser)
        cmd_options.save_global(parser)
        cmd_options.sdehome(parser, '')
        cmd_options.verbose(parser)

        # import pdb;  pdb.set_trace()
        (options, args) = parser.parse_args()

        # Read in configuration files and set global variables.
        # No need to read in a config file.
        #
        config_obj = config.ConfigClass()
        config_obj.GetCfgGlobals(options,
                                 False)  # No, don't need required parameters

        # Make sure user gave an application mode
        #
        if options.mode:
            options.mode = util.ParseMode(options.mode)
        else:
            parser.error(
                "Application mode was not given.\n"
                "Need to use option --mode MODE. Choose MODE from: 'st', 'mt', 'mpi', 'mpi_mt', 'mp', 'mp_mt',"
            )

        # Log file name must be given.
        #
        # import pdb;  pdb.set_trace()
        if options.log_file == '':
            parser.error('Log file basename was not given.\n' \
                'Must give basename with option: --log_file FILE')

        # Get the application command line
        #
        # import pdb;  pdb.set_trace()
        cmd_line = " ".join(args)
        if not options.pid:
            if cmd_line:
                setattr(options, 'command', cmd_line)
            else:
                parser.error('no program command line specified.\n'
                             'Need to add binary and it\'s arguments.')

        return options