How to set dhrystone benchmark clock rate for emulator?

186 Views Asked by At

I usually use sysconfig(_SC_CLK_TCK) in linux to get the clock rate (which always returns 100). The problem is I want to use dhrystone benchmark with Atari Mint (TOS). I installed atari mint on an emulator called ARanyM. I used sysconfig(_SC_CLK_TCK) here also but it return something like 4294967295 (this actually all 1 value in 32-bit)

Does any body has any suggestions ?

1

There are 1 best solutions below

1
On

With Linux I use:

  #include <time.h>

  double  theseSecs = 0.0;
  double  startSecs = 0.0;
  double  secs;
  double  CPUsecs = 0.0;
  double  CPUutilisation = 0.0;

  double  answer = 0;

  clock_t starts;

  void start_CPU_time()
  {      
      starts = clock();;
      return;
  }

  void end_CPU_time()
  {
      CPUsecs = (double)(clock() - starts)/(double)CLOCKS_PER_SEC;
      return;
  }    



  struct timespec tp1;
  void getSecs()
  {
     clock_gettime(CLOCK_REALTIME, &tp1);
     theseSecs =  tp1.tv_sec + tp1.tv_nsec / 1e9;           
     return;
  }

  void start_time()
  {
      getSecs();
      startSecs = theseSecs;
      return;
  }

  void end_time()
  {
      getSecs();
      secs    = theseSecs - startSecs;
      return;
  }    

  void calculate()
  {
      int i, j;
      for (i=1, i<1000001; i++)
      {
          for (i=j, j<1000001; j++)
          {
              answer = answer * (float)i / 1000000.0;
          }
      }
  }

 void main()
 {
     start_time();
     start_CPU_time();
     calculate();
     end_time();
     end_CPU_time();
     CPUutilisation = CPUsecs /  secs / 100.0;
     printf"/n Answer %8.3f, Elapsed Time %7.4f, CPU Time %7.4f,
            CPU Utilisation %8.4f/n, answer, secs, CPUsecs, CPUutilisation);  
 }