cgnuino
|
Monitors average length of executed loops on Arduino. More...
#include <cgnuino.h>
Public Member Functions | |
CgnValtiel () | |
Constructor. | |
void | start () |
Start monitoring loop length by resetting the counter. | |
float | lap () |
Show average length of past loops and count up the counter. More... | |
uint32_t | getMax () |
Show maximal length of past loop in [ms]. | |
uint32_t | getMin () |
Show minimal length of past loop in [ms]. | |
When prototyping your experiment, there are often times that you want to check whether your task is runnning in a reasonably good time resolution. Since some of the classes in cgnuino library is dependent on the frequency of loop
function, it is important to correctly know how quick your loop
is executed. CgnValtiel class offers an easy way for this. After you start
the monitoring, call lap
method once (and only once) in every loop
call. (For example, put lap
on the very beginning of your loop
function.) CgnValtiel class counts the number of laps and the elapsed time from start
, and tell you the average length of your loop
(in millisecond). You can also check the maximal and minimal length of your loop
by getMax
and getMin
method. These can be useful since there is a case that a loop gets unexpectedly overlong or overshort in only a realy realy small probability, thus leaving the average length superficially unaffected.
CgnValtiel class is named for an imaginary creature which appears on a video game series "Silent Hill". Despite its dreadful appearance, it is actually not a monster but a servant of God of indigenous religion in Silent Hill (thus being a position of an angel). It governs metempsychosis or reincarnation, watching the tide of fates of living things. During a gameplay, it often appears with a revolving valve that symbolizes its religious role in reincarnation. In a deep respect for the Silent Hill series, CgnValtiel class was named for, for its role of monitoring the cycle of your experimental loops.
float CgnValtiel::lap | ( | ) |
loop
function.