I'm new to C++ and benchmarking
I don't understand what the this part of the code does? So I found something about the edx, eax registers, but I don't fully understand how that plays into the code. So I understand this code essentially returns the current tick of the cpu cycle. So, does it store the current tick into the registers, one part in the hi and the other part in the lo. And, does the "=a", and "=d" specify which register to store it in.
And what is the significance of breaking it into two parts.
"rdtsc" : "=a" (lo), "=d" (hi)
Code in context:
int64_t rdtsc(){
unsigned int lo,hi;
__asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
return ((uint64_t)hi << 32) | lo;
}
unsigned long
, so the compiler knows it doesn't have to zero-extend EAX into RAX; it's already zero extended. Using the intrinsic saves you from little details like that. – Threecolor