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:
parent
2f78c2042b
commit
58059ed3e0
1 changed files with 3 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue