mirror of
https://github.com/peterantypas/maiana.git
synced 2025-05-17 07:50:10 -07:00
49 lines
658 B
C++
49 lines
658 B
C++
/*
|
|
* Stats.cpp
|
|
*
|
|
* Created on: Nov 4, 2020
|
|
* Author: peter
|
|
*/
|
|
|
|
|
|
#include "Stats.hpp"
|
|
#include "Utils.hpp"
|
|
#include "EventQueue.hpp"
|
|
|
|
static int count = 0;
|
|
|
|
Stats &Stats::instance()
|
|
{
|
|
static Stats __instance;
|
|
return __instance;
|
|
}
|
|
|
|
Stats::Stats()
|
|
{
|
|
EventQueue::instance().addObserver(this, CLOCK_EVENT);
|
|
}
|
|
|
|
void Stats::init()
|
|
{
|
|
|
|
}
|
|
|
|
void Stats::processEvent(const Event &e)
|
|
{
|
|
++count;
|
|
if ( count % 60 == 0 )
|
|
{
|
|
char buff[32];
|
|
sprintf(buff, "$PAISTC,%d,%d,%d*", eventQueuePopFailures, eventQueuePushFailures, rxPacketPoolPopFailures);
|
|
Utils::completeNMEA(buff);
|
|
|
|
printf_serial(buff);
|
|
count = 1;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|