Ejemplo n.º 1
0
void *idle(void *threadid)
{
  struct timeval timeNow;

  pthread_mutex_lock(&msgSem);
  CScnt++;

  do
  {
    FIB_TEST(seqIterations, Iterations);
    idleCount[(int)threadid]++;
  } while(idleCount[(int)threadid] < runInterference);

  sleep(2);

  idleCount[(int)threadid]=0;

  do
  {
    FIB_TEST(seqIterations, Iterations);
    idleCount[(int)threadid]++;
  } while(idleCount[(int)threadid] < runInterference);

  pthread_mutex_unlock(&msgSem);

  gettimeofday(&timeNow,NULL);
  printf("**** %d idle stopping at %d sec, %d usec\n", (int)threadid, (int)timeNow.tv_sec, (int)timeNow.tv_usec);

  pthread_exit(NULL);
}
void *fibSeq(void *threadid)
{
   UINT64 fib = 0, fib0 = 0, fib1 = 1;
   UINT32 idx = 0, jdx = 1;

//-----------------------------------------------------------------
///CODE ADDED HERE
   nowTOD = readTOD();
   syslog(LOG_INFO, "\nStarting Thread %d \n",threadid);
   syslog(LOG_INFO, "\nTimeis:%lf sec \n", nowTOD);
//=================================================================

   // START Timed Fibonacci Test
   FIB_TEST(seqIterations, Iterations);

   //printf("\nFibonacci(%llu)=%llu\n", seqIterations, fib);
   //printf("fibSeq %d stopping\n", threadid);
   //pthread_exit(threadid);
//-----------------------------------------------------------------
///CODE ADDED HERE
   nowTOD = readTOD();
   syslog(LOG_INFO, "\nExiting Thread %d \n",threadid);
   syslog(LOG_INFO, "\nTimeis:%lf sec \n", nowTOD);
//=================================================================
}
Ejemplo n.º 3
0
void *idleNoSem(void *threadid)
{
  struct timeval timeNow;

  do
  {
    FIB_TEST(seqIterations, Iterations);
    idleCount[(int)threadid]++;
  } while(idleCount[(int )threadid] < runInterference);

  gettimeofday(&timeNow,NULL);
  printf("**** %d idle NO SEM stopping at %d sec, %d usec\n", (int)threadid, (int)timeNow.tv_sec, (int)timeNow.tv_usec);

  pthread_exit(NULL);
}
void wrapper(void)
{
  FIB_TEST(seqIter, loopIter);
}