mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-19 16:27:13 +02:00
sending and writing subexptime in the receiver files, adding 0x in front of all numbers printed in command line which is hexa
This commit is contained in:
@ -101,7 +101,7 @@ int BinaryFile::WriteToFile(char* buffer, int buffersize, uint64_t fnum, uint32_
|
||||
|
||||
|
||||
int BinaryFile::CreateMasterFile(bool en, uint32_t size,
|
||||
uint32_t nx, uint32_t ny, uint64_t at, uint64_t ap) {
|
||||
uint32_t nx, uint32_t ny, uint64_t at, uint64_t st, uint64_t ap) {
|
||||
//beginning of every acquisition
|
||||
numFramesInFile = 0;
|
||||
numActualPacketsInFile = 0;
|
||||
@ -111,7 +111,7 @@ int BinaryFile::CreateMasterFile(bool en, uint32_t size,
|
||||
FILE_LOG(logINFO) << "Master File: " << masterFileName;
|
||||
return BinaryFileStatic::CreateMasterDataFile(masterfd, masterFileName, *overWriteEnable,
|
||||
*dynamicRange, en, size, nx, ny, *numImages,
|
||||
at, ap, BINARY_WRITER_VERSION);
|
||||
at, st, ap, BINARY_WRITER_VERSION);
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
@ -247,10 +247,10 @@ void DataProcessor::SetupFileWriter(int* nd, char* fname, char* fpath, uint64_t*
|
||||
}
|
||||
|
||||
// only the first file
|
||||
int DataProcessor::CreateNewFile(bool en, uint64_t nf, uint64_t at, uint64_t ap) {
|
||||
int DataProcessor::CreateNewFile(bool en, uint64_t nf, uint64_t at, uint64_t st, uint64_t ap) {
|
||||
file->CloseAllFiles();
|
||||
if (file->CreateMasterFile(en, generalData->imageSize, generalData->nPixelsX, generalData->nPixelsY,
|
||||
at, ap) == FAIL)
|
||||
at, st, ap) == FAIL)
|
||||
return FAIL;
|
||||
if (file->CreateFile(currentFrameIndex) == FAIL)
|
||||
return FAIL;
|
||||
|
@ -45,6 +45,7 @@ void UDPBaseImplementation::initializeMembers(){
|
||||
strcpy(detHostname,"");
|
||||
acquisitionPeriod = 0;
|
||||
acquisitionTime = 0;
|
||||
subExpTime = 0;
|
||||
numberOfFrames = 0;
|
||||
dynamicRange = 16;
|
||||
tengigaEnable = false;
|
||||
@ -192,6 +193,8 @@ uint64_t UDPBaseImplementation::getAcquisitionPeriod() const{ FILE_LOG(logDEBUG)
|
||||
|
||||
uint64_t UDPBaseImplementation::getAcquisitionTime() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return acquisitionTime;}
|
||||
|
||||
uint64_t UDPBaseImplementation::getSubExpTime() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return subExpTime;}
|
||||
|
||||
uint64_t UDPBaseImplementation::getNumberOfFrames() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return numberOfFrames;}
|
||||
|
||||
uint32_t UDPBaseImplementation::getDynamicRange() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return dynamicRange;}
|
||||
@ -415,6 +418,13 @@ int UDPBaseImplementation::setAcquisitionTime(const uint64_t i){
|
||||
return OK;
|
||||
}
|
||||
|
||||
void UDPBaseImplementation::setSubExpTime(const uint64_t i){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
subExpTime = i;
|
||||
FILE_LOG(logINFO) << "Sub Exposure Time: " << (double)subExpTime/(1E9) << "s";
|
||||
}
|
||||
|
||||
int UDPBaseImplementation::setNumberOfFrames(const uint64_t i){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
|
@ -223,66 +223,6 @@ int UDPStandardImplementation::setDataStreamEnable(const bool enable) {\
|
||||
}
|
||||
|
||||
|
||||
int UDPStandardImplementation::setAcquisitionPeriod(const uint64_t i) {
|
||||
if (acquisitionPeriod != i) {
|
||||
acquisitionPeriod = i;
|
||||
|
||||
/*//only the ones lisening to more than 1 frame at a time needs to change fifo structure
|
||||
switch (myDetectorType) {
|
||||
case GOTTHARD:
|
||||
case PROPIX:
|
||||
if (SetupFifoStructure() == FAIL)
|
||||
return FAIL;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}*/
|
||||
}
|
||||
FILE_LOG (logINFO) << "Acquisition Period: " << (double)acquisitionPeriod/(1E9) << "s";
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
int UDPStandardImplementation::setAcquisitionTime(const uint64_t i) {
|
||||
if (acquisitionTime != i) {
|
||||
acquisitionTime = i;
|
||||
|
||||
/*//only the ones lisening to more than 1 frame at a time needs to change fifo structure
|
||||
switch (myDetectorType) {
|
||||
case GOTTHARD:
|
||||
case PROPIX:
|
||||
if (SetupFifoStructure() == FAIL)
|
||||
return FAIL;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}*/
|
||||
}
|
||||
FILE_LOG (logINFO) << "Acquisition Period: " << (double)acquisitionTime/(1E9) << "s";
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
int UDPStandardImplementation::setNumberOfFrames(const uint64_t i) {
|
||||
if (numberOfFrames != i) {
|
||||
numberOfFrames = i;
|
||||
|
||||
/*//only the ones lisening to more than 1 frame at a time needs to change fifo structure
|
||||
switch (myDetectorType) {
|
||||
case GOTTHARD:
|
||||
case PROPIX:
|
||||
if (SetupFifoStructure() == FAIL)
|
||||
return FAIL;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}*/
|
||||
}
|
||||
FILE_LOG (logINFO) << "Number of Frames:" << numberOfFrames;
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
int UDPStandardImplementation::setDynamicRange(const uint32_t i) {
|
||||
if (dynamicRange != i) {
|
||||
dynamicRange = i;
|
||||
@ -645,35 +585,6 @@ void UDPStandardImplementation::SetThreadPriorities() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
/*
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it){
|
||||
if ((*it)->SetThreadPriority(PROCESSOR_PRIORITY) == FAIL) {
|
||||
FILE_LOG(logWARNING) << "No root privileges to prioritize writer threads";
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it){
|
||||
if ((*it)->SetThreadPriority(STREAMER_PRIORITY) == FAIL) {
|
||||
FILE_LOG(logWARNING) << "No root privileges to prioritize streamer threads";
|
||||
return;
|
||||
}
|
||||
}
|
||||
struct sched_param tcp_param;
|
||||
tcp_param.sched_priority = TCP_PRIORITY;
|
||||
if (pthread_setschedparam(pthread_self(),5 , &tcp_param) != EPERM) {
|
||||
FILE_LOG(logWARNING) << "No root privileges to prioritize tcp threads";
|
||||
return;
|
||||
}
|
||||
|
||||
ostringstream osfn;
|
||||
osfn << "Priorities set - "
|
||||
"TCP:"<< TCP_PRIORITY <<
|
||||
", Listener:" << LISTENER_PRIORITY <<
|
||||
", Processor:" << PROCESSOR_PRIORITY;
|
||||
if (dataStreamEnable)
|
||||
osfn << ", Streamer:" << STREAMER_PRIORITY;
|
||||
|
||||
*/
|
||||
ostringstream osfn;
|
||||
osfn << "Priorities set - "
|
||||
"Listener:" << LISTENER_PRIORITY;
|
||||
@ -683,38 +594,6 @@ void UDPStandardImplementation::SetThreadPriorities() {
|
||||
|
||||
|
||||
int UDPStandardImplementation::SetupFifoStructure() {
|
||||
//recalculate number of jobs & fifodepth, return if no change
|
||||
/* if ((myDetectorType == GOTTHARD) || (myDetectorType == PROPIX)) {
|
||||
|
||||
int oldnumberofjobs = numberofJobs;
|
||||
|
||||
//listen to only n jobs at a time
|
||||
if (frameToGuiFrequency)
|
||||
numberofJobs = frameToGuiFrequency;
|
||||
|
||||
else { NOT YET
|
||||
//random freq depends on acquisition period/time (calculate upto 100ms/period)
|
||||
int i = ((acquisitionPeriod > 0) ?
|
||||
(SAMPLE_TIME_IN_NS/acquisitionPeriod):
|
||||
((acquisitionTime > 0) ? (SAMPLE_TIME_IN_NS/acquisitionTime) : SAMPLE_TIME_IN_NS));
|
||||
//must be > 0 and < max jobs
|
||||
numberofJobs = ((i < 1) ? 1 : ((i > MAX_JOBS_PER_THREAD) ? MAX_JOBS_PER_THREAD : i));
|
||||
}
|
||||
FILE_LOG (logINFO) << "Number of Jobs Per Thread:" << numberofJobs;
|
||||
|
||||
uint32_t oldfifodepth = fifoDepth;
|
||||
//reduce fifo depth if numberofJobsPerBuffer > 1 (to save memory)
|
||||
if (numberofJobs > 1) {
|
||||
fifoDepth = ((fifoDepth % numberofJobs) ?
|
||||
((fifoDepth/numberofJobs)+1) : //if not directly divisible
|
||||
(fifoDepth/numberofJobs));
|
||||
}
|
||||
FILE_LOG (logINFO) << "Total Fifo Depth Recalculated:" << fifoDepth;
|
||||
|
||||
//no change, return
|
||||
if ((oldnumberofjobs == numberofJobs) && (oldfifodepth == fifoDepth))
|
||||
return OK;
|
||||
}else*/
|
||||
numberofJobs = 1;
|
||||
|
||||
|
||||
@ -787,7 +666,7 @@ int UDPStandardImplementation::SetupWriter() {
|
||||
bool error = false;
|
||||
for (unsigned int i = 0; i < dataProcessor.size(); ++i)
|
||||
if (dataProcessor[i]->CreateNewFile(tengigaEnable,
|
||||
numberOfFrames, acquisitionTime, acquisitionPeriod) == FAIL) {
|
||||
numberOfFrames, acquisitionTime, subExpTime, acquisitionPeriod) == FAIL) {
|
||||
error = true;
|
||||
break;
|
||||
}
|
||||
|
@ -999,6 +999,9 @@ int slsReceiverTCPIPInterface::set_timer() {
|
||||
case CYCLES_NUMBER:
|
||||
receiverBase->setNumberOfFrames(index[1]);
|
||||
break;
|
||||
case SUBFRAME_ACQUISITION_TIME:
|
||||
receiverBase->setSubExpTime(index[1]);
|
||||
break;
|
||||
default:
|
||||
ret = FAIL;
|
||||
sprintf(mess,"This timer mode (%lld) does not exist for receiver\n", (long long int)index[0]);
|
||||
@ -1018,7 +1021,15 @@ int slsReceiverTCPIPInterface::set_timer() {
|
||||
case CYCLES_NUMBER:
|
||||
retval=receiverBase->getNumberOfFrames();
|
||||
break;
|
||||
case SUBFRAME_ACQUISITION_TIME:
|
||||
retval=receiverBase->getSubExpTime();
|
||||
break;
|
||||
default:
|
||||
ret = FAIL;
|
||||
sprintf(mess,"This timer mode (%lld) does not exist for receiver\n", (long long int)index[0]);
|
||||
FILE_LOG(logERROR) << "Warning: " << mess;
|
||||
}
|
||||
|
||||
// check
|
||||
if (ret == OK && index[1] >= 0 && retval != index[1]) {
|
||||
ret = FAIL;
|
||||
@ -1028,12 +1039,7 @@ int slsReceiverTCPIPInterface::set_timer() {
|
||||
}
|
||||
#endif
|
||||
#ifdef VERYVERBOSE
|
||||
if (index[0] == ACQUISITION_TIME)
|
||||
FILE_LOG(logDEBUG1) << "acquisition time:" << retval;
|
||||
else if(index[0] == FRAME_PERIOD)
|
||||
FILE_LOG(logDEBUG1) << "acquisition period:" << retval
|
||||
else
|
||||
FILE_LOG(logDEBUG1) << "frame number:" << retval;
|
||||
FILE_LOG(logDEBUG1) << getTimerType(index[0]) << ":" << retval;
|
||||
#endif
|
||||
|
||||
if (ret == OK && mySock->differentClients)
|
||||
|
Reference in New Issue
Block a user