1
0
Fork 0
mirror of https://github.com/hermitcore/libhermit.git synced 2025-03-09 00:00:03 +01:00

reduce the number of ticks to determine the cpu frequency

=> faster bootup time
This commit is contained in:
Stefan Lankes 2016-09-24 14:23:28 +02:00
parent 2f78c2042b
commit 58059ed3e0

View file

@ -182,14 +182,14 @@ uint32_t detect_cpu_frequency(void)
rmb();
start = rdtsc();
/* wait a second to determine the frequency */
while(get_clock_tick() - ticks < TIMER_FREQ)
/* wait 3 ticks to determine the frequency */
while(get_clock_tick() - ticks < 3)
PAUSE;
rmb();
end = rdtsc();
diff = end > start ? end - start : start - end;
cpu_freq = (uint32_t) (diff / (uint64_t) 1000000);
cpu_freq = (uint32_t) ((TIMER_FREQ*diff) / (1000000ULL*3ULL));
return cpu_freq;
}