如何编写C++代码简单测试一下x86和arm的CPU性能
Posted zhangrelay
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何编写C++代码简单测试一下x86和arm的CPU性能相关的知识,希望对你有一定的参考价值。
x86:Intel(R) Core(TM) i5-8250U CPU
arm:Qualcomm ® snapdragon ™ 821(MSM8996-AC)
一千万次nop循环c代码如下:
int main()
int i;
for (i = 0; i < 10000000; i++)
return (0);
编译和执行,如下:
gcc noploop.c -o noploop
time ./noploop
这种方式只能大概测试,并不十分精确^_^
左x86,右arm
x86 | arm | |
一千万次 | real 0m0.029s user 0m0.028s sys 0m0.002s | real 0m0.126s user 0m0.093s sys 0m0.013s |
八千万次 | real 0m0.135s user 0m0.135s sys 0m0.000s | real 0m0.523s user 0m0.487s sys 0m0.013s |
运算性能:
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
using namespace std;
const long long N = 1e8;
int main()
double m_pi=M_PI;
for(long long i=1;i<N;i++)
m_pi=m_pi*i/123456;
cout<<m_pi<<endl;
return 0;
x86:
real 0m0.654s
user 0m0.654s
sys 0m0.000s
arm:
real 0m0.948s
user 0m0.887s
sys 0m0.020s
稍微修改一下程序,再测试一下?
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
using namespace std;
const long long N = 8e8;
int main()
double m_pi=M_PI;
for(long long i=1;i<N;i++)
m_pi=m_pi*i/1.23456;
cout<<m_pi<<endl;
return 0;
当然这种代码除了耗电之外,没有任何实际用途!
用到的指令如下:
- 652 gcc noploop.c -o noploop
- 653 time ./noploop
- 654 ls
- 655 gcc noploop8.c -o noploop8
- 656 time ./noploop8
- 657 grep model.name /proc/cpuinfo
- 658 exit
- 659 g++ calculateloop.cpp -o calculateloop
- 660 time ./calculateloop
- 661 ./calculateloop
- 662 time ./calculateloop
- 663 g++ calplusloop.cpp -o calplusloop
- 664 time ./calplusloop
如果偏好是自己编写基准工具,在汇编中,然后对编译的机器代码进行反汇编以进行验证。怎么知道CPU实际上在做什么?
这样做通常是不切实际的,但会尽可能地分享一个案例。这是用于 CPU 基准测试的,将它与其他工具(例如 sysbench、lmbench)和主动基准测试方法一起使用。
这是使用展开的无操作 (NOP) 循环测量 CPU 时钟速度的过程。它旨在简单,最大限度地减少由缓存未命中、停顿周期和分支预测错误引起的变化。在尝试更复杂的 CPU 基准测试之前,该结果提供了一个基线。
由于在 Linux 上运行它,只能读取 /proc/cpuinfo,但并不完全信任它在虚拟化环境中(它可以伪造 cpuid)。更信任的一种方法是简单地从 CPU 性能监控单元读取周期计数器(例如,使用 perf),但在虚拟化环境中访问这些计数器的权限有限或无法访问。
补充
直接用hardinfo测试更轻松一些:
截取部分
-CPU Blowfish-
Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz 8x 1800.00 MHz 1.49
Qualcomm snapdragon 821 Unknown MHz 29.371
x86
Benchmarks
**********
CPU Blowfish
-------------CPU Blowfish-
Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz 8x 1800.00 MHz 1.49
Intel(R) Pentium(R) D CPU 3.00GHz 2x 3000.00 MHz 10.84
Intel(R) Celeron(R) CPU540@ 1.86GHz 1x 1861.00 MHz 25.49
AMD Turion(tm) 64 X2 TL-58 2x 800.00 MHz 12.58
AMD Athlon(tm) 64 X2 Dual Core Processor 3800+ 2x 2200.00 MHz 10.71
AMD Athlon(tm) 64 X2 Dual Core Processor 6400+ 2x 1000.00 MHz 6.42
Intel(R) Core(TM)2 Extreme CPU X7900@ 2.80GHz 2x 2800.00 MHz 6.81
Intel(R) Pentium(R) M processor 1.70GHz 1x 1700.00 MHz 28.28
AMD Phenom(tm) 8650 Triple-Core Processor 3x 2300.00 MHz 5.96
Intel(R) Pentium(R) 4 CPU 2.40GHz 1x 2400.00 MHz 24.57
AMD Athlon(tm) 64 X2 Dual Core Processor 4400+ 2x 1000.00 MHz 7.92
AMD Phenom(tm) II X4 940 Processor 4x 800.00 MHz 3.49
Pentium III (Coppermine) 2x 999.00 MHz 17.81
Intel(R) Pentium(R) 4 CPU 3.20GHz 2x 3200.00 MHz 12.06
Intel(R) Pentium(R) 4 CPU 1500MHz 1x 1495.00 MHz 46.56
AMD Turion(tm) 64 X2 Mobile Technology TL-58 2x 1900.00 MHz 10.10
Intel(R) Celeron(R) M processor 1.40GHz 1x 1395.00 MHz 80.94
Mobile AMD Athlon(tm) XP 2800+ 1x 1459.00 MHz 18.04
Intel(R) Celeron(R) CPU420@ 1.60GHz 1x 1600.00 MHz 21.24
AMD Phenom(tm) 9750 Quad-Core Processor 4x 1200.00 MHz 4.29
Intel(R) Atom(TM) CPU N280 @ 1.66GHz 2x 1660.00 MHz 16.76
AMD Athlon(tm) X2 Dual-Core QL-60 2x 1900.00 MHz 10.59
Intel(R) Pentium(R) DualCPUT2370@ 1.73GHz 2x 1733.00 MHz 9.58
AMD Athlon(tm) XP 1900+ 1x 1593.00 MHz 31.62
AMD Athlon(tm) XP 1800+ 1x 1540.00 MHz 23.13
Intel(R) Pentium(R) M processor 1.73GHz 1x 1730.00 MHz 19.66
AMD Sempron(tm) Processor 3200+ 1x 1000.00 MHz 25.47
VIA Esther processor 1500MHz 1x 1499.00 MHz 41.59
Intel(R) Core(TM)2 Quad CPUQ6700@ 2.66GHz 4x 2669.00 MHz 3.17
AMD Athlon(tm) 64 X2 Dual Core Processor 5000+ 2x 1000.00 MHz 7.49
Intel(R) Xeon(R) CPU3040@ 1.86GHz 2x 1862.00 MHz 9.11
Intel(R) Pentium(R) DualCPUT2310@ 1.46GHz 2x 1463.00 MHz 11.60
Intel(R) Core(TM)2 Duo CPU P8400@ 2.26GHz 2x 2260.00 MHz 8.29
AMD Turion(tm) X2 Dual-Core Mobile RM-74 2x 600.00 MHz 8.97
Genuine Intel(R) CPU 575@ 2.00GHz 1x 1995.00 MHz 20.36
AMD Turion(tm) 64 X2 Mobile Technology TL-62 2x 800.00 MHz 8.84
AMD Turion(tm) 64 X2 Mobile Technology TL-56 2x 800.00 MHz 10.79
Intel(R) Celeron(R) CPU 2.80GHz 1x 2793.00 MHz 40.87
Intel(R) Pentium(R) 4 CPU 2.80GHz 2x 2800.00 MHz 11.70
Genuine Intel(R) CPU2140@ 1.60GHz 2x 1595.00 MHz 10.67
AMD Athlon(tm) 7750 Dual-Core Processor 2x 1350.00 MHz 7.45
Intel(R) Core(TM)2 Duo CPU E8400@ 3.00GHz 2x 2997.00 MHz 5.54
Intel(R) Core(TM)2 CPU T7400@ 2.16GHz 2x 2161.00 MHz 9.37
Intel(R) Pentium(R) 4 CPU 2.53GHz 1x 2525.00 MHz 48.08
Intel(R) Core(TM)2 Quad CPUQ9550@ 2.83GHz 4x 2830.00 MHz 3.24
Intel(R) Core(TM)2 CPU6700@ 2.66GHz 2x 2667.00 MHz 6.90
AMD Turion(tm) X2 Dual-Core Mobile RM-72 2x 500.00 MHz 11.86
Intel(R) Core(TM)2 Duo CPU T9400@ 2.53GHz 2x 2530.00 MHz 6.76
AMD Athlon(tm) 64 X2 Dual Core Processor 4800+ 2x 2512.00 MHz 8.73
Intel(R) Celeron(R) M CPU520@ 1.60GHz 1x 1600.00 MHz 22.07
Intel(R) Core(TM)2 Quad CPUQ8300@ 2.50GHz 4x 2497.00 MHz 3.35
PowerPC 740/750 1x 280.00 MHz 172.82CPU CryptoHash
---------------CPU CryptoHash-
Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz 8x 1800.00 MHz 746.10
Intel(R) Atom(TM) CPU330 @ 1.60GHz 4x 1596.00 MHz 105.57
Intel(R) Core(TM)2 Duo CPU T5250@ 1.50GHz 2x 1500.00 MHz 102.95
Intel(R) Celeron(R) M processor900MHz 1x 900.00 MHz 24.34
Intel(R) Core(TM)2 CPU E8400@ 3.00GHz 2x 3000.00 MHz 163.39
Intel(R) Xeon(R) CPU E5405@ 2.00GHz 2x 1995.00 MHz 117.48
Intel(R) Core(TM) Duo CPUT2450@ 2.00GHz 2x 2000.00 MHz 127.24
Intel(R) Pentium(R) 4 CPU 2.00GHz 1x 1994.00 MHz 24.65
AMD Phenom(tm) 9350e Quad-Core Processor 4x 2000.00 MHz 237.01
AMD Turion(tm) X2 Ultra Dual-Core Mobile ZM-82 2x 600.00 MHz 100.06
AMD Athlon(tm) XP 3000+ 1x 2158.00 MHz 66.54
Intel(R) Celeron(R) M CPU520@ 1.60GHz 1x 1600.00 MHz 52.31
Intel(R) Core(TM)2 Quad CPUQ6700@ 2.66GHz 4x 2669.00 MHz 264.06
AMD Athlon(tm) XP 1900+ 1x 1593.00 MHz 31.63
Intel(R) Pentium(R) 4 CPU 3.20GHz 2x 3200.00 MHz 66.61
AMD Sempron(tm) 2600+ 1x 1840.00 MHz 53.87
AMD Athlon(tm) 64 X2 Dual Core Processor 3800+ 2x 2200.00 MHz 94.12
AMD Turion(tm) 64 X2 Mobile Technology TL-62 2x 800.00 MHz 119.43
AMD Athlon(tm) XP 2000+ 1x 1667.00 MHz 45.76
AMD Athlon(tm) 64 Processor 3500+ 1x 1000.00 MHz 62.20
AMD Turion(tm) 64 X2 Mobile Technology TL-56 2x 800.00 MHz 92.19
AMD Athlon(tm) 64 X2 Dual Core Processor 4000+ 2x 1000.00 MHz 97.04
Intel(R) Pentium(R) D CPU 3.00GHz 2x 3000.00 MHz 96.75
Mobile AMD Sempron(tm) Processor 3600+ 1x 800.00 MHz 54.44
Intel(R) Core(TM)2 Quad CPUQ9650@ 3.00GHz 4x 2997.00 MHz 303.51
AMD Sempron(tm) Processor 3600+ 1x 1000.00 MHz 43.98
Intel(R) Core(TM)2 Duo CPU T9400@ 2.53GHz 2x 2530.00 MHz 148.71
AMD Turion(tm) 64 X2 Mobile Technology TL-58 2x 1900.00 MHz 101.69
Intel(R) Core(TM)2 Duo CPU P7350@ 2.00GHz 2x 2000.00 MHz 103.95
VIA Esther processor 1500MHz 1x 1499.00 MHz 7.75
Intel(R) Core(TM)2 Duo CPU P8600@ 2.40GHz 2x 2400.00 MHz 150.44
Intel(R) Core(TM)2 Duo CPU T7700@ 2.40GHz 2x 2400.00 MHz 142.54
Intel(R) Core(TM)2 Duo CPU T5550@ 1.83GHz 2x 1829.00 MHz 122.42
Intel(R) Core(TM)2 Duo CPU T7250@ 2.00GHz 2x 2001.00 MHz 121.92
Intel(R) Core(TM)2 CPU6700@ 2.66GHz 2x 2667.00 MHz 163.64
Intel(R) Pentium(R) 4 CPU 2.40GHz 1x 2400.00 MHz 30.96
Intel(R) Core(TM)2 Quad CPUQ9400@ 2.66GHz 4x 2660.00 MHz 296.87
AMD Athlon(tm) 64 Processor 3200+ 1x 1000.00 MHz 42.30
Intel(R) Pentium(R) DualCPUT3200@ 2.00GHz 2x 2000.00 MHz 88.54
Intel(R) Pentium(R) 4 CPU 2.26GHz 1x 2267.00 MHz 29.41
AMD Sempron(tm) Processor 3400+ 1x 1000.00 MHz 53.84
AMD Sempron(tm) Processor 3000+ 1x 1800.00 MHz 47.79
AMD Athlon(tm) XP 2400+ 1x 1991.00 MHz 61.64
Intel(R) Atom(TM) CPU Z530 @ 1.60GHz 2x 1600.00 MHz 54.89
Pentium III (Coppermine) 1x 700.00 MHz 26.99
Intel(R) Core(TM) i7 CPU 920@ 2.67GHz 8x 3799.00 MHz 390.24
AMD Athlon(tm) 64 X2 Dual Core Processor 6000+ 2x 3051.00 MHz 146.74
AMD Turion(tm) 64 Mobile Technology ML-37 1x 2000.00 MHz 42.21
Intel(R) Xeon(R) CPU3040@ 1.86GHz 2x 1862.00 MHz 127.83
AMD Athlon(tm) XP 2500+ 1x 1792.00 MHz 39.66
Intel(R) Core(TM)2 Duo CPU T9500@ 2.60GHz 2x 2593.00 MHz 172.64CPU Fibonacci
--------------CPU Fibonacci-
Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz 8x 1800.00 MHz 0.37
AMD Phenom(tm) 9500 Quad-Core Processor 4x 1100.00 MHz 3.06
Intel(R) Core(TM)2 Duo CPU T7250@ 2.00GHz 2x 2001.00 MHz 4.57
Intel(R) Pentium(R) 4 CPU 2.80GHz 1x 2791.00 MHz 5.65
AMD Athlon(tm) Processor 1x 1210.00 MHz 7.34
Intel(R) Core(TM)2 CPU T5200@ 1.60GHz 2x 1067.00 MHz 7.27
Intel(R) Atom(TM) CPU330 @ 1.60GHz 4x 1596.00 MHz 8.79
AMD Phenom(tm) 9150e Quad-Core Processor 4x 900.00 MHz 3.28
AMD Turion(tm) 64 Mobile Technology MK-36 1x 800.00 MHz 6.20
AMD Athlon(tm) 64 Processor 3200+ 1x 1000.00 MHz 5.76
Intel(R) Core(TM)2 Quad CPUQ9400@ 2.66GHz 4x 2003.00 MHz 2.76
Intel(R) Core(TM)2 Duo CPU T7500@ 2.20GHz 1x 2200.00 MHz 4.09
AMD Athlon(tm) XP 1x 906.00 MHz 33.45
Intel(R) Core(TM)2 Quad CPUQ6700@ 2.66GHz 4x 2669.00 MHz 3.54
Intel(R) Pentium(R) 4 CPU 2.00GHz 1x 1994.00 MHz 8.70
Intel(R) Core(TM)2 Duo CPU E6550@ 2.33GHz 2x 2700.00 MHz 3.66
Intel(R) Core(TM)2 Duo CPU T7100@ 1.80GHz 2x 1801.00 MHz 4.79
Dual Core AMD Opteron(tm) Processor 165 2x 1979.00 MHz 4.26
Intel(R) Pentium(R) 4 CPU 2.40GHz 1x 2400.00 MHz 6.35
Intel(R) Core(TM)2 Duo CPU P8600@ 2.40GHz 1x 2400.00 MHz 3.37
AMD Turion(tm) X2 Dual-Core Mobile RM-70 2x 500.00 MHz 4.97
Intel(R) Pentium(R) 4 CPU 2.53GHz 1x 2525.00 MHz 10.36
Unknown CPU Type 1x 1660.00 MHz 5.73
Pentium III (Coppermine) 2x 999.00 MHz 10.22
Intel(R) Core(TM)2 CPU T5600@ 1.83GHz 2x 1000.00 MHz 5.24
Intel(R) Celeron(R) CPU 3.06GHz 1x 3059.00 MHz 3.96
AMD Phenom(tm) 9850 Quad-Core Processor 4x 1300.00 MHz 2.59
Intel(R) Pentium(R) 4 CPU 3.00GHz 2x 3458.00 MHz 4.98
AMD Sempron(tm) Processor LE-1200 1x 2109.00 MHz 6.08
Intel(R) Pentium(R) 4 CPU 2.80GHz 1x 2791.00 MHz 5.65
AMD Athlon(tm) 64 X2 Dual Core Processor 4000+ 2x 1000.00 MHz 4.12
AMD Athlon(tm) XP 1600+ 1x 1398.00 MHz 6.39
Genuine Intel(R) CPU T2050@ 1.60GHz 2x 800.00 MHz 6.10
Intel(R) Celeron(R) CPU560@ 2.13GHz 1x 2128.00 MHz 4.78
AMD Phenom(tm) 8650 Triple-Core Processor 3x 2300.00 MHz 3.09
Intel(R) Core(TM) i7 CPU 920@ 2.67GHz 8x 3799.00 MHz 2.79
AMD Athlon(tm) 64 X2 Dual Core Processor 5000+ 2x 1000.00 MHz 3.11
AMD Athlon(tm) XP 2500+ 1x 1792.00 MHz 7.18
Intel(R) Xeon(R) CPU3040@ 1.86GHz 2x 1862.00 MHz 4.81
AMD Athlon(tm) X2 Dual-Core QL-60 2x 1900.00 MHz 4.35
Intel(R) Core(TM)2 CPU T7400@ 2.16GHz 2x 2161.00 MHz 4.98
AMD Turion(tm) 64 X2 Mobile Technology TL-60 2x 2000.00 MHz 4.19
AMD Turion(tm) 64 X2 Mobile Technology TL-52 2x 1600.00 MHz 5.45
AMD Athlon(tm) 64 X2 Dual Core Processor 6000+ 2x 3051.00 MHz 2.75
Intel(R) Atom(TM) CPU N280 @ 1.66GHz 2x 1000.00 MHz 8.97
Intel(R) Core(TM)2 Quad CPUQ9550@ 2.83GHz 4x 2830.00 MHz 2.72
Intel(R) Core(TM)2 Duo CPU T7300@ 2.00GHz 2x 2001.00 MHz 4.77
AMD Sempron(tm) Processor 3600+ 1x 1000.00 MHz 5.70
AMD Athlon(tm) 1x 2305.00 MHz 4.47
AMD Athlon(tm) X2 Dual Core Processor BE-2300 2x 1899.00 MHz 4.37
Intel(R) Core(TM)2 Duo CPU E6750@ 2.66GHz 2x 2671.00 MHz 4.10
PowerPC 740/750 1x 280.00 MHz 58.08CPU N-Queens
-------------CPU N-Queens-
Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz 8x 1800.00 MHz 7.04
AMD Athlon(tm) 64 X2 Dual Core Processor 5400+ 2x 1000.00 MHz 15.06
Genuine Intel(R) CPU T2080@ 1.73GHz 2x 1730.00 MHz 33.31
Intel(R) Core(TM)2 Duo CPU T5450@ 1.66GHz 2x 1660.00 MHz 14.49
Intel(R) Core(TM)2 QuadCPU Q9300@ 2.50GHz 4x 3000.00 MHz 14.10
Intel(R) Atom(TM) CPU Z530 @ 1.60GHz 2x 1600.00 MHz 18.70
Intel(R) Atom(TM) CPU330 @ 1.60GHz 4x 1596.00 MHz 26.07
AMD Athlon(tm) XP 1600+ 1x 1398.00 MHz 19.85
Intel(R) Core(TM)2 Quad CPUQ6700@ 2.66GHz 4x 2669.00 MHz 17.01
Intel(R) Pentium(R) 4 CPU 2.60GHz 2x 2600.00 MHz 14.83
Intel(R) Core(TM)2 CPU6320@ 1.86GHz 2x 1860.00 MHz 16.54
Intel(R) Core(TM)2 Extreme CPU X7900@ 2.80GHz 2x 2800.00 MHz 7.02
Intel(R) Core(TM)2 QuadCPU Q9450@ 2.66GHz 4x 2000.00 MHz 12.97
Intel(R) Core(TM)2 CPU E8400@ 3.00GHz 2x 3000.00 MHz 7.84
Pentium III (Coppermine) 2x 999.00 MHz 35.15
AMD Athlon(tm) 64 X2 Dual Core Processor 4000+ 2x 1000.00 MHz 19.51
AMD Turion(tm) 64 X2 Mobile Technology TL-50 2x 800.00 MHz 23.26
Intel(R) Pentium(R) D CPU 3.40GHz 2x 3400.00 MHz 13.51
Pentium III (Coppermine) 2x 999.00 MHz 35.15
AMD Athlon(tm) 64 X2 Dual Core Processor 3600+ 2x 1000.00 MHz 22.98
AMD Athlon(tm) 64 X2 Dual Core Processor 5200+ 2x 2705.00 MHz 14.95
AMD Athlon(tm) 64 X2 Dual-Core Processor TK-55 2x 800.00 MHz 20.49
Intel(R) Core(TM)2 Duo CPU E6850@ 3.00GHz 2x 3000.00 MHz 7.52
Intel(R) Core(TM)2 Duo CPU P8400@ 2.26GHz 2x 2260.00 MHz 10.39
Intel(R) Core(TM)2 Quad CPUQ9400@ 2.66GHz 4x 2003.00 MHz 18.25
AMD Athlon(tm) XP 1900+ 1x 1593.00 MHz 26.74
Intel(R) Core(TM) Duo CPUT2350@ 1.86GHz 2x 1867.00 MHz 22.01
Intel(R) Core(TM)2 Duo CPU E8400@ 3.00GHz 2x 2997.00 MHz 7.66
AMD Athlon(tm) XP 2800+ 1x 2087.00 MHz 13.55
Genuine Intel(R) CPU T2500@ 2.00GHz 2x 2000.00 MHz 28.39
AMD Turion(tm) 64 X2 Mobile Technology TL-58 2x 1900.00 MHz 20.02
Intel(R) Pentium(R) 4 CPU 3.40GHz 2x 3400.00 MHz 15.30
Intel(R) Celeron(R) M processor900MHz 1x 900.00 MHz 33.26
AMD Athlon(tm) X2 Dual-Core QL-60 2x 1900.00 MHz 20.34
Intel(R) Core(TM)2 Duo CPU T5850@ 2.16GHz 2x 2167.00 MHz 10.37
Mobile AMD Athlon(tm) XP-M Processor 3000+ 1x 799.00 MHz 52.78
AMD Phenom(tm) 9500 Quad-Core Processor 4x 1100.00 MHz 10.06
Intel(R) Celeron(R) M processor 1.40GHz 1x 1395.00 MHz 94.05
Mobile AMD Athlon(tm) XP 2800+ 1x 1459.00 MHz 13.36
AMD Athlon(tm) 64 Processor 3000+ 1x 1800.00 MHz 18.08
Genuine Intel(R) CPU L2400@ 1.66GHz 2x 1660.00 MHz 19.55
AMD Sempron(tm) Processor 2800+ 1x 1999.00 MHz 17.23
AMD Sempron(tm) 2600+ 1x 1840.00 MHz 14.69
Intel(R) Pentium(R) M processor 1600MHz 1x 1600.00 MHz 15.23
Genuine Intel(R) CPU 575@ 2.00GHz 1x 1995.00 MHz 15.88
Genuine Intel(R) CPU T2300@ 1.66GHz 2x 1660.00 MHz 27.25
Intel(R) Pentium(R) M processor 1.70GHz 1x 1700.00 MHz 22.55
AMD Athlon(tm) XP processor 1800+ 1x 1533.00 MHz 17.55
Intel(R) Core(TM)2 Duo CPU T5750@ 2.00GHz 2x 1994.00 MHz 11.14
Intel(R) Core(TM)2 Duo CPU T7250@ 2.00GHz 2x 2001.00 MHz 11.39
Intel(R) Pentium(R) 4 CPU 1500MHz 1x 1495.00 MHz 28.46CPU Zlib
---------CPU Zlib-
Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz 8x 1800.00 MHz 0.97
PowerPC 740/750 1x 280.00 MHz 2150.60FPU FFT
--------FPU FFT-
Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz 8x 1800.00 MHz 1.13
Intel(R) Pentium(R) DualCPUT3200@ 2.00GHz 2x 2000.00 MHz 5.50
Intel(R) Celeron(R) CPU 2.53GHz 1x 2527.00 MHz 10.12
Genuine Intel(R) CPU T1350@ 1.86GHz 1x 1867.00 MHz 83.47
AMD Turion(tm) 64 X2 Mobile Technology TL-60 2x 2000.00 MHz 8.22
AMD Turion(tm) X2 Dual-Core Mobile RM-70 2x 500.00 MHz 8.31
Intel(R) Core(TM) Duo CPUT2350@ 1.86GHz 2x 1867.00 MHz 5.36
Intel(R) Core(TM)2 Duo CPU T5750@ 2.00GHz 2x 1994.00 MHz 4.23
Intel(R) Core(TM)2 Duo CPU T9500@ 2.60GHz 2x 2593.00 MHz 3.12
AMD Athlon(tm) X2 Dual-Core QL-60 2x 1900.00 MHz 9.08
Intel(R) Core(TM)2 Duo CPU T5250@ 1.50GHz 2x 1500.00 MHz 5.51
Mobile AMD Athlon(tm) XP-M Processor 3000+ 1x 799.00 MHz 43.15
AMD Athlon(tm) 64 X2 Dual Core Processor 4000+ 2x 1000.00 MHz 8.00
AMD Athlon(tm) XP processor 1800+ 1x 1533.00 MHz 25.14
Genuine Intel(R) CPU2140@ 1.60GHz 2x 1595.00 MHz 5.44
Intel(R) Core(TM)2 Quad CPUQ6600@ 2.40GHz 4x 2400.00 MHz 1.63
Intel(R) Core(TM)2 Duo CPU P7350@ 2.00GHz 2x 2000.00 MHz 4.76
Genuine Intel(R) CPU T2080@ 1.73GHz 2x 1730.00 MHz 4.99
Intel(R) Celeron(R) CPU 2.50GHz 1x 2492.00 MHz 14.46
Intel(R) Pentium(R) M processor 1.86GHz 1x 1867.00 MHz 11.88
Intel(R) Core(TM)2 CPU T5200@ 1.60GHz 2x 1600.00 MHz 6.49
Intel(R) Core(TM)2 CPU6320@ 1.86GHz 2x 1860.00 MHz 4.91
AMD Athlon(tm) XP 1x 906.00 MHz 84.35
AMD Athlon(tm) 64 Processor 3000+ 1x 1800.00 MHz 25.19
Intel(R) Pentium(R) 4 CPU 2.60GHz 2x 2600.00 MHz 8.54
Intel(R) Core(TM)2 Quad CPUQ9400@ 2.66GHz 4x 2660.00 MHz 1.49
Intel(R) Pentium(R) M processor 1600MHz 1x 1600.00 MHz 13.50
Pentium(R) Dual-Core CPU T4200@ 2.00GHz 2x 2000.00 MHz 4.62
Intel(R) Core(TM)2 Quad CPU @ 2.40GHz 4x 2400.00 MHz 1.70
Intel(R) Core(TM)2 Quad CPUQ8300@ 2.50GHz 4x 2497.00 MHz 1.66
Intel(R) Core(TM)2 Extreme CPU X7900@ 2.80GHz 2x 2800.00 MHz 3.06
Intel(R) Celeron(R) D CPU 3.20GHz 1x 3196.00 MHz 8.55
AMD Sempron(tm) 2600+ 1x 1840.00 MHz 20.95
AMD Athlon(tm) 64 X2 Dual Core Processor 4400+ 2x 1000.00 MHz 6.80
Intel(R) Celeron(R) CPU 2.66GHz 1x 2666.00 MHz 9.89
Intel(R) Core(TM) Duo CPUT2450@ 2.00GHz 2x 2000.00 MHz 4.33
Intel(R) Celeron(R) M CPU520@ 1.60GHz 1x 1600.00 MHz 11.35
Intel(R) Pentium(R) 4 CPU 3.06GHz 2x 3065.00 MHz 7.45
Intel(R) Core(TM)2 CPU4300@ 1.80GHz 2x 1800.00 MHz 5.37
Intel(R) Core(TM)2 CPU6400@ 2.13GHz 2x 2128.00 MHz 4.68
AMD Turion(tm) 64 Mobile Technology MK-36 1x 800.00 MHz 19.96
Intel(R) Core(TM)2 CPU6600@ 2.40GHz 2x 2400.00 MHz 3.55
Intel(R) Core(TM)2 Duo CPU T7250@ 2.00GHz 2x 2001.00 MHz 4.16
Intel(R) Celeron(R) M processor900MHz 1x 900.00 MHz 24.21
AMD Sempron(tm) Processor 3400+ 1x 1000.00 MHz 17.11
AMD Athlon(tm) XP 2500+ 1x 1792.00 MHz 27.33
AMD Sempron(tm) Processor 3000+ 1x 1800.00 MHz 18.94
AMD Athlon(tm) XP 2200+ 1x 1782.00 MHz 22.20
Intel(R) Pentium(R) 4 CPU 3.06GHz 2x 3065.00 MHz 7.45
AMD Processor model unknown 2x 3006.00 MHz 5.24
AMD Turion(tm) 64 X2 Mobile Technology TL-62 2x 800.00 MHz 7.52FPU Raytracing
---------------FPU Raytracing-
Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz 8x 1800.00 MHz 2.05
Intel(R) Core(TM) Duo CPUT2450@ 2.00GHz 2x 2000.00 MHz 28.36
AMD Athlon(tm) XP 2200+ 1x 1782.00 MHz 29.74
Intel(R) Pentium(R) DualCPUT2370@ 1.73GHz 2x 1733.00 MHz 25.82
AMD Sempron(tm) Processor 3200+ 1x 1000.00 MHz 30.19
AMD Athlon(tm) 64 X2 Dual-Core Processor TK-55 2x 800.00 MHz 16.47
Intel(R) Core(TM)2 CPU6600@ 2.40GHz 2x 2400.00 MHz 11.24
Intel(R) Core(TM)2 Duo CPU T5270@ 1.40GHz 2x 1400.00 MHz 32.81
AMD Athlon(tm) 64 X2 Dual-Core Processor TK-53 2x 800.00 MHz 18.47
Intel(R) Pentium(R) M processor 1.86GHz 1x 1867.00 MHz 28.20
Intel(R) Core(TM)2 Duo CPU T5750@ 2.00GHz 2x 1994.00 MHz 16.38
AMD Turion(tm) 64 Mobile Technology ML-32 1x 800.00 MHz 28.43
Intel(R) Celeron(R) CPU530@ 1.73GHz 1x 2593.00 MHz 17.55
Intel(R) Core(TM) i7 CPU 920@ 2.67GHz 8x 3799.00 MHz 4.73
Intel(R) Core(TM)2 Quad CPUQ9650@ 3.00GHz 4x 2997.00 MHz 18.84
AMD Turion(tm) 64 Mobile Technology MK-36 1x 800.00 MHz 30.84
Intel(R) Pentium(R) D CPU 3.40GHz 2x 3400.00 MHz 25.42
AMD Athlon(tm) X2 Dual-Core QL-60 2x 1900.00 MHz 18.30
Intel(R) Pentium(R) III CPU - S 1400MHz 1x 1392.00 MHz 33.36
AMD Phenom(tm) II X4 20 Processor 4x 3654.00 MHz 13.29
Intel(R) Core(TM)2 CPU E8400@ 3.00GHz 2x 3000.00 MHz 15.79
Intel(R) Pentium(R) 4 CPU 2.66GHz 1x 2676.00 MHz 32.38
Intel(R) Pentium(R) 4 CPU 2.60GHz 2x 2600.00 MHz 57.37
Intel(R) Core(TM)2 Duo CPU P9500@ 2.53GHz 2x 2535.00 MHz 5.51
Intel(R) Celeron(R) M processor900MHz 1x 900.00 MHz 64.67
AMD Athlon(tm) 64 X2 Dual Core Processor 4800+ 2x 2512.00 MHz 12.80
Intel(R) Pentium(R) M processor 1.73GHz 1x 1730.00 MHz 27.69
Genuine Intel(R) CPU T2080@ 1.73GHz 2x 1730.00 MHz 31.11
AMD Athlon(tm) 64 Processor 4000+ 1x 1000.00 MHz 20.49
Intel(R) Pentium(R) 4 CPU 2.53GHz 1x 2525.00 MHz 36.54
Intel(R) Celeron(R) CPU560@ 2.13GHz 1x 2128.00 MHz 21.15
Intel(R) Core(TM)2 Extreme CPU X7900@ 2.80GHz 2x 2800.00 MHz 18.27
Intel(R) Core(TM)2 Duo CPU T9400@ 2.53GHz 2x 2530.00 MHz 5.59
AMD Athlon(tm) 64 X2 Dual Core Processor 6400+ 2x 1000.00 MHz 10.93
Intel(R) Celeron(R) M CPU420@ 1.60GHz 1x 1599.00 MHz 37.00
Intel(R) Xeon(R) CPU E5405@ 2.00GHz 2x 1995.00 MHz 17.81
Genuine Intel(R) CPU2140@ 1.60GHz 2x 1595.00 MHz 22.05
Intel(R) Pentium(R) M processor 1700MHz 1x 1700.00 MHz 27.28
Pentium II (Deschutes) 1x 401.00 MHz 124.07
Intel(R) Core(TM)2 Duo CPU T8100@ 2.10GHz 2x 2094.00 MHz 23.76
Intel(R) Core(TM)2 CPU4300@ 1.80GHz 2x 1800.00 MHz 18.17
AMD Athlon(tm) XP 3000+ 1x 2158.00 MHz 23.07
AMD Phenom(tm) 8450 Triple-Core Processor 3x 1100.00 MHz 18.56
Intel(R) Core(TM)2 Duo CPU P8400@ 2.26GHz 2x 2260.00 MHz 12.07
AMD Athlon(tm) XP 1800+ 1x 1540.00 MHz 31.73
Intel(R) Celeron(R) CPU550@ 2.00GHz 1x 1995.00 MHz 23.90
Intel(R) Pentium(R) 4 CPU 3.20GHz 2x 3200.00 MHz 31.44
Intel(R) Pentium(R) M processor 1.80GHz 1x 1800.00 MHz 27.13
Intel(R) Celeron(R) CPU 2.80GHz 1x 2793.00 MHz 81.05
Genuine Intel(R) CPU T1350@ 1.86GHz 1x 1867.00 MHz 222.18
Intel(R) Pentium(R) 4 CPU 2.80GHz 1x 2791.00 MHz 28.66
PowerPC 740/750 1x 280.00 MHz 161.31ARM:
Benchmarks
**********
CPU Blowfish
-------------CPU Blowfish-
Qualcomm snapdragon 821 Unknown MHz 29.371
Intel(R) Celeron(R) M processor 1.50GHz (null) 26.1876862
PowerPC 740/750 (280.00MHz) (null) 172.816713CPU CryptoHash
---------------CPU CryptoHash-
Qualcomm snapdragon 821 Unknown MHz 79.139CPU Fibonacci
--------------CPU Fibonacci-
Qualcomm snapdragon 821 Unknown MHz 4.549
Intel(R) Celeron(R) M processor 1.50GHz (null) 8.1375674
PowerPC 740/750 (280.00MHz) (null) 58.07682CPU N-Queens
-------------CPU N-Queens-
Qualcomm snapdragon 821 Unknown MHz 11.847FPU FFT
--------FPU FFT-
Qualcomm snapdragon 821 Unknown MHz 16.675FPU Raytracing
---------------FPU Raytracing-
Qualcomm snapdragon 821 Unknown MHz 7.215
Intel(R) Celeron(R) M processor 1.50GHz (null) 40.8816714
PowerPC 740/750 (280.00MHz) (null) 161.312647
以上是关于如何编写C++代码简单测试一下x86和arm的CPU性能的主要内容,如果未能解决你的问题,请参考以下文章