16 #include <linux/kernel.h>
19 #include <linux/time.h>
32 static unsigned long dosample(
void)
63 return (ct1 - ct0) / (500000/
HZ) * (500000/
HZ);
71 unsigned long r4k_ticks[3];
72 unsigned long r4k_tick;
88 r4k_ticks[0] = dosample();
89 }
while (!r4k_ticks[0]);
91 r4k_ticks[1] = dosample();
92 }
while (!r4k_ticks[1]);
94 if (r4k_ticks[0] != r4k_ticks[1]) {
95 printk(
"warning: timer counts differ, retrying... ");
96 r4k_ticks[2] = dosample();
97 if (r4k_ticks[2] == r4k_ticks[0]
98 || r4k_ticks[2] == r4k_ticks[1])
99 r4k_tick = r4k_ticks[2];
101 printk(
"disagreement, using average... ");
102 r4k_tick = (r4k_ticks[0] + r4k_ticks[1]
106 r4k_tick = r4k_ticks[0];
108 printk(
"%d [%d.%04d MHz CPU]\n", (
int) r4k_tick,
109 (
int) (r4k_tick / (500000 /
HZ)),
110 (
int) (r4k_tick % (500000 /
HZ)));