Modules | |
CONTROLLER_LENGTH | |
CONTROLLER_START_ADDRESS | |
CONTROLLER_STOP_ADDRESS | |
CONTROLLER_FINI | |
CONTROLLER_SKIP | |
CONTROLLER_UNIFORM | |
CONTROLLER_INIT | |
CONTROLLER_PINPOINT | |
CONTROLLER_MULTI | |
CONTROLLER_STATS_EVENT_ADDRESS | |
Typedefs | |
typedef VOID(* | INSTLIB::CONTROL_HANDLER )(CONTROL_EVENT, VOID *, CONTEXT *, VOID *, THREADID tid) |
Enumerations | |
enum | INSTLIB::CONTROL_EVENT { CONTROL_INVALID, INSTLIB::CONTROL_START, INSTLIB::CONTROL_STOP } |
A controller is usually an ALARM with some coordination for stop and start and some built in command line switches.
The example below can be found in InstLibExamples/control.cpp
#include <iostream> #include "pin.H" #include "instlib.H" using namespace INSTLIB; // Track the number of instructions executed ICOUNT icount; // Contains knobs and instrumentation to recognize start/stop points CONTROL control(false, "controller_"); VOID Handler(CONTROL_EVENT ev, VOID * v, CONTEXT * ctxt, VOID * ip, THREADID tid) { std::cout << "ip: " << ip << " " << icount.Count() ; #if defined(TARGET_IA32) || defined(TARGET_IA32E) std::cout << " [ with REP iterations " << icount.CountWithREP() << "] "; #endif switch(ev) { case CONTROL_START: std::cout << "Start" << endl; break; case CONTROL_STOP: std::cout << "Stop" << endl; break; default: ASSERTX(false); break; } } INT32 Usage() { cerr << "This pin tool demonstrates use of CONTROL to identify start/stop points in a program\n" "\n"; cerr << KNOB_BASE::StringKnobSummary() << endl; return -1; } // argc, argv are the entire command line, including pin -t <toolname> -- ... int main(int argc, char * argv[]) { if( PIN_Init(argc,argv) ) { return Usage(); } icount.Activate(); // Activate alarm, must be done before PIN_StartProgram control.CheckKnobs(Handler, 0); // Start the program, never returns PIN_StartProgram(); return 0; }
|
Type for generic event handler |
|
Event that is passed to handler when controller detects the beginning or end of an interval |