mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-26 16:20:03 +02:00
warning in using abs for unsigned (missing packets) in rxr, but also trying to print to signed in command line (so as not to change api atm)
This commit is contained in:
parent
2dd98c6054
commit
77fb8280f1
@ -588,7 +588,9 @@ class Detector {
|
||||
|
||||
Result<int64_t> getFramesCaught(Positions pos = {}) const;
|
||||
|
||||
/** Gets the number of missing packets for each port in receiver. */
|
||||
/** Gets the number of missing packets for each port in receiver.
|
||||
* Troubleshoot: If they are large numbers, convert it to signed to get
|
||||
* number of access packets received */
|
||||
Result<std::vector<uint64_t>>
|
||||
getNumMissingPackets(Positions pos = {}) const;
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#include "CmdProxy.h"
|
||||
@ -1273,6 +1274,40 @@ std::string CmdProxy::DetectorStatus(int action) {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::RxMissingPackets(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "Number of missing packets for each port in receiver. If "
|
||||
"negative, they are packets in excess. "
|
||||
<< '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (!args.empty()) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
auto tmp = det->getNumMissingPackets(std::vector<int>{det_id});
|
||||
// convert to signed missing packets (to get excess)
|
||||
/*
|
||||
Result<std::vector<int64_t>> mp(tmp.size());
|
||||
for (unsigned int i = 0; i < mp.size(); ++i) {
|
||||
mp[i] = static_cast<int64_t>(tmp[i]);
|
||||
}
|
||||
*/
|
||||
|
||||
Result<std::vector<int64_t>> mp;
|
||||
for (auto val : tmp) {
|
||||
mp.push_back(static_cast<int64_t>(val));
|
||||
}
|
||||
|
||||
os << OutString(mp) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
throw sls::RuntimeError("Cannot put");
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::Scan(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
|
@ -859,7 +859,7 @@ class CmdProxy {
|
||||
{"rx_status", &CmdProxy::ReceiverStatus},
|
||||
{"status", &CmdProxy::DetectorStatus},
|
||||
{"rx_framescaught", &CmdProxy::rx_framescaught},
|
||||
{"rx_missingpackets", &CmdProxy::rx_missingpackets},
|
||||
{"rx_missingpackets", &CmdProxy::RxMissingPackets},
|
||||
{"nextframenumber", &CmdProxy::nextframenumber},
|
||||
{"trigger", &CmdProxy::Trigger},
|
||||
{"scan", &CmdProxy::Scan},
|
||||
@ -1128,6 +1128,7 @@ class CmdProxy {
|
||||
/* acquisition */
|
||||
std::string ReceiverStatus(int action);
|
||||
std::string DetectorStatus(int action);
|
||||
std::string RxMissingPackets(int action);
|
||||
std::string Scan(int action);
|
||||
std::string Trigger(int action);
|
||||
/* Network Configuration (Detector<->Receiver) */
|
||||
|
@ -595,18 +595,24 @@ void Implementation::stopReceiver() {
|
||||
LOG(logINFO) << "Status: " << sls::ToString(status);
|
||||
|
||||
{ // statistics
|
||||
std::vector<uint64_t> mp = getNumMissingPackets();
|
||||
auto tmp = 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
|
||||
uint64_t tot = 0;
|
||||
for (int i = 0; i < numThreads; i++) {
|
||||
int nf = dataProcessor[i]->GetNumCompleteFramesCaught();
|
||||
tot += nf;
|
||||
std::string mpMessage = std::to_string((int64_t)mp[i]);
|
||||
if ((int64_t)mp[i] < 0) {
|
||||
std::string mpMessage = std::to_string(mp[i]);
|
||||
if (mp[i] < 0) {
|
||||
mpMessage =
|
||||
std::to_string(abs(mp[i])) + std::string(" (Extra)");
|
||||
}
|
||||
|
||||
TLogLevel lev = (((int64_t)mp[i]) > 0) ? logINFORED : logINFOGREEN;
|
||||
TLogLevel lev = ((mp[i]) > 0) ? logINFORED : logINFOGREEN;
|
||||
LOG(lev) <<
|
||||
// udp port number could be the second if selected interface is
|
||||
// 2 for jungfrau
|
||||
|
Loading…
x
Reference in New Issue
Block a user