int64_t in receiver missing packets

This commit is contained in:
Erik Frojdh 2022-01-06 15:15:42 +01:00
parent 22c820771a
commit f818ac46b8
5 changed files with 13 additions and 15 deletions

View File

@ -208,6 +208,9 @@ if (NOT TARGET libzmq)
endif() endif()
endif() endif()
get_target_property(VAR libzmq INTERFACE_INCLUDE_DIRECTORIES)
message(STATUS "zmq: ${VAR}")
if (SLS_USE_TESTS) if (SLS_USE_TESTS)
enable_testing() enable_testing()
add_subdirectory(tests) add_subdirectory(tests)

View File

@ -473,9 +473,9 @@ double Implementation::getProgress() const {
((double)(currentFrameIndex + 1) / (double)numberOfTotalFrames)); ((double)(currentFrameIndex + 1) / (double)numberOfTotalFrames));
} }
std::vector<uint64_t> Implementation::getNumMissingPackets() const { std::vector<int64_t> Implementation::getNumMissingPackets() const {
std::vector<uint64_t> mp(numThreads); std::vector<int64_t> mp(numThreads);
for (int i = 0; i < numThreads; i++) { for (int i = 0; i < numThreads; ++i) {
int np = generalData->packetsPerFrame; int np = generalData->packetsPerFrame;
uint64_t totnp = np; uint64_t totnp = np;
// ReadNRows // ReadNRows
@ -595,12 +595,7 @@ void Implementation::stopReceiver() {
LOG(logINFO) << "Status: " << sls::ToString(status); LOG(logINFO) << "Status: " << sls::ToString(status);
{ // statistics { // statistics
auto tmp = getNumMissingPackets(); auto mp = getNumMissingPackets();
// convert to signed missing packets (to get excess)
std::vector<int64_t> mp;
for (auto val : tmp) {
mp.push_back(static_cast<int64_t>(val));
}
// print summary // print summary
uint64_t tot = 0; uint64_t tot = 0;
for (int i = 0; i < numThreads; i++) { for (int i = 0; i < numThreads; i++) {
@ -609,7 +604,7 @@ void Implementation::stopReceiver() {
std::string mpMessage = std::to_string(mp[i]); std::string mpMessage = std::to_string(mp[i]);
if (mp[i] < 0) { if (mp[i] < 0) {
mpMessage = 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; TLogLevel lev = ((mp[i]) > 0) ? logINFORED : logINFOGREEN;

View File

@ -83,7 +83,7 @@ class Implementation : private virtual slsDetectorDefs {
uint64_t getFramesCaught() const; uint64_t getFramesCaught() const;
uint64_t getAcquisitionIndex() const; uint64_t getAcquisitionIndex() const;
double getProgress() const; double getProgress() const;
std::vector<uint64_t> getNumMissingPackets() const; std::vector<int64_t> getNumMissingPackets() const;
void setScan(slsDetectorDefs::scanParameters s); void setScan(slsDetectorDefs::scanParameters s);
void startReceiver(); void startReceiver();
void setStoppedFlag(bool stopped); void setStoppedFlag(bool stopped);

View File

@ -40,7 +40,7 @@ uint64_t Listener::GetLastFrameIndexCaught() const {
return lastCaughtFrameIndex; return lastCaughtFrameIndex;
} }
uint64_t Listener::GetNumMissingPacket(bool stoppedFlag, int64_t Listener::GetNumMissingPacket(bool stoppedFlag,
uint64_t numPackets) const { uint64_t numPackets) const {
if (!stoppedFlag) { if (!stoppedFlag) {
return (numPackets - numPacketsCaught); return (numPackets - numPacketsCaught);

View File

@ -63,8 +63,8 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject {
*/ */
uint64_t GetLastFrameIndexCaught() const; uint64_t GetLastFrameIndexCaught() const;
/** Get number of missing packets */ /** Get number of missing packets, returns negative values in case to extra packet */
uint64_t GetNumMissingPacket(bool stoppedFlag, uint64_t numPackets) const; int64_t GetNumMissingPacket(bool stoppedFlag, uint64_t numPackets) const;
/** /**
* Set Fifo pointer to the one given * Set Fifo pointer to the one given