Page 3 of 5

Re: Extended understanding of system timers in Windows.

Posted: 22 Jun 2023, 02:33
by Tiberiusmoon
noskill wrote:
21 Jun 2023, 10:11
SNIP
Cool you got any sources to validate this?

Re: Extended understanding of system timers in Windows.

Posted: 22 Jun 2023, 11:05
by noskill
Tiberiusmoon wrote:
22 Jun 2023, 02:33
noskill wrote:
21 Jun 2023, 10:11
SNIP
Cool you got any sources to validate this?
Microsoft's own internal documentation:
https://learn.microsoft.com/en-us/windo ... ime-stamps

APIC timer: https://wiki.osdev.org/APIC_timer
HPET: https://wiki.osdev.org/HPET
VMWare's Documentation on modern timekeeping: https://www.vmware.com/content/dam/digi ... -guide.pdf
(there are countless publications)
RedHat has a nice little rant about timekeeping sources in x86: https://www.kernel.org/doc/Documentatio ... eeping.txt

Some earlier discussions on drifting TSC;

https://community.osr.com/discussion/84 ... -anomalies

See Intel 64 Architecture SDM vol. 3A, "17.16 Invariant TSC":

On Intel (and moreso AMD); TSC frequency is stable since Nehalem. See Intel 64 Architecture SDM vol. 3A, "17.16 Invariant TSC":

Processor families increment the time-stamp counter differently:

Code: Select all

For Pentium M processors (family [06H], models [09H, 0DH]); for Pentium 4 processors, Intel Xeon processors (family [0FH], models [00H, 01H, or 02H]); and for P6 family processors: the time-stamp counter increments with every internal processor clock cycle. The internal processor clock cycle is determined by the current core-clock to bus-clock ratio. Intel SpeedStep technology transitions may also impact the processor clock.

For Intel Xeon processors (family [0FH], models [03H and higher]); for Intel Core Solo and Intel Core Duo processors (family [06H], model [0EH]); for the Intel Xeon processor 5100 series and Intel Core 2 Duo processors (family [06H], model [0FH]); for Intel Core 2 and Intel Xeon processors (family [06H], DisplayModel [17H]); for Intel Atom processors (family [06H], DisplayModel [1CH]): the time-stamp counter increments at a constant rate. That rate may be set by the maximum core-clock to bus-clock ratio of the processor or may be set by the maximum resolved frequency at which the processor is booted. The maximum resolved frequency may differ from the processor base frequency, see Section 18.18.2 for more detail. On certain processors, the TSC frequency may not be the same as the frequency in the brand string.

The time stamp counter in newer processors may support an enhancement, referred to as invariant TSC. Processor’s support for invariant TSC is indicated by CPUID.80000007H:EDX[8]. The invariant TSC will run at a constant rate in all ACPI P-, C-. and T-states. This is the architectural behavior moving forward. On processors with invariant TSC support, the OS may use the TSC for wall clock timer services (instead of ACPI or HPET timers). TSC reads are much more efficient and do not incur the overhead associated with a ring transition or access to a platform resource.
The tl;dr - Windows - like other OSs, usually does checks upon boot to determine hardware support (ie: a __cpuid call, then see if it supports invariant TSC, then LAPIC/APIC, 8254, HPET, etc)

Re: Extended understanding of system timers in Windows.

Posted: 22 Jun 2023, 22:15
by Coldplayer
What are the optimal settings for an AMD newish system (5800x3d)?

Re: Extended understanding of system timers in Windows.

Posted: 12 Jul 2023, 08:58
by dannyoceanic
Hey guys
Wanted to ask if any of you tried these changes and it made valorant run smoother ?


Tried a couple of tweaks so far and the game feels sluggish at some times :/

Re: Extended understanding of system timers in Windows.

Posted: 12 Jul 2023, 12:29
by Tiberiusmoon
dannyoceanic wrote:
12 Jul 2023, 08:58
Hey guys
Wanted to ask if any of you tried these changes and it made valorant run smoother ?


