MT_ALARM_ICOUNT
[ALARM]


Classes

class  INSTLIB::MT_ALARM_ICOUNT
class  MT_ALARM_ICOUNT

Functions

INT64 INSTLIB::MT_ALARM_ICOUNT::Count (THREADID tid=0) const
VOID INSTLIB::MT_ALARM_ICOUNT::SetAlarm (INT64 count, ALARM_HANDLER handler, VOID *val, THREADID tid=0, BOOL rearm=FALSE, BOOL always_armed=FALSE)
VOID INSTLIB::MT_ALARM_ICOUNT::Activate ()
VOID INSTLIB::MT_ALARM_ICOUNT::ReActivate ()
VOID INSTLIB::MT_ALARM_ICOUNT::DeActivate ()
BOOL INSTLIB::MT_ALARM_ICOUNT::Active () const
INT64 MT_ALARM_ICOUNT::Count (THREADID tid=0) const
VOID MT_ALARM_ICOUNT::SetAlarm (INT64 count, ALARM_HANDLER handler, VOID *val, THREADID tid=0, BOOL rearm=FALSE, BOOL always_armed=FALSE)
VOID MT_ALARM_ICOUNT::Activate ()
VOID MT_ALARM_ICOUNT::ReActivate ()
VOID MT_ALARM_ICOUNT::DeActivate ()
BOOL MT_ALARM_ICOUNT::Active () const

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 MT_ALARM_ICOUNT::Activate  )  [inline, inherited]
 

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

VOID INSTLIB::MT_ALARM_ICOUNT::Activate  )  [inline, inherited]
 

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

BOOL MT_ALARM_ICOUNT::Active  )  const [inline, inherited]
 

Is this MT_ALARM_ICOUNT active?

BOOL INSTLIB::MT_ALARM_ICOUNT::Active  )  const [inline, inherited]
 

Is this MT_ALARM_ICOUNT active?

INT64 MT_ALARM_ICOUNT::Count THREADID  tid = 0  )  const [inline, inherited]
 

Returns:
Remaining count for this alarm

INT64 INSTLIB::MT_ALARM_ICOUNT::Count THREADID  tid = 0  )  const [inline, inherited]
 

Returns:
Remaining count for this alarm

VOID MT_ALARM_ICOUNT::DeActivate  )  [inline, inherited]
 

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

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

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

VOID MT_ALARM_ICOUNT::ReActivate  )  [inline, inherited]
 

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

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

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

VOID MT_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 times to execution address before alarm fires
handler Call this function when alarm fires
val Pass this value to the handler when the alarm fires

VOID INSTLIB::MT_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 times to execution address before alarm fires
handler Call this function when alarm fires
val Pass this value to the handler when the alarm fires


Generated on Thu Jun 18 03:16:17 2009 for Pin by  doxygen 1.4.6