3 * email: daniel.otte@rub.de
13 #include <avr/interrupt.h>
14 #include "performance_test.h"
25 uint16_t const_overhead=0;
26 uint16_t int_overhead=0;
32 void calibrateTimer(void){
35 const_overhead = TCNT1;
39 // asm volatile("NOP\n"::); asm volatile("NOP\n"::);
44 void startTimer(uint8_t granularity){
45 TCCR1B = 0; /* stop timer */
50 TIMSK |= _BV(TOIE1); /* enable TOIE1 */
51 TCCR1B = granularity & 0x7; /* start timer */
54 uint64_t stopTimer(void){
55 TCCR1B = 0; /* stop timer */
57 ret = (ovfcounter<<16) | TCNT1;
58 ret -= const_overhead;
59 ret -= ovfcounter * int_overhead;
63 void getOverhead(uint16_t* constoh, uint16_t* intoh){
64 *constoh = const_overhead;
65 *intoh = int_overhead;