Commit d864295
committed
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.1 parent 97c021c commit d864295
1 file changed
+35
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | | - | |
139 | 138 | | |
140 | 139 | | |
141 | 140 | | |
142 | 141 | | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
143 | 149 | | |
144 | 150 | | |
145 | 151 | | |
| |||
220 | 226 | | |
221 | 227 | | |
222 | 228 | | |
223 | | - | |
224 | 229 | | |
225 | 230 | | |
226 | 231 | | |
| |||
232 | 237 | | |
233 | 238 | | |
234 | 239 | | |
235 | | - | |
236 | | - | |
| 240 | + | |
| 241 | + | |
237 | 242 | | |
238 | 243 | | |
239 | 244 | | |
| |||
278 | 283 | | |
279 | 284 | | |
280 | 285 | | |
281 | | - | |
| 286 | + | |
282 | 287 | | |
283 | | - | |
284 | 288 | | |
285 | 289 | | |
286 | | - | |
287 | | - | |
| 290 | + | |
| 291 | + | |
288 | 292 | | |
289 | 293 | | |
290 | 294 | | |
| |||
298 | 302 | | |
299 | 303 | | |
300 | 304 | | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | 305 | | |
307 | 306 | | |
308 | 307 | | |
309 | | - | |
310 | | - | |
311 | | - | |
| 308 | + | |
312 | 309 | | |
313 | 310 | | |
314 | 311 | | |
| |||
929 | 926 | | |
930 | 927 | | |
931 | 928 | | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
932 | 951 | | |
933 | 952 | | |
934 | 953 | | |
| |||
0 commit comments