Commit 8f750bae authored by Alessio Netti's avatar Alessio Netti
Browse files

Fixes to statistics in collectagent

- Fixing a crash when the REST API is disabled
- Casting and macro handling
parent 7a8c719a
......@@ -869,7 +869,7 @@ int main(int argc, char* const argv[]) {
*/
keepRunning = 1;
uint64_t start, end;
double elapsed;
float elapsed;
msgCtr = 0;
readingCtr = 0;
queryCtr = 0;
......@@ -893,12 +893,12 @@ int main(int argc, char* const argv[]) {
if((settings.statisticsInterval > 0) && keepRunning) {
/* not really thread safe but will do the job */
end = getTimestamp();
elapsed = NS_TO_S(((double) end - (double) start));
float aIns = ceil((float) analyticsController->getReadingCtr() / elapsed);
float aReq = ceil((float) queryCtr / elapsed);
float rIns = ceil((float) httpsServer->getInfluxCounter() / elapsed);
float mIns = ceil((float) readingCtr / elapsed);
float mMsg = ceil((float) msgCtr / elapsed);
elapsed = (float)(NS_TO_S(end) - NS_TO_S(start));
float aIns = ceil(((float)analyticsController->getReadingCtr()) / elapsed);
float aReq = ceil(((float)queryCtr) / elapsed);
float rIns = restAPISettings.enabled ? ceil(((float)httpsServer->getInfluxCounter()) / elapsed) : 0.0f;
float mIns = ceil(((float)readingCtr) / elapsed);
float mMsg = ceil(((float) msgCtr) / elapsed);
LOG(info) << "Performance: MQTT [" << std::fixed << std::setprecision(0) << mIns << " ins/s|" << mMsg << " msg/s] REST [" << rIns << " ins/s] Analytics [" << aIns << " ins/s|" << aReq << " req/s]";
std::map<std::string, hostInfo_t> lastSeen = ms.collectLastSeen();
uint64_t connectedHosts = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment