MIPS vs MHz
MHz(兆赫)是每秒的时钟周期数。这通常由电路板上的晶体振荡器决定。例如,如果处理器或内存的运行频率为 20MHz,那么每秒就有 2 千万个时钟周期。它如何利用这些时钟周期完全取决于芯片。
有些处理器每个时钟脉冲执行一条指令。有些处理器则需要几个时钟脉冲来执行某些(或所有)指令。例如,简单的 x51 型处理器在 12 个时钟周期内执行一条简单指令。他们称这 12 个时钟周期为一个机器周期。较新的变种处理器每个机器周期可能只需要 4 个时钟周期,因此在相同的时钟频率下运行速度快 3 倍(执行的指令多 3 倍)。
这就是 MIPS 的由来。MIPS 是指每秒百万条指令。也就是说,实际执行的指令数量--它可能与上述时钟频率不同。
例如,如果一个老式 x51 CPU 的时钟频率为 24MHz,每个机器周期需要 12 个时钟周期,那么它可以执行 2 MIPS(24MHz/12 个周期)。即便如此,某些指令的执行时间可能超过一个机器周期,因此实际程序的运行速度可能低于这个数值。如果使用更现代版本的内核,每个机器周期使用 4 个时钟周期,那么处理指令的速度将达到 6 MIPS(24/4)--在相同时钟频率下快 3 倍。
如果比较类似类型的 CPU,MIPS 比 MHz 能提供更有意义的速度比较。
MHz (Megahertz) is the number of clock cycles every second. This is usually determined by a crystal oscillator on the board somewhere. For instance, if your processor or memory runs at 20MHz, it gets 20 million clock cycles every second. What it does with this depends entirely on the chip.
Some processors will perform one instruction for every clock pulse. Some will take several clock pulses for some (or all) instructions. For instance, the simple x51-type processors perform one simple instruction in 12 clock cycles. They call these 12 clock cycles one machine cycle. More recent varients may only take 4 clock cycles for each machine cycle, thus running 3 times faster (doing 3 times more instructions) on the same clock frequency.
This is where MIPS comes in. MIPS is Millions of Instructions Per Second. That is, how many actual instructions are performed - it may be different from the clock frequency as described above.
For instance, if an old x51 cpu has a clock of 24MHz, and takes 12 clock cycles per machine cycle, it can do 2 MIPS (24MHz/12 cycles). Even then, some instructions may take more than one machine cycle to perform so an actual program may run at less than this. If a more modern version of the core is used, that uses 4 clock cycles per machine cycle, it will process instructions at a rate of 6 MIPS (24/4) - 3 times faster for the same clock.
If comparing similar types of cpu, MIPS gives a more meaningful comparison of speed than MHz.
DMIPS
DMIPS 数字由 ARM 公布,几乎所有供应商都使用它们。
根据编译器的优化,有三种 DMIPS 数值。
DMIPS/MHz 是指每 1MHz 时钟频率下的 DMIPS。
关于 Cortex-M3,它们分别是 1.25/1.50/1.89 DMIPS/MHz。
关于 Cortex-M4,它们分别是 1.25/1.52/1.91 DMIPS/MHz(不含 FPU)和 1.27/1.55/1.95 DMIPS/MHz(含 FPU)。
我不知道为什么有 FPU 时数字会增加。
DMIPS 是 Dhrystone MIPS 的缩写,它是根据 VAX-11 的相对性能来衡量的。
Dhrystone 基准测试的是整数性能。
从 DIMIPS/MHz 的角度来看,Cortex-M3 等同于 Cortex-M4,因为除了 FPU 之外,两者的实现是相同的。
因此,时钟频率越高,性能越好。
无论如何,DMIPS 数值指的是最好的运行情况,并不总能在实际设备上重现。
简单地说,Cortex-M4 在 100MHz 时的性能为 125DMIPS,比 Cortex-M3 的 100DIMIPS 好。
The DMIPS numbers are announced by ARM and almost all vendor use them.
There are three DMIPS numbers according to the compiler optimization.
DMIPS/MHz is the DMIPS per 1MHz clock frequency.
Regarding Cortex-M3, they are 1.25/1.50/1.89 DMIPS/MHz.
Regarding Cortex-M4, they are 1.25/1.52/1.91 DMIPS/MHz (without FPU) and 1.27/1.55/