For my project I must use inline assembly instructions such as rdtsc to calculate the execution time of some C/C++ instructions.
The following code seems to work on Intel but not on ARM processors:
{unsigned a, d;asm volatile("rdtsc" : "=a" (a), "=d" (d)); t0 = ((unsigned long)a) | (((unsigned long)d) << 32);}
//The C++ statement to measure its execution time
{unsigned a, d;asm volatile("rdtsc" : "=a" (a), "=d" (d)); t1 = ((unsigned long)a) | (((unsigned long)d) << 32);}
time = t1-t0;
My question is:
How to write an inline assembly code similar to the above (to calculate the execution elapsed time of an instruction) to work on ARM processors?