From f818ac46b87ef9bcf146438514857eaa614e66cd Mon Sep 17 00:00:00 2001 From: Erik Frojdh Date: Thu, 6 Jan 2022 15:15:42 +0100 Subject: [PATCH] int64_t in receiver missing packets --- CMakeLists.txt | 3 +++ slsReceiverSoftware/src/Implementation.cpp | 15 +++++---------- slsReceiverSoftware/src/Implementation.h | 2 +- slsReceiverSoftware/src/Listener.cpp | 4 ++-- slsReceiverSoftware/src/Listener.h | 4 ++-- 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8774bd733..02cdad9cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -208,6 +208,9 @@ if (NOT TARGET libzmq) endif() endif() +get_target_property(VAR libzmq INTERFACE_INCLUDE_DIRECTORIES) +message(STATUS "zmq: ${VAR}") + if (SLS_USE_TESTS) enable_testing() add_subdirectory(tests) diff --git a/slsReceiverSoftware/src/Implementation.cpp b/slsReceiverSoftware/src/Implementation.cpp index 4e68049a7..8ed01eeb4 100644 --- a/slsReceiverSoftware/src/Implementation.cpp +++ b/slsReceiverSoftware/src/Implementation.cpp @@ -473,9 +473,9 @@ double Implementation::getProgress() const { ((double)(currentFrameIndex + 1) / (double)numberOfTotalFrames)); } -std::vector Implementation::getNumMissingPackets() const { - std::vector mp(numThreads); - for (int i = 0; i < numThreads; i++) { +std::vector Implementation::getNumMissingPackets() const { + std::vector mp(numThreads); + for (int i = 0; i < numThreads; ++i) { int np = generalData->packetsPerFrame; uint64_t totnp = np; // ReadNRows @@ -595,12 +595,7 @@ void Implementation::stopReceiver() { LOG(logINFO) << "Status: " << sls::ToString(status); { // statistics - auto tmp = getNumMissingPackets(); - // convert to signed missing packets (to get excess) - std::vector mp; - for (auto val : tmp) { - mp.push_back(static_cast(val)); - } + auto mp = getNumMissingPackets(); // print summary uint64_t tot = 0; for (int i = 0; i < numThreads; i++) { @@ -609,7 +604,7 @@ void Implementation::stopReceiver() { std::string mpMessage = std::to_string(mp[i]); if (mp[i] < 0) { mpMessage = - std::to_string(abs(mp[i])) + std::string(" (Extra)"); + std::to_string(std::abs(mp[i])) + std::string(" (Extra)"); } TLogLevel lev = ((mp[i]) > 0) ? logINFORED : logINFOGREEN; diff --git a/slsReceiverSoftware/src/Implementation.h b/slsReceiverSoftware/src/Implementation.h index 5e5baf863..b50280832 100644 --- a/slsReceiverSoftware/src/Implementation.h +++ b/slsReceiverSoftware/src/Implementation.h @@ -83,7 +83,7 @@ class Implementation : private virtual slsDetectorDefs { uint64_t getFramesCaught() const; uint64_t getAcquisitionIndex() const; double getProgress() const; - std::vector getNumMissingPackets() const; + std::vector getNumMissingPackets() const; void setScan(slsDetectorDefs::scanParameters s); void startReceiver(); void setStoppedFlag(bool stopped); diff --git a/slsReceiverSoftware/src/Listener.cpp b/slsReceiverSoftware/src/Listener.cpp index c1ed94185..3dc7a5559 100644 --- a/slsReceiverSoftware/src/Listener.cpp +++ b/slsReceiverSoftware/src/Listener.cpp @@ -40,8 +40,8 @@ uint64_t Listener::GetLastFrameIndexCaught() const { return lastCaughtFrameIndex; } -uint64_t Listener::GetNumMissingPacket(bool stoppedFlag, - uint64_t numPackets) const { +int64_t Listener::GetNumMissingPacket(bool stoppedFlag, + uint64_t numPackets) const { if (!stoppedFlag) { return (numPackets - numPacketsCaught); } diff --git a/slsReceiverSoftware/src/Listener.h b/slsReceiverSoftware/src/Listener.h index 8cdc4b930..18dbf3ef5 100644 --- a/slsReceiverSoftware/src/Listener.h +++ b/slsReceiverSoftware/src/Listener.h @@ -63,8 +63,8 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject { */ uint64_t GetLastFrameIndexCaught() const; - /** Get number of missing packets */ - uint64_t GetNumMissingPacket(bool stoppedFlag, uint64_t numPackets) const; + /** Get number of missing packets, returns negative values in case to extra packet */ + int64_t GetNumMissingPacket(bool stoppedFlag, uint64_t numPackets) const; /** * Set Fifo pointer to the one given