Thats one way.
Another way which is better if your doing other things on the chip at the same time:
- When a interrupt fires, revolutions++;
- Every X ms (however fine you want it) get the number of revolutions and reset the variable to 0
- Compare the previous number to the current number. The change is acceleration while the number is absolute speed.