From d9cd90a13d29497f19d2fc1fe2da6ca0f8394877 Mon Sep 17 00:00:00 2001 From: Srivats P Date: Tue, 21 Jun 2022 18:53:35 +0530 Subject: [PATCH] Clear stream stats before starting Tx on port This is required for correct stream rate calculations --- server/myservice.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/myservice.cpp b/server/myservice.cpp index a73eddd..1b5db15 100644 --- a/server/myservice.cpp +++ b/server/myservice.cpp @@ -426,6 +426,10 @@ void MyService::startTransmit(::google::protobuf::RpcController* /*controller*/, qDebug("In %s", __PRETTY_FUNCTION__); + // XXX: stream stats uses port tx duration to calculate per stream + // rates; tx duration is for the last tx run only - so stream stats + // should also correspond to the last run only. + // Hence clear stream stats before Tx for (int i = 0; i < request->port_id_size(); i++) { int portId; @@ -442,6 +446,7 @@ void MyService::startTransmit(::google::protobuf::RpcController* /*controller*/, portLock[portId]->lockForWrite(); if (portInfo[portId]->isDirty()) frameError = portInfo[portId]->updatePacketList(); + portInfo[portId]->resetStreamStatsAll(); portInfo[portId]->startTransmit(); portLock[portId]->unlock(); if (frameError) {