【问题标题】:How to set dhrystone benchmark clock rate for emulator?如何为模拟器设置 dhrystone 基准时钟速率?
【发布时间】:2015-06-24 16:26:16
【问题描述】:

我通常在 linux 中使用 sysconfig(_SC_CLK_TCK) 来获取时钟频率(总是返回 100)。问题是我想将 dhrystone 基准与 Atari Mint (TOS) 一起使用。我在一个名为 ARanyM 的模拟器上安装了 atari mint。我在这里也使用了 sysconfig(_SC_CLK_TCK) 但它返回类似 4294967295 (这实际上是 32 位中的所有 1 值)

有没有机构有任何建议?

【问题讨论】:

    标签: linux linux-kernel benchmarking virtualization emulation


    【解决方案1】:

    我使用 Linux:

      #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);  
     }
    

    【讨论】:

    • 感谢您的回复,但请确定 :) 是否回答了所需的时钟频率?再次感谢您的帮助:)
    猜你喜欢
    • 1970-01-01
    • 2023-03-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-04
    • 1970-01-01
    • 1970-01-01
    • 2020-11-20
    相关资源
    最近更新 更多