Switch to Bing in English
Copilot
Your everyday AI companion
About 63,600 results
    Upvotes8Top Answeranswered Oct 12, 2011 at 19:58

    Its common to use RDTSC to get fine-grained timing information, where the overhead of a virtualization trap would be quite significant. Most common use is to have two RDTSC instructions with a small amount of code between them, taking the difference of the times as the elapsed time (number of cycles) for the code sequence. So even the overhead of pipeline drains/flushes is quite significant.

    Also, since all the instruction does is read a continuously running counter, virtualizing it is quite easy -- the hardware only needs to allow saving/relo...

    Content Under CC-BY-SA license
    Was this helpful?
  1. Timekeeping Virtualization for X86-Based Architectures

  2. Why is RDTSC a virtualized instruction on modern processors?

  3. People also ask
    Does anyone know why? Its common to use RDTSC to get fine-grained timing information, where the overhead of a virtualization trap would be quite significant. Most common use is to have two RDTSC instructions with a small amount of code between them, taking the difference of the times as the elapsed time (number of cycles) for the code sequence.
    The RDTSC instruction is not a serializing instruction. Thus, it does not necessarily wait until all previous instructions have been executed before reading the counter. Similarly, subsequent instructions may begin execution before the read operation is performed. This instruction was introduced into the IA-32 Architecture in the Pentium processor.
    Some vendors have implemented an additional instruction, RDTSCP, which returns atomically not just the TSC, but an indicator which corresponds to the processor number. This can be used to index into an array of TSC variables to determine offset information in SMP systems where TSCs are not synchronized.
    The 2010 Intel paper How to Benchmark Code Execution Times on Intel ® IA-32 and IA-64 Instruction Set Architectures can be considered as outdated when it comes to its recommendations to combine RDTSC/RDTSCP with CPUID. Current Intel reference documentation recommends fencing instructions as more efficient alternatives to CPUID:
  4. xuwd1/rdtsc-notes - GitHub

  5. An introduction to timekeeping in Linux VMs | Opensource.com

  6. RDTSC | x86 Instruction Set Reference

  7. Resurrecting anti-virtualization and anti-debugging: Unhooking ...

  8. Clocks, Timers and Virtualization :: silly onions ...

  9. __rdtsc | Microsoft Learn

By using this site you agree to the use of cookies for analytics, personalized content, and ads.Learn more about third party cookies|Microsoft Privacy Policy