The correct way to calculate MIPs of a function on a microcontroller I want to calculate MIPs of a function on a microcontroller. Here is how I do it.
1. keil setting. Use Simulator and Xtal = 25MHz





Run simulator in debug mode.

As you can see, it takes 200ms to run fun() once.
200ms(0.2s) * 25MHz = 5M. Does it mean that running fun() takes 5MIPs?
One thing to note that the MIPs of fun() is independent of platform or crystal's oscillation frequency.
Thank you.
As you may know, MIPS means Mega Instructions Per Second.
So the formula would be

CHIP_MIPS = number_of_mega_instructions / number_of_seconds.

If your chip is running at 25 MHz, it means that it performs 25 mega instructions per seconds, so knowing the number of seconds and the CHIP_MIPS, the formula would be

number_of_seconds * CHIP_MIPS = number_of_mega_instructions

So fun needs 5 Mega Intructions