rdtsc测试结果

user1 于 2023-01-30 07:17:23 发表


#include <stdio.h>
#include <time.h>
int x[50000000];
extern"C"{unsigned rdtsc();}
asm("rdtsc:rdtsc;ret");
int main() {
  for (int j=0; j<128; ++j) {
    unsigned clk = rdtsc();
    for (int i=64; i<50000000; i+=64) {
        x[i] = 0x7fffffff / i;
    }
    printf ("%d
", rdtsc()-clk);
  }
}

Submitting ...
Compile OK
Time (ms): 953.996496
Memory (KiB): 195324
Status: Run Finished
>>>>>>> stdout (first 512 bytes) <<<<<<<
60787204
25660478
27252994
27454562
26749090
26655624

Submitting ...
Compile OK
Time (ms): 927.647111
Memory (KiB): 195324
Status: Run Finished
>>>>>>> stdout (first 512 bytes) <<<<<<<
60817464
27145144
27007746
26576470
25515314
27512524

Submitting ...
Compile OK
Time (ms): 928.938535
Memory (KiB): 195324
Status: Run Finished
>>>>>>> stdout (first 512 bytes) <<<<<<<
60888146
27027598
26478170
26740308
26164876
26633918

Submitting ...
Compile OK
Time (ms): 928.076252
Memory (KiB): 195324
Status: Run Finished
>>>>>>> stdout (first 512 bytes) <<<<<<<
60823788
26694018
27382764
26426884
27596062
27599398

Submitting ...
Compile OK
Time (ms): 929.627885
Memory (KiB): 195324
Status: Run Finished
>>>>>>> stdout (first 512 bytes) <<<<<<<
60895656
26411350
27283046
27281102
25714368
24650182

Judge Duck Online | 评测鸭在线
Server Time: 2024-11-23 16:05:39 | Loaded in 5 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