10 #include <avr/interrupt.h>
11 #include "performance_test.h"
15 uint16_t const_overhead=0;
16 uint16_t int_overhead=0;
22 void calibrateTimer(void){
25 const_overhead = TCNT1;
29 // asm volatile("NOP\n"::); asm volatile("NOP\n"::);
34 void startTimer(uint8_t granularity){
35 TCCR1B = 0; /* stop timer */
40 TIMSK |= _BV(2); /* enable TOIE1 */
41 TCCR1B = granularity & 0x7; /* start timer */
44 uint64_t stopTimer(void){
45 TCCR1B = 0; /* stop timer */
47 ret = (ovfcounter<<16) | TCNT1;
48 ret -= const_overhead;
49 ret -= ovfcounter * int_overhead;
53 void getOverhead(uint16_t* constoh, uint16_t* intoh){
54 *constoh = const_overhead;
55 *intoh = int_overhead;