Tried a couple of tweaks so far and the game feels sluggish at some times :/
Post specs of your system including ram.

Re: Extended understanding of system timers in Windows.

Posted: 15 Jul 2023, 05:10
by sherifmagdy32
noskill wrote:
21 Jun 2023, 10:11
Tiberiusmoon wrote:
14 Jun 2023, 06:05
ACPI is not really outdated (It's still apart of the ACPI specification). On HAL (Windows 7+), if it detects TSC errata (unable to properly sync, etc), it will drive timekeeping with ACPI (or even LAPIC). It has a 24‐bit counter that increments at 3.579545MHz. Not as bad as the RTC / PIT, though.
Is there a way to force enable this on windows 10 or 11.

Re: Extended understanding of system timers in Windows.

Posted: 15 Jul 2023, 16:36
by The90sPope
kyube wrote:
17 Jun 2023, 18:41
https://github.com/amitxv/PC-Tuning/blo ... ule-change
Timer res changes don't work on newer windows releases except Server 2022 and W11

https://github.com/djdallmann/GamingPCS ... /README.md

Don't mess with bcdedit, it's not worth it considering the sheer amount of hardware combinations.


Is there a way to still set timer resolution in Win 10 2H22 or is it forced 15ms no matter what?

Re: Extended understanding of system timers in Windows.

Posted: 17 Jul 2023, 10:23
by kyube
The90sPope wrote:
15 Jul 2023, 16:36
kyube wrote:
17 Jun 2023, 18:41
https://github.com/amitxv/PC-Tuning/blo ... ule-change
Timer res changes don't work on newer windows releases except Server 2022 and W11

https://github.com/djdallmann/GamingPCS ... /README.md

Don't mess with bcdedit, it's not worth it considering the sheer amount of hardware combinations.


Is there a way to still set timer resolution in Win 10 2H22 or is it forced 15ms no matter what?
Nope, as per this comment from the links above:
After collecting all the kernels from Windows 10 2004 - 22H2 client, LTSC and server editions, I can conclude that the entry only exists in server 2022+ and Windows 11+ and we can test this by checking if the entry can be successfully read, see below for an example. Random observation; the registry key is present and already set to 1 on server 2022+

Server 2022+ and Windows 11+:

lkd> dd KiGlobalTimerResolutionRequests L1
fffff803`444fb5c6 00000000

Any other build:

lkd> dd KiGlobalTimerResolutionRequests L1
Couldn't resolve error at 'KiGlobalTimerResolutionRequests '
Meaning you either use pre-2004 builds (such as 1703,1709 or 1803), Server 2022 or W11 22H2 (preferred imo, due to recent high polling rate changes too)

Re: Extended understanding of system timers in Windows.

Posted: 17 Jul 2023, 13:39
by The90sPope
Thanks for clarifying it. I though workaround was implemented, but nah.
Timer is dynamic in Windows 10 2H22 when I set it to 0.5ms
It keeps being 15ms and drops to 0.5ms and basically lives its own life. I have no control over it. Setting it to 0.5ms still reduces sleep time by like 0.2ms for me. But it's so small number I don't care about it.
I guess W11 2H22 is the next OS. I hope me ram and cpu overclock is stable on W11, I have little time to tune ram or cpu from scratch again.

Re: Extended understanding of system timers in Windows.

Posted: 17 Jul 2023, 16:17
by ptuga
The90sPope wrote:
17 Jul 2023, 13:39
Thanks for clarifying it. I though workaround was implemented, but nah.
Timer is dynamic in Windows 10 2H22 when I set it to 0.5ms
It keeps being 15ms and drops to 0.5ms and basically lives its own life. I have no control over it. Setting it to 0.5ms still reduces sleep time by like 0.2ms for me. But it's so small number I don't care about it.
I guess W11 2H22 is the next OS. I hope me ram and cpu overclock is stable on W11, I have little time to tune ram or cpu from scratch again.
Ram stability is independent from software. If it's stable on win10 it'll also be stable on 11. If it shows errors in 11 it's because you didn't properly test it/tuned it in the first place.