Re: [BUG] wrong bogomips values with kernel 2.6.16

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Wed, 22 Mar 2006, Knut Petersen wrote:
> 
> All Pentium M, Xeon up to model 2 and the P6 family increment with every
> internal processor cycle.

Just to humor me. Try the bogomips loop in user space with something like 
the appended (make sure the frequency is fixed to the lowest frequency).

		Linus
---
#include <stdio.h>
#include <sys/time.h>

#define read_tsc(r) asm volatile("rdtsc":"=A" (r))

int main(int argc, char **argv)
{
	struct timeval a;
	unsigned long start, end;
	unsigned long mhz, low;

	gettimeofday(&a, NULL);
	read_tsc(start);
	for (;;) {
		unsigned long usec;
		struct timeval b;
		gettimeofday(&b, NULL);
		usec = (b.tv_sec - a.tv_sec)*1000000;
		usec += b.tv_usec - a.tv_usec;
		if (usec >= 1000000)
			break;
	}
	read_tsc(end);
	end -= start;
	mhz = end / 1000000;
	low = end % 1000000;
	printf("TSC: %lu.%06lu MHz\n", mhz, low);
	return 0;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux