KRNL - An Arduino Kernel - performanceKRNL is written for educational as well as operational purposes. Many things may be optimized but will make it less easy for people to learn about internals in a realtime kernel
Still it works and is more than fast enough to most purposes. If any body tunes performance please mail me your code so we all can share it (jdnATes.aau.dk) A testTwo task loops:
So for every loop there is 2 task shift.
First pictures shows the setup where the scope register a square wave generated by the Arduino. It togles output for every 100 pairs of signal wait. On the bottom picture you see the scope picture. You can see it takes approx 4.4 msec for 100 pairs of signal and wait each with a task shift. So 4.4 msec divided by 200 gives approc 22 micro sec pr task shift 16 MHz architecture is a clock cycle time around 63 nano sec/cycle. So 22 micro sec equals 350 clock cycles. PUSH and POP is two cycle instructions so 31 registers or so takes in total 4*31 cycles = 124 cycles (or 1/3 of the 22 micro seconds) Now 226 cycles is left for the kernel stuff. |