Pin
Classes | Enumerations | Functions | Variables
KNOB: Commandline Option Handling

Classes

class  KNOBVALUE< TYPE >
 
class  KNOBVALUE_LIST< TYPE >
 
class  KNOB_BASE
 
class  KNOB< TYPE >
 
class  KNOB_COMMENT
 
class  ADDRESS_RANGE
 

Enumerations

enum  KNOB_MODE {
  KNOB_MODE_INVALID,
  KNOB_MODE_COMMENT,
  KNOB_MODE_WRITEONCE,
  KNOB_MODE_OVERWRITE,
  KNOB_MODE_ACCUMULATE,
  KNOB_MODE_APPEND,
  KNOB_MODE_LAST
}
 

Functions

 KNOB_BASE::KNOB_BASE (const std::string &myprefix, const std::string &myname, const std::string &myfamily, const std::string &mydefault, const std::string &mypurpose, KNOB_MODE mymode=KNOB_MODE_WRITEONCE)
 
STATIC VOID KNOB_BASE::CheckAllKnobs (BOOL allowDashes=FALSE)
 
STATIC UINT32 KNOB_BASE::NumberOfKnobs ()
 
STATIC VOID KNOB_BASE::DisableKnobFamily (const std::string &myfamily)
 
STATIC VOID KNOB_BASE::EnableKnobFamily (const std::string &myfamily)
 
STATIC VOID KNOB_BASE::DisableKnob (const std::string &myname)
 
STATIC VOID KNOB_BASE::EnableKnob (const std::string &myname)
 
STATIC std::string KNOB_BASE::StringKnobSummary ()
 
STATIC std::string KNOB_BASE::StringLongAll ()
 
STATIC KNOB_BASEKNOB_BASE::FindKnob (const std::string &name)
 
STATIC KNOB_BASEKNOB_BASE::FindFamily (const std::string &name)
 
STATIC KNOB_BASEKNOB_BASE::FindEnabledKnob (const std::string &name)
 
int KNOB_BASE::Compare (const KNOB_BASE &k2) const
 
VOID KNOB_BASE::TurnOnSetByUser ()
 
BOOL KNOB_BASE::SetByUser () const
 

Variables

KNOB< BOOL > KnobSlowAsserts
 

Detailed Description

Knobs automate the parsing and management of command line switches. A command line contains switches for Pin, the tool, and the application. The knobs parsing code understands how to separate them.

Availability:
Mode: JIT & Probe
O/S: Linux & Windows
CPU: All

Enumeration Type Documentation

◆ KNOB_MODE

enum KNOB_MODE

This module contains routines and classes for the processing of command line arguments.

Per knob mode - indicates how multiple appearances of the mode on the command line are handled

Enumerator
KNOB_MODE_COMMENT 

comment for knob family

KNOB_MODE_WRITEONCE 

single value, single write

KNOB_MODE_OVERWRITE 

single value, overwrite, unless the user set the knob from command line.

KNOB_MODE_ACCUMULATE 

single value, update

KNOB_MODE_APPEND 

list of values, append

Function Documentation

◆ CheckAllKnobs()

STATIC VOID KNOB_BASE::CheckAllKnobs ( BOOL  allowDashes = FALSE)

Check for duplicates amongst the declared knobs

◆ Compare()

int KNOB_BASE::Compare ( const KNOB_BASE k2) const
Returns
TRUE if two knobs are identical.

◆ DisableKnob()

STATIC VOID KNOB_BASE::DisableKnob ( const std::string &  myname)

Disable a particular knob

Parameters
mynameThe particular knob to disable

◆ DisableKnobFamily()

STATIC VOID KNOB_BASE::DisableKnobFamily ( const std::string &  myfamily)

Disable all options within a given family of knobs

Parameters
myfamilyThe family to disable

◆ EnableKnob()

STATIC VOID KNOB_BASE::EnableKnob ( const std::string &  myname)

Enable a particular knob

Parameters
mynameThe knob to enable

◆ EnableKnobFamily()

STATIC VOID KNOB_BASE::EnableKnobFamily ( const std::string &  myfamily)

Enable all options within a given family of knobs

Parameters
myfamilyThe family to enable

◆ FindEnabledKnob()

STATIC KNOB_BASE* KNOB_BASE::FindEnabledKnob ( const std::string &  name)

Search for a knob that is currently not disabled

Parameters
mynameThe name of the knob to search which is currently enabled

◆ FindFamily()

STATIC KNOB_BASE* KNOB_BASE::FindFamily ( const std::string &  name)

Search for a knob family

Parameters
familyThe family of knobs to locate

◆ FindKnob()

STATIC KNOB_BASE* KNOB_BASE::FindKnob ( const std::string &  name)

Locate a knob from the list of declared knobs

Parameters
mynameThe name of the knob to locate

◆ KNOB_BASE()

KNOB_BASE::KNOB_BASE ( const std::string &  myprefix,
const std::string &  myname,
const std::string &  myfamily,
const std::string &  mydefault,
const std::string &  mypurpose,
KNOB_MODE  mymode = KNOB_MODE_WRITEONCE 
)

Create a new knob

Parameters
mynameName of the knob
myfamilyFamily to which the knob belongs to
mydefaultThe default value to which the knob is initialized with
mypurposeA string that explains the purpose of the knob
mymodeKNOB_MODE

◆ NumberOfKnobs()

STATIC UINT32 KNOB_BASE::NumberOfKnobs ( )
Returns
The total number of knobs that have been declared

◆ SetByUser()

BOOL KNOB_BASE::SetByUser ( ) const
Returns
TRUE if the user set the knob from command line, FALSE otherwise.

◆ StringKnobSummary()

STATIC std::string KNOB_BASE::StringKnobSummary ( )

Print out a summary of all the knobs declared:

  • The maximum line length in the print is 116
  • If the line exceeds the maximum length of the line, the line will be cut at the last space before the 116th character
  • If no space is found the line will be cut at the maximum length, which is 110

◆ StringLongAll()

STATIC std::string KNOB_BASE::StringLongAll ( )

x

◆ TurnOnSetByUser()

VOID KNOB_BASE::TurnOnSetByUser ( )

Mark that this knob was set from command line.

Variable Documentation

◆ KnobSlowAsserts

KNOB< BOOL > KnobSlowAsserts

Knob for deciding whether using expensive sanity checks.