Usage of RDTSC in C code in the year 2023 has several negative effects.
TSC cannot be relied upon to provide accurate results — unless great care is taken to correct the possible flaws: rate of tick and whether all cores (processors) have identical values in their time-keeping registers.
https://en.wikipedia.org/wiki/Time_Stamp_Counter
The RDTSC CPU instruction is supported mostly on CPUs of Intel x86 architecture and their derivatives such as AMD64. This makes benchmarking useless on CPU having following architectures – ARM, MIPS, POWER, RISC-V, SPARC and others. It is also useless on virtual ISA's such as WebAssembly. All this makes the C code unportable.
Usage of
RDTSC
in C code in the year 2023 has several negative effects.TSC cannot be relied upon to provide accurate results — unless great care is taken to correct the possible flaws: rate of tick and whether all cores (processors) have identical values in their time-keeping registers. https://en.wikipedia.org/wiki/Time_Stamp_Counter
The
RDTSC
CPU instruction is supported mostly on CPUs of Intel x86 architecture and their derivatives such as AMD64. This makes benchmarking useless on CPU having following architectures – ARM, MIPS, POWER, RISC-V, SPARC and others. It is also useless on virtual ISA's such as WebAssembly. All this makes the C code unportable.