ALARM_ICOUNT
[ALARM]


Classes

class  INSTLIB::ALARM_ICOUNT

Functions

VOID INSTLIB::ALARM_ICOUNT::SetAlarm (INT64 count, ALARM_HANDLER handler, VOID *val, THREADID tid=0, BOOL rearm=FALSE, BOOL always_armed=FALSE)
VOID INSTLIB::ALARM_ICOUNT::Activate (UINT32 low_tid=0, UINT32 high_tid=0)
VOID INSTLIB::ALARM_ICOUNT::ReActivate ()
VOID INSTLIB::ALARM_ICOUNT::DeActivate ()

Detailed Description

Signal an alarm when the specified number of instructions has been executed

The example below can be found in InstLibExamples/alarm_icount.cpp

#include <iostream>

#include "pin.H"
#include "instlib.H"

INSTLIB::ALARM_ICOUNT ialarm;

VOID Handler(VOID * val, CONTEXT * ctxt, VOID * ip, THREADID tid)
{
    INSTLIB::ALARM_ICOUNT * al = static_cast<INSTLIB::ALARM_ICOUNT *>(val);
    
    std::cout << "Alarm fired, resetting" << endl;
    al->SetAlarm(50000, Handler, al);
}
    
// argc, argv are the entire command line, including pin -t <toolname> -- ...
int main(int argc, char * argv[])
{
    // Initialize pin
    PIN_Init(argc, argv);

    // Activate alarm, must be done before PIN_StartProgram
    ialarm.Activate();

    ialarm.SetAlarm(50000, Handler, &ialarm);
    
    // Start the program, never returns
    PIN_StartProgram();
    
    return 0;
}



Function Documentation

VOID INSTLIB::ALARM_ICOUNT::Activate UINT32  low_tid = 0,
UINT32  high_tid = 0
[inline, inherited]
 

This function initializes an alarm and must be called before PIN_StartProgram. It does turn the alarm on. Use SetAlarm.

VOID INSTLIB::ALARM_ICOUNT::DeActivate  )  [inline, inherited]
 

De-activate the counter, should call PIN_RemoveInstrumentation() after de-activating

VOID INSTLIB::ALARM_ICOUNT::ReActivate  )  [inline, inherited]
 

This function re-enables the alarm following a DeActivate(); must have called Activate() before.

VOID INSTLIB::ALARM_ICOUNT::SetAlarm INT64  count,
ALARM_HANDLER  handler,
VOID *  val,
THREADID  tid = 0,
BOOL  rearm = FALSE,
BOOL  always_armed = FALSE
[inline, inherited]
 

Turn on an alarm. You should call Activate for this alarm before PIN_StartProgram

Parameters:
count Number of instructions to execute before alarm fires
handler Call this function when alarm fires
val Pass this value to the handler when the alarm fires


Generated on Tue Nov 22 12:28:41 2011 for Pin by  doxygen 1.4.6