lkml.org 
[lkml]   [2006]   [Mar]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [BUG] wrong bogomips values with kernel 2.6.16


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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2009-11-18 23:46    [W:0.038 / U:1.224 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site