readnlines->partialread, better debugging for TCP socket interface bug

This commit is contained in:
2021-08-13 12:34:50 +02:00
parent eb652557b6
commit 62d697e91f
35 changed files with 131 additions and 119 deletions

View File

@ -187,7 +187,7 @@ int ClientInterface::functionTable(){
flist[F_SET_RECEIVER_DBIT_OFFSET] = &ClientInterface::set_dbit_offset;
flist[F_GET_RECEIVER_DBIT_OFFSET] = &ClientInterface::get_dbit_offset;
flist[F_SET_RECEIVER_QUAD] = &ClientInterface::set_quad_type;
flist[F_SET_RECEIVER_READ_N_LINES] = &ClientInterface::set_read_n_lines;
flist[F_SET_RECEIVER_PARTIAL_READOUT] = &ClientInterface::set_partial_readout;
flist[F_SET_RECEIVER_UDP_IP] = &ClientInterface::set_udp_ip;
flist[F_SET_RECEIVER_UDP_IP2] = &ClientInterface::set_udp_ip2;
flist[F_SET_RECEIVER_UDP_PORT] = &ClientInterface::set_udp_port;
@ -224,6 +224,7 @@ int ClientInterface::functionTable(){
int ClientInterface::decodeFunction(Interface &socket) {
ret = FAIL;
socket.Receive(fnum);
socket.setFnum(fnum);
if (fnum <= NUM_DET_FUNCTIONS || fnum >= NUM_REC_FUNCTIONS) {
throw RuntimeError("Unrecognized Function enum " +
std::to_string(fnum) + "\n");
@ -413,7 +414,7 @@ int ClientInterface::setup_receiver(Interface &socket) {
std::to_string(arg.quad) +
" due to fifo strucutre memory allocation");
}
impl()->setReadNLines(arg.numLinesReadout);
impl()->setPartialReadout(arg.partialReadout);
impl()->setThresholdEnergy(arg.thresholdEnergyeV[0]);
}
if (myDetectorType == MYTHEN3) {
@ -1403,16 +1404,16 @@ int ClientInterface::set_quad_type(Interface &socket) {
return socket.Send(OK);
}
int ClientInterface::set_read_n_lines(Interface &socket) {
int ClientInterface::set_partial_readout(Interface &socket) {
auto arg = socket.Receive<int>();
if (arg >= 0) {
verifyIdle(socket);
LOG(logDEBUG1) << "Setting Read N Lines:" << arg;
impl()->setReadNLines(arg);
LOG(logDEBUG1) << "Setting Partial Readout:" << arg;
impl()->setPartialReadout(arg);
}
int retval = impl()->getReadNLines();
validate(arg, retval, "set read n lines", DEC);
LOG(logDEBUG1) << "read n lines retval:" << retval;
int retval = impl()->getPartialReadout();
validate(arg, retval, "set partial readout", DEC);
LOG(logDEBUG1) << "read partial readout:" << retval;
return socket.Send(OK);
}

View File

@ -138,7 +138,7 @@ class ClientInterface : private virtual slsDetectorDefs {
int set_dbit_offset(sls::ServerInterface &socket);
int get_dbit_offset(sls::ServerInterface &socket);
int set_quad_type(sls::ServerInterface &socket);
int set_read_n_lines(sls::ServerInterface &socket);
int set_partial_readout(sls::ServerInterface &socket);
sls::MacAddr setUdpIp(sls::IpAddr arg);
int set_udp_ip(sls::ServerInterface &socket);
sls::MacAddr setUdpIp2(sls::IpAddr arg);

View File

@ -477,8 +477,8 @@ std::vector<uint64_t> Implementation::getNumMissingPackets() const {
int np = generalData->packetsPerFrame;
uint64_t totnp = np;
// partial readout
if (numLinesReadout != MAX_EIGER_ROWS_PER_READOUT) {
totnp = ((numLinesReadout * np) / MAX_EIGER_ROWS_PER_READOUT);
if (partialReadout != MAX_EIGER_ROWS_PER_READOUT) {
totnp = ((partialReadout * np) / MAX_EIGER_ROWS_PER_READOUT);
}
totnp *= numberOfTotalFrames;
mp[i] = listener[i]->GetNumMissingPacket(stoppedFlag, totnp);
@ -765,7 +765,7 @@ void Implementation::SetupWriter() {
masterAttributes->subExptime = subExpTime;
masterAttributes->subPeriod = subPeriod;
masterAttributes->quad = quadEnable;
masterAttributes->numLinesReadout = numLinesReadout;
masterAttributes->partialReadout = partialReadout;
masterAttributes->ratecorr = rateCorrections;
masterAttributes->adcmask =
tengigaEnable ? adcEnableMaskTenGiga : adcEnableMaskOneGiga;
@ -1533,11 +1533,11 @@ void Implementation::setDeactivatedPadding(bool enable) {
<< (deactivatedPaddingEnable ? "enabled" : "disabled");
}
int Implementation::getReadNLines() const { return numLinesReadout; }
int Implementation::getPartialReadout() const { return partialReadout; }
void Implementation::setReadNLines(const int value) {
numLinesReadout = value;
LOG(logINFO) << "Number of Lines to readout: " << numLinesReadout;
void Implementation::setPartialReadout(const int value) {
partialReadout = value;
LOG(logINFO) << "Partial readout (#rows): " << partialReadout;
}
void Implementation::setThresholdEnergy(const int value) {

View File

@ -218,9 +218,9 @@ class Implementation : private virtual slsDetectorDefs {
bool getDeactivatedPadding() const;
/* [Eiger] */
void setDeactivatedPadding(const bool enable);
int getReadNLines() const;
int getPartialReadout() const;
/* [Eiger] */
void setReadNLines(const int value);
void setPartialReadout(const int value);
/** [Eiger] */
void setThresholdEnergy(const int value);
void setThresholdEnergy(const std::array<int, 3> value);
@ -352,7 +352,7 @@ class Implementation : private virtual slsDetectorDefs {
bool activated{true};
std::array<bool, 2> detectorDataStream = {{true, true}};
bool deactivatedPaddingEnable{true};
int numLinesReadout{MAX_EIGER_ROWS_PER_READOUT};
int partialReadout{MAX_EIGER_ROWS_PER_READOUT};
int thresholdEnergyeV{-1};
std::array<int, 3> thresholdAllEnergyeV = {{-1, -1, -1}};
std::vector<int64_t> rateCorrections;

View File

@ -37,7 +37,7 @@ struct MasterAttributes {
ns subExptime{0};
ns subPeriod{0};
uint32_t quad{0};
uint32_t numLinesReadout;
uint32_t partialReadout;
std::vector<int64_t> ratecorr;
uint32_t adcmask{0};
uint32_t analog{0};
@ -373,7 +373,7 @@ class EigerMasterAttributes : public MasterAttributes {
<< "SubPeriod : " << sls::ToString(subPeriod)
<< '\n'
<< "Quad : " << quad << '\n'
<< "Number of Lines read out : " << numLinesReadout << '\n'
<< "Partial Readout (rows) : " << partialReadout << '\n'
<< "Rate Corrections : " << sls::ToString(ratecorr)
<< '\n';
std::string message = oss.str();
@ -427,12 +427,12 @@ class EigerMasterAttributes : public MasterAttributes {
group->createDataSet("Quad", PredType::NATIVE_INT, dataspace);
dataset.write(&quad, PredType::NATIVE_INT);
}
// numLinesReadout
// partialReadout
{
DataSpace dataspace = DataSpace(H5S_SCALAR);
DataSet dataset = group->createDataSet(
"Number of Lines read out", PredType::NATIVE_INT, dataspace);
dataset.write(&numLinesReadout, PredType::NATIVE_INT);
"Partial readout (rows)", PredType::NATIVE_INT, dataspace);
dataset.write(&partialReadout, PredType::NATIVE_INT);
}
// Rate corrections
{