[NTOS:KE] Don't loop indefinitely trying to figure out the CPU frequency. CORE-14419
authorThomas Faber <thomas.faber@reactos.org>
Thu, 1 Mar 2018 09:36:27 +0000 (10:36 +0100)
committerThomas Faber <thomas.faber@reactos.org>
Thu, 1 Mar 2018 13:26:44 +0000 (14:26 +0100)
commit6b78ff036fb4f446f4e0aebe5120af26d6183a77
treea5930a632c0bebfb5372dc16795d2185b2ce5c08
parentd214e1c4d4af1166f2f5df66edfa069f6732e9c4
[NTOS:KE] Don't loop indefinitely trying to figure out the CPU frequency. CORE-14419

Previously, we would keep sampling the CPU frequency until two subsequent
samples differed by at most 1 MHz. This could take several seconds, and would
unnecessarily delay boot.
Instead, if sampling is too unreliable, just give up and calculate the average
frequency from 10 samples. This is no worse than picking the frequency that
just happened to be returned twice in a row.

The fact that this method of sampling fails could indicate that there's a
problem with our performance counter implementation or timer interrupt,
but that's a separate issue...
ntoskrnl/ke/i386/kiinit.c