IceCreamSessions: Timestamping p.0
TSC is a register that increments on every CPU tick. RDTSC is the assembly instruction that reads TSC into EDX:EAX. RDTSCP is the assembly instruction that reads TSC into EDX:EAX and also reads the processor ID (IA32_TSC_AUX) into ECX. Equivalent to doing RDTSC + RDPID in a single instruction. Benchmarking a critical session of code is as simple as start = rdtsc() // get current counter value .... beep boop, executing code .... cycles = rdtsc() - start // theoretically the number of cycles Sadly, reality has a surprising amount of detail. ...