Skip to contentSkip to conversation

Query about loops_per_jiffy

DISCUSSION 胡杨树 3 participants 3 messages Jan 19, 2010

lore
Share & tools
lore

胡杨树

author
#0 lore raw

Hi, oldhands:)

I have a question about how loops_per_jiffy converted to BogoMips,

loops_per_jiffy * HZ <----------- that's number of instructions CPU executes in a second BogoMips <-------------------------- Millions of instructions CPU executes in a second

so , do the math!
(loops_per_jiffy * HZ)/1000,000 will give a BogoMips value.

then why calibrate_delay do it like the following:

	printk(KERN_CONT "%lu.%02lu BogoMIPS (lpj=%lu)\n",
			loops_per_jiffy/(500000/HZ),
			(loops_per_jiffy/(5000/HZ)) % 100, loops_per_jiffy);

Am I missing something ?
Great thanks for any tips!

#1 lore raw
Quoted 1 line

(loops_per_jiffy * HZ)/1000,000 will give a BogoMips value.

No, it will give a BogoLips (loops per second). A loop is two instructions, in ./arch/arm/lib/delay.S (function __delay) called by init/calibrate.c . To have bogomips you need to multiply by two.

Quoted 4 lines

then why calibrate_delay do it like the following:

	printk(KERN_CONT "%lu.%02lu BogoMIPS (lpj=%lu)\n",
			loops_per_jiffy/(500000/HZ),
			(loops_per_jiffy/(5000/HZ)) % 100, loops_per_jiffy);

It's correct, using normal integer aritmetics care.

/alessandro

#2 lore raw
In reply to 胡杨树
Quoted 6 lines · ???

Hi, oldhands:)

I have a question about how loops_per_jiffy converted to BogoMips,

loops_per_jiffy * HZ <----------- that's number of instructions CPU executes in a second BogoMips <-------------------------- Millions of instructions CPU executes in a second

No. The clue is in "Bogo" part of the name.