Please add SDL_HasInvariantTSC function with which I can find out if the Invariant TSC is supported.
Or you can go Linux way and add two functions:
SDL_HasConstantTSC and SDL_HasNonstopTSC
Basically, Invariant TSC = Constant TSC and Non-stop TSC
Reference implementation:
/* http://www.mkurnosov.net/uploads/Main/mkurnosov-rdtsc-2014.pdf */
/* is_tsc_invariant: Returns 1 if TSC is invariant. */
int is_tsc_invariant()
{
uint32_t edx;
__asm__ __volatile__(
"movl $0x80000007, %%eax\n"
"cpuid\n"
"movl %%edx, %0\n"
: "=r" (edx) /* Output */
: /* Input */
: "%rax", "%rbx", "%rcx", "%rdx" /* Clobbered registers */
);
return edx & (1U << 8) ? 1 : 0;
}