#include <SFBTicker.h>
Public Member Functions | |
u32 | getMsec (u32 tickerCode) |
Return the number of milliseconds assigned to tickerCode. | |
u32 | getPPM (u32 tickerCode) |
Return the fraction of time assigned to tickerCode, in parts per million. | |
u32 | getTotalMsec () |
Return the total number of milliseconds since the (last) call on begin. | |
void | begin () |
Initialize or reinitialize the system, clearing all counts. | |
void | end () |
Stop the SFBProfile system. | |
Friends | |
void | updateProfile (u32 when, void *arg) |
Note that unlike Ticker, which is an integral part of the core software, use of this SFBProfile class (via its associated object Profile) is optional, and it will not be included in builds unless your sketch code refers to it. If you do make use of the Profile, it will cost you 40 bytes of RAM and one alarm from the Alarms pool.
To initialize the system, just call Profile.begin()
from the setup() function. The begin() method can be called again to clear and reinitialize the SFBProfile if desired, to get 'fresh statistics' (or if your sketch runtime is exceeding about a month).
While the Profile is running, it will automatically gather data from the Ticker as needed. In addition, the Profile automatically resets the Ticker about every half hour, to keep it from overflowing. Consequently, while the Profile is being used, the sketch must not call SFBTicker::reset() itself, and calls to SFBTicker::getUsec() will return values relative to the time of the last Profile-induced reset.
The sketch may call end() to deactivate the SFBProfile system prior to interacting directly with the Ticker.
void SFBProfile::end | ( | ) |
Stop the SFBProfile system.
When stopped, the SFBProfile system will not reset the Ticker object, so it can safely be manipulated by direct SFBTicker calls.
Return the number of milliseconds assigned to tickerCode.
This value may be inaccurate if more than forty-nine days have elapsed since the (last) call on begin().
tickerCode | The SFBTickerCategories category to access. |
Return the fraction of time assigned to tickerCode, in parts per million.
This value may be inaccurate if more than forty-nine days have elapsed since the (last) call on begin().
This value can be turned into a percentage by dividing by 10,000. Calling getPPM() on all categories and summing the results will generally produce a value slightly smaller than 1,000,000, due to truncation.
tickerCode | The SFBTickerCategories category to access. |
u32 SFBProfile::getTotalMsec | ( | ) |