Page 2 of 5

Re: Extended understanding of system timers in Windows.

Posted: 14 Jun 2023, 23:27
by Chief Blur Buster
Tiberiusmoon wrote:
14 Jun 2023, 10:46
This is just a broad guide to latency, this post is about timers and the otential conflicts of incorrect settings.
BTW:
I was asked if timers and lag are separate or same topics.

My take: It's an overlapping venn diagram. It's a big rabbit hole -- often clocks/timers are intractably linked to certain elements of latency.

Where better/worse timers can create better lagfeel effects.

The way the game clock (gametime) renders into graphics and then displays on the screen for hitting eyeballs (photontime), is a refresh rate race bottleneck. Variances in this timing (including from timer inaccuracies) creates jitter and lagfeel issues. gametime:photontime relative accuracy is essentially the the god of jitter & latency variances -- and must stay relatively sub-millisecond exact to prevent human visible effects in the refresh rate race. So the universes can overlap. Lag variances from timing jitter. And timing jitter = lag variances. Even a 1ms inaccuracy = 8 pixel jitter at 8000 pixels/sec mouse flick turn. On clearer-motion & higher-resolution displays, those sub-millisecond divergences between gametime versus photontime create jitterfeel/lagfeel issues.

From what I see, the topic title talks about timers, and timers are allowed topics in the latency forum because of how better/worse timers can create lagfeel-effect changes.

It's tough to exercise best judgement when talking about timers vs talking about latency. Not all timer related things affect lagfeel, but there are instances where it does enroach into visible/feelable latency effects.

Re: Extended understanding of system timers in Windows.

Posted: 15 Jun 2023, 01:14
by thizito
disabling hpet in 2023, and im the brazilian here

Re: Extended understanding of system timers in Windows.

Posted: 17 Jun 2023, 05:38
by blurryboba
what if i disable hpet in windows and in bios?

Re: Extended understanding of system timers in Windows.

Posted: 17 Jun 2023, 14:41
by I LOVE TIN FOIL
Cannot achieve .500us with the high precision timer off, no matter timer combo.

Re: Extended understanding of system timers in Windows.

Posted: 17 Jun 2023, 18:41
by kyube
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.

Re: Extended understanding of system timers in Windows.

Posted: 18 Jun 2023, 01:52
by Tiberiusmoon
blurryboba wrote:
17 Jun 2023, 05:38
what if i disable hpet in windows and in bios?
The system will start using the TSC timer if you have a modern Intel CPU, anything else may cause desync issues.

Re: Extended understanding of system timers in Windows.

Posted: 18 Jun 2023, 04:03
by Slender

Re: Extended understanding of system timers in Windows.

Posted: 18 Jun 2023, 10:58
by laginput
I LOVE TIN FOIL wrote:
17 Jun 2023, 14:41
Cannot achieve .500us with the high precision timer off, no matter timer combo.
Bcdedit /set hypervisorlaunchtype auto.

Why it rounds up a timer to .1 or 0.5 I have no idea, just something I stumbled upon reinstalling windows with factory reset bios settings.

Re: Extended understanding of system timers in Windows.

Posted: 21 Jun 2023, 01:57
by Bloedboer
Timer combinations:

For a modern Intel CPU using a TSC timer should be the best option.
In Device manager, look for the High Precision Event timer and disable the driver.
If you have the option to disable HPET in the BIOS then do so.
Open Terminal (Admin) then input the following commands:
bcdedit /set useplatformclock no
bcdedit /set disabledynamictick Yes
bcdedit /set tscsyncpolicy enhanced
Restart your system.

Where can I find this combination on the melody google page? I’ve been trying to figure these timer settings out.

Re: Extended understanding of system timers in Windows.

Posted: 21 Jun 2023, 10:11
by noskill
Tiberiusmoon wrote:
14 Jun 2023, 06:05

Timers:

Time stamp counter (TSC):
Is a high resolution, low overhead tick timer with a few flaws which can be caused by powersaving, frequency.
However, recent intel CPUs include a constant rate TSC which counts the passage of time rather that the number of CPU clocks. (this removes the need for UsePlatformTick and wont be shown in the bootloader or terminal)
Modern TSC has no flaws. Earlier implementations of it would not count at the same rate on SMP (multiprocessor boxes) which led to timing issues. It's very fast, since it's easy to read with a simple assembly instruction.

QueryPerformanceCounter and QueryPerformanceFrequency will use whatever HAL reports to use, ie: RDTSC, RDTC, RDTSCI, 8254/LAPIC/HPET, etc.
High Precision Event Timer (HPET)
Is a high resolution system timer that uses interrupts in order to maintain a rate of time.
HPET devices can support two interrupt routing modes. In one mode, the comparators are additional interrupt sources with no particular system role. Many vendors ship BIOSes that don't route HPET interrupts at all, which prevents use of that mode. They support the other legacy replacement mode where the first two comparators block interrupts from 8254 timers and from the RTC.

HPET has some uses, but it's mostly in userland apps. Unless you have a seriously broken TSC (ie: drift), HPET would be the way to go. TSC is fast, and it works.

If TSC is completely broken, then HPET will be used to drive clocks.
Real Time Clock(RTC) and APCI PMT (PMT)
An outdated timer which can decrease performance.
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.

Timer combinations:
For a modern Intel CPU using a TSC timer should be the best option.
The defaults are the best option.
In Device manager, look for the High Precision Event timer and disable the driver.
That is a stub for applications to use it for their own purposes, not system wide.
If you have the option to disable HPET in the BIOS then do so.
Disabling it for everything is not a good idea.
bcdedit /set tscsyncpolicy enhanced
This is not a good idea to force tscsyncpolicy. The defaults will determine if the the CPU offers;

Constant TSC. This means means that the TSC does not change with CPU frequency changes, however it does change on C state transitions.
Invariant. As described in the Intel manual: “The invariant TSC will run at a constant rate in all ACPI P-, C- and T-states”
Non-stop. The Non-stop TSC has the properties of both Constant and Invariant TSC.
None of the above. The TSC changes with the C, P and S state transitions.

Forcing a sync policy if the hardware can't do TSC synchronizing will lead to very odd system behavior.