For timing short intervals, you can use this timer #1 quick and dirty technique: Clear the timer, start then stop it. Read the value of the counter, it will be in cycles (times prescaler). This is particularly useful for profiling execution of code. Understand this will trash timer1, which in the arduino is used for the Servo library.
TCCR1B = 1; TCNT1 = 0; // //insert code to be profiled here // TCCR1B = 0; printf("Cycles=%d\n\r", TCNT1);
Remember to set the prescaler if necessary. The prescale can be set to 1, 8, 64, 256 or 1024, and at 16MHz:
Prescale Time per counter tick 1 0.0625uS 8 0.500uS 64 4.000uS 256 16.000uS 1024 64.000uS
Time per Tick = (Prescale)*(1/Frequency)