SafeString
4.1.27
SafeString is a safe, robust and debuggable replacement for string processing in Arduino
|
There is a predefined loopTimer object that is ready to use, see the detailed description. More...
#include <loopTimer.h>
Public Member Functions | |
loopTimerClass (const char *_name=NULL) | |
void | check (Print *out=NULL) |
void | check (Print &out) |
void | print (Print &out) |
void | print (Print *out) |
void | clear () |
There is a predefined loopTimer object that is ready to use, see the detailed description.
To use the predefined loopTimer to measure your loop processing time, insert this code in loop()
loopTimer.check(Serial);
That will print to Serial the accumulated loop times every 5seconds. Sample output is:-
loop us Latency
5sec max:7276 avg:12
sofar max:7276 avg:12 max - prt:15512
The prt:15512 is an estimate of the time taken (15512us or 15.5ms) by loopTimer itself to format and print this output.
To time the delay between calls to particular method you can either just move the loopTimer.check(Serial); statement from loop() to that method or create an new instance of the loopTimerClass with its own name e.g.
loopTimerClass stepTimer("step");
Then in the step() method insert
stepTimer.check(Serial);
which will print
step us Latency
5sec max:727 avg:23
sofar max:727 avg:32 max - prt:15612
You can also use
loopTimer.check();
to just accumulate the measurements but not print them and then call
loopTimer.print(Serial)
when you want to print them.
See Simple Multitasking Arduino on any board without using an RTOS for examples of using loopTimer.
Definition at line 50 of file loopTimer.h.
loopTimerClass::loopTimerClass | ( | const char * | _name = NULL | ) |
void loopTimerClass::check | ( | Print & | out | ) |
void loopTimerClass::check | ( | Print * | out = NULL | ) |
void loopTimerClass::clear | ( | ) |
void loopTimerClass::print | ( | Print & | out | ) |
void loopTimerClass::print | ( | Print * | out | ) |