Advanced Assembly Language
Q71 / 100

What is the purpose of RDTSC in timing and what are its caveats?

Correct! Well done.

Incorrect.

The correct answer is B) Reads the Time Stamp Counter (CPU cycle count); out-of-order execution and CPU frequency scaling require LFENCE/CPUID for accurate micro-benchmarks

B

Correct Answer

Reads the Time Stamp Counter (CPU cycle count); out-of-order execution and CPU frequency scaling require LFENCE/CPUID for accurate micro-benchmarks

Explanation

RDTSC is fast but can be reordered. Use LFENCE; RDTSC; LFENCE or RDTSCP for serialized timing. Modern Intel CPUs have a constant TSC not tied to clock scaling.

Progress
71/100