From 9d795966292f80e2bfe1181a06c24eb117af1340 Mon Sep 17 00:00:00 2001 From: Benjamin Sergeant Date: Fri, 17 Apr 2020 09:56:09 -0700 Subject: [PATCH] (ixbots) display sent/receive message, per seconds as accumulated --- docs/CHANGELOG.md | 4 ++++ ixbots/ixbots/IXCobraBot.cpp | 13 +++++++++++-- ixwebsocket/IXWebSocketVersion.h | 2 +- ws/ws.cpp | 4 ++-- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 03ad5334..2f4cba98 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog All changes to this project will be documented in this file. +## [9.3.3] - 2020-04-17 + +(ixbots) display sent/receive message, per seconds as accumulated + ## [9.3.2] - 2020-04-17 (ws) add a --logfile option to configure all logs to go to a file diff --git a/ixbots/ixbots/IXCobraBot.cpp b/ixbots/ixbots/IXCobraBot.cpp index 094e487e..b91319a2 100644 --- a/ixbots/ixbots/IXCobraBot.cpp +++ b/ixbots/ixbots/IXCobraBot.cpp @@ -34,16 +34,25 @@ namespace ix Json::FastWriter jsonWriter; std::atomic sentCount(0); std::atomic receivedCount(0); + std::atomic sentCountTotal(0); + std::atomic receivedCountTotal(0); std::atomic stop(false); std::atomic throttled(false); std::atomic fatalCobraError(false); QueueManager queueManager(maxQueueSize); - auto timer = [&sentCount, &receivedCount, &stop] { + auto timer = [&sentCount, &receivedCount, &sentCountTotal, &receivedCountTotal, &stop] { while (!stop) { - spdlog::info("messages received {} sent {}", receivedCount, sentCount); + spdlog::info("messages received {} {} sent {} {}", + receivedCount, receivedCountTotal, sentCount, sentCountTotal); + + receivedCountTotal += receivedCount; + sentCountTotal += sentCount; + + receivedCount = 0; + sentCount = 0; auto duration = std::chrono::seconds(1); std::this_thread::sleep_for(duration); diff --git a/ixwebsocket/IXWebSocketVersion.h b/ixwebsocket/IXWebSocketVersion.h index 548c4795..9a31997f 100644 --- a/ixwebsocket/IXWebSocketVersion.h +++ b/ixwebsocket/IXWebSocketVersion.h @@ -6,4 +6,4 @@ #pragma once -#define IX_WEBSOCKET_VERSION "9.3.2" +#define IX_WEBSOCKET_VERSION "9.3.3" diff --git a/ws/ws.cpp b/ws/ws.cpp index 8102e6af..e8613770 100644 --- a/ws/ws.cpp +++ b/ws/ws.cpp @@ -19,8 +19,8 @@ #include #include #include -#include #include +#include #include #include @@ -414,7 +414,7 @@ int main(int argc, char** argv) std::cerr << "All logs will be redirected to " << logfile << std::endl; } - catch (const spdlog::spdlog_ex &ex) + catch (const spdlog::spdlog_ex& ex) { std::cerr << "Fatal error, log init failed: " << ex.what() << std::endl; ix::uninitNetSystem();