Copilot
Your everyday AI companion
  1. People also ask
    Relying on the TSC also reduces portability, as other processors may not have a similar feature. Recent Intel processors include a constant rate TSC (identified by the kern.timecounter.invariant_tsc sysctl on FreeBSD or by the " constant_tsc " flag in Linux's /proc/cpuinfo ).
    It counts at a fixed frequency regardless of turbo / power-saving, so if you want uops-per-clock analysis, use performance counters. rdtsc is exactly correlated with wall-clock time (except for system clock adjustments, so it's basically steady_clock ). It ticks at the CPU's rated frequency, i.e. the advertised sticker frequency.
    (When in real-address mode, the RDTSC instruction is always enabled.) The time-stamp counter can also be read with the RDMSR instruction, when executing at privilege level 0. 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.
    Normally, the RDTSC instruction can be executed by programs and procedures running at any privilege level and in virtual-8086 mode. The TSD flag allows use of this instruction to be restricted to programs and procedures running at privilege level 0.
  2. Code sample

    #if defined(__i386__)
    static __inline__ unsigned long long rdtsc(void) {
      unsigned long long int x;
      __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
      return x;...
  3. RDTSC — Read Time-Stamp Counter - felixcloutier.com

  4. RDTSC—Read Time-Stamp Counter - GitHub Pages

  5. Rdtsc - Assembly Language Reference

  6. Intel Pentium Instruction Set Reference - RDTSC - Read Time …

  7. RDTSC | x86 Instruction Set Reference