You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Time::HiRes.xs don't Win32's QueryPerformanceFrequency() over and over
-It is a boot time constant. It will not change without a motherboard or
CPU swap and then rebooting. The actual 64 bit integer returned, reflects
if the NT Kernel wants to use Intel's APIC Timer or Intel's 8253/8254 PIT
Timer, or Intel's RDTSC instruction. NT Kernel will only use RDTSC backend
if both the CPU and Northbridge swear upon a holy book, that they will
fire an interrupt at every Intel/AMD SpeedSwitch/TurboBoost transition.
The dynamic CPU speed correction factor logic lives inside the machine
code of QueryPerformanceCounter(). Not inside QueryPerformanceFrequency()
which has been part of MS;s frozen Public API since 1993.
-the test:
if (!QueryPerformanceFrequency(&l_tick_frequency)) croak("WT???");
can probably be removed one day, only Win2K or NT4 or Win95/98, running
on any 32-bit CISC or 32-but RISC CPU arch, are capable of retval FALSE.
The test is added out of paranoia. IDK what in real life on real HW can
cause retval FALSE.
-calc and save var unsigned __int64 qpc_res_ns; and
unsigned __int64 qpc_res_ns_realtime; exactly once instead of re-calcing
in the runloop, why not? HiRes.dll's .data section is only 0x650 bytes
long and granularity is 0x1000/4096 bytes.
-the BOOT: initialization code of the 3 true C static global vars, is
written, to assume 2 ithreads, or 2 my_perl ptrs, or 2 different
embbeding consumers of perl5XX.dll inside 1 OS process, can
simultaneously call Dynaloader::bootstrap() or Time::HiRes::bootstrap()
on 2 different CPU cores. This is unrealistic paranoia IMO, but CPU op
lock xchg reg, [addr]; and mov [addr], reg; are both 7 bytes long.
Maybe Windows >= 8.0 on ARM32/ARM64, want their memory fence/barrier
formalities writing to an aligned 64 bit integer. So why not?
-#define S_InterlockedExchange64(_d,_s) has S_ prefix, so no assumptions
are made on MSVC and Mingw GCC, if InterlockedExchange64() is a macro or
a symbol. Any age, any version, any build number, any FOSS project code
owner, or any FOSS binary packager, of those 2 C compiler families.
0 commit comments