BogoMipsBogoMips (from "bogus" and MIPS) is a crude measurement of CPU speed made by the Linux kernel when it boots to calibrate an internal busy-loop.[1] An often-quoted definition of the term is "the number of million times per second a processor can do absolutely nothing".[2][3] BogoMips is a value that can be used to verify whether the processor in question is in the proper range of similar processors, i.e. BogoMips represents a processor's clock frequency as well as the potentially present CPU cache. It is not usable for performance comparisons among different CPUs.[4] HistoryIn 1993, Lars Wirzenius posted a Usenet message[5] explaining the reasons for its introduction in the Linux kernel on comp.os.linux:
Proper BogoMips ratingsAs a very approximate guide, the BogoMips can be pre-calculated by the following table. The given rating is typical for that CPU with the then current and applicable Linux version. The index is the ratio of "BogoMips per clock speed" for any CPU to the same for an Intel 386DX CPU, for comparison purposes.[6][7]
With the 2.2.14 Linux kernel, a caching setting of the CPU state was moved from behind to before the BogoMips calculation. Although the BogoMips algorithm itself wasn't changed, from that kernel onward the BogoMips rating for then current Pentium CPUs was twice that of the rating before the change. The changed BogoMips outcome had no effect on real processor performance.[citation needed] In a shell, BogoMips can be easily obtained by searching the cpuinfo file:[7] $ grep -i bogomips /proc/cpuinfo
Computation of BogoMipsWith kernel 2.6.x, BogoMips are implemented in the /* * A simple loop like * while ( jiffies < start_jiffies+1) * start = read_current_timer(); * will not do. As we don't really know whether jiffy switch * happened first or timer_value was read first. And some asynchronous * event can happen between these two events introducing errors in lpj. * * So, we do * 1. pre_start <- When we are sure that jiffy switch hasn't happened * 2. check jiffy switch * 3. start <- timer value before or after jiffy switch * 4. post_start <- When we are sure that jiffy switch has happened * * Note, we don't know anything about order of 2 and 3. * Now, by looking at post_start and pre_start difference, we can * check whether any asynchronous event happened or not */
/* simple loop based delay: */
static void delay_loop(unsigned long loops)
{
int d0;
__asm__ __volatile__(
"\tjmp 1f\n"
".align 16\n"
"1:\tjmp 2f\n"
".align 16\n"
"2:\tdecl %0\n\tjns 2b"
:"=&a" (d0)
:"0" (loops));
}
equivalent to the following assembler code ; input: eax = d0
; output: eax = 0
jmp start
.align 16
start: jmp body
.align 16
body: decl eax
jns body
which can be rewritten to C-pseudocode static void delay_loop(long loops)
{
long d0 = loops;
do {
--d0;
} while (d0 >= 0);
}
Full and complete information and details about BogoMips, and hundreds of reference entries can be found in the (outdated) BogoMips mini-Howto.[4] Timer-based delaysIn 2012, ARM contributed a new One side effect of this change is that the BogoMIPS value will reflect the timer frequency, not the CPU's core frequency. Typically the timer frequency is much lower than the processor's maximum frequency, and some users may be surprised to see an unusually low BogoMIPS value when comparing against systems that use traditional busy-wait loops. See alsoReferences
External links |
Portal di Ensiklopedia Dunia