How does rdtsc behave in the presence of multiple cores? As in: first time sample is taken on core P, process is pre-empted, then picked up again by core Q, second time sample is taken on core Q. Assume x64 Intel/AMD etc.
Also - all modern systems in active use have invariant tsc. So even for migrating threads - one is ok.
But googling suggests that if the CPU has the invariant_tsc flag then it’s not a problem, as foobar mentions.