I have a C code in UNIX where I need to keep my processor doing nothing for 2 seconds. In order to do that, I found the assembly instruction asm volatile("nop"::). I've searched a lot but I couldn't find anywhere explaining how can I calculate the necessary number of NOPs to execute my function for exactly 2 seconds. Can anyone help me?
for(i = 0; i < COUNTER; i++){
asm volatile ("nop"::);
}