CPU测试程序代码,Windows VS Linux


一直想估计一下自己的cpu每秒能大概运算多少次

#include <time.h>
#include <iostream>
using namespace std;
int main(){
time_t one, two, three;
one=time(NULL);
two=time(NULL)+2;
three=time(NULL)+1;
int x=0;
while(two!=one) {
one=time(NULL);
if(three==one) x++;
}
cout<<x<<endl;
return 0;
}

测试结果 amd 2000+ ddr400 512M Windows xp vc++6

108万次左右 每秒

赛扬400MHZ sdram pc100 128M linux mandrake8 gcc 2.9.6

123万次左右 每秒

结果很意外 难道400MHZ能跑过1.58GHZ的cpu,或者Linux比Windows强悍这么多?

相关内容