liberty/support/FullLoopProf/FullLoopProf.cpp
//vector<int> *loopStack; // Track what the current loop stack looks like
//vector<int> *loopAccounted; // Track if this loop has been counted yet
vector *loopStack; // Track what the current loop stack looks like
vector *loopAccounted; // Track if this loop has been counted yet
vector * loopStack ; // Track what the current loop stack looks like vector * loopAccounted ; // Track if this loop has been counted yet
void loopProfInit(int numLoops)
{
  withinRuntime = true;
  loopStack = new vector<int>();
  loopAccounted = new vector<int>();
  gnumLoops = numLoops + 1;
  loopCounts = (unsigned long*)calloc(gnumLoops, sizeof(unsigned long));
  loopAccounted->resize(gnumLoops);
  struct sigaction replacement;
  replacement.sa_flags = SA_SIGINFO;
  sigemptyset( &replacement.sa_mask );
  replacement.sa_sigaction = & timer_handler;
  sigaction(SIGVTALRM, &replacement, 0);
  struct itimerval interval;
  interval.it_interval.tv_sec = 0;
  interval.it_interval.tv_usec = Period;
  interval.it_value.tv_sec = 0;
  interval.it_value.tv_usec = Period;
  setitimer(ITIMER_VIRTUAL, &interval, 0);
  atexit(loopProfFinish);
  withinRuntime = false;
  loopProf_invocation(0);
}
void loopProfInit ( int numLoops ) { withinRuntime = true ; loopStack = new vector < int > ( ) ; loopAccounted = new vector < int > ( ) ; gnumLoops = numLoops + 1 ; loopCounts = ( unsigned long * ) calloc ( gnumLoops , sizeof ( unsigned long ) ) ; loopAccounted -> resize ( gnumLoops ) ; struct sigaction replacement ; replacement . sa_flags = SA_SIGINFO ; sigemptyset ( & replacement . sa_mask ) ; replacement . sa_sigaction = & timer_handler ; sigaction ( SIGVTALRM , & replacement , 0 ) ; struct itimerval interval ; interval . it_interval . tv_sec = 0 ; interval . it_interval . tv_usec = Period ; interval . it_value . tv_sec = 0 ; interval . it_value . tv_usec = Period ; setitimer ( ITIMER_VIRTUAL , & interval , 0 ) ; atexit ( loopProfFinish ) ; withinRuntime = false ; loopProf_invocation ( 0 ) ; }
vector<int> *loopStack; // Track what the current loop stack looks like
vector<int> *loopAccounted; // Track if this loop has been counted yet
vector<int > * loopStack ; // Track what the current loop stack looks like vector<int > * loopAccounted ; // Track if this loop has been counted yet
// Set up a signal handler for SIG VTALRM // Set the itimer to give us interrupts // at a regular interval.