for loop calculation

hi i was wondering in a embedded application, how long it takes one for loop to complete. if the CPU runs at 12Mhz clock speed in a RISC 8051
closed account (S6k9GNh0)
Calculating this would be similar to calculating frames per second (or the exact same as). I have no clue how to calculate that but I know the concept behind it. :D
If you are a masochist:

1) compile your code to an assembler source,
2) find latency of every instruction from the processor's user manual (they may often be ranges instead of fixed values, since the exact time depends on many factors, for example cache in case of memory accesses),
3) sum everything, convert to seconds and you've done it.

otherwise:

1) add some kind of time measuerment before and after the loop,
2) execute the program a few times,
3) calculate average.
Topic archived. No new replies allowed.