mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-22 03:40:04 +02:00
made the eiger like the jungfrau ignoring packets
This commit is contained in:
parent
55408118b1
commit
af8c750b5a
@ -416,6 +416,24 @@ private:
|
|||||||
*/
|
*/
|
||||||
int prepareAndListenBuffer(int ithread, int cSize, char* temp);
|
int prepareAndListenBuffer(int ithread, int cSize, char* temp);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called by startListening
|
||||||
|
* Creates the packets
|
||||||
|
* @param ithread listening thread index
|
||||||
|
* @return the number of bytes actually received
|
||||||
|
*/
|
||||||
|
int prepareAndListenBufferDeactivated(int ithread);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called by startListening
|
||||||
|
* Listens to each packet and copies only complete frames
|
||||||
|
* until all receiver or shutdownUDPsocket called by client
|
||||||
|
* @param ithread listening thread index
|
||||||
|
* @return the number of bytes copied to buffer
|
||||||
|
*/
|
||||||
|
int prepareAndListenBufferCompleteFrames(int ithread);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called by startListening
|
* Called by startListening
|
||||||
* Its called for the first packet of a scan or acquistion
|
* Its called for the first packet of a scan or acquistion
|
||||||
@ -478,14 +496,13 @@ private:
|
|||||||
void handleWithoutDataCompression(int ithread, char* wbuffer,uint32_t npackets);
|
void handleWithoutDataCompression(int ithread, char* wbuffer,uint32_t npackets);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called by processWritingBuffer for jungfrau
|
* Called by startWriting for jungfrau and eiger
|
||||||
* writes to dummy file, doesnt need to read packet numbers
|
* writes complete frames to file
|
||||||
* Copies data for gui display and frees addresses popped from FIFOs
|
* Copies data for gui display and frees addresses popped from FIFOs
|
||||||
* @param ithread writing thread index
|
* @param ithread writing thread index
|
||||||
* @param wbuffer writing buffer popped out from FIFO
|
* @param wbuffer writing buffer popped out from FIFO
|
||||||
* @param npackets number of packets
|
|
||||||
*/
|
*/
|
||||||
void handleWithoutMissingPackets(int ithread, char* wbuffer,uint32_t npackets);
|
void handleCompleteFramesOnly(int ithread, char* wbuffer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calle by handleWithoutDataCompression
|
* Calle by handleWithoutDataCompression
|
||||||
@ -540,9 +557,10 @@ private:
|
|||||||
* @param framenumber reference to the frame number
|
* @param framenumber reference to the frame number
|
||||||
* @param packetnumber reference to the packet number
|
* @param packetnumber reference to the packet number
|
||||||
* @param subframenumber reference to the subframe number
|
* @param subframenumber reference to the subframe number
|
||||||
|
* @oaram bunchid reference to the bunch id
|
||||||
* @return OK or FAIL
|
* @return OK or FAIL
|
||||||
*/
|
*/
|
||||||
int getFrameandPacketNumber(int ithread, char* wbuffer, uint64_t &framenumber, uint32_t &packetnumber, uint32_t &subframenumber);
|
int getFrameandPacketNumber(int ithread, char* wbuffer, uint64_t &framenumber, uint32_t &packetnumber, uint32_t &subframenumber, uint64_t &bunchid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find offset upto this frame number and write it to file
|
* Find offset upto this frame number and write it to file
|
||||||
@ -593,6 +611,9 @@ private:
|
|||||||
/** Footer offset from start of Packet*/
|
/** Footer offset from start of Packet*/
|
||||||
int footerOffset;
|
int footerOffset;
|
||||||
|
|
||||||
|
/** variable to exclude missing packet */
|
||||||
|
bool excludeMissingPackets;
|
||||||
|
|
||||||
|
|
||||||
//***File parameters***
|
//***File parameters***
|
||||||
#ifdef MYROOT1
|
#ifdef MYROOT1
|
||||||
@ -611,15 +632,17 @@ private:
|
|||||||
|
|
||||||
/** Maximum Frames Per File **/
|
/** Maximum Frames Per File **/
|
||||||
uint64_t maxFramesPerFile;
|
uint64_t maxFramesPerFile;
|
||||||
|
const static int progressFrequency = 10;
|
||||||
|
|
||||||
/** If file created successfully for all Writer Threads */
|
/** If file created successfully for all Writer Threads */
|
||||||
bool fileCreateSuccess;
|
bool fileCreateSuccess;
|
||||||
|
|
||||||
|
/** File header */
|
||||||
const static unsigned int FILE_HEADER_SIZE = 500;
|
const static unsigned int FILE_HEADER_SIZE = 500;
|
||||||
|
|
||||||
char fileHeader[MAX_NUMBER_OF_WRITER_THREADS][FILE_HEADER_SIZE];
|
char fileHeader[MAX_NUMBER_OF_WRITER_THREADS][FILE_HEADER_SIZE];
|
||||||
|
|
||||||
|
/** File Descriptor */
|
||||||
|
FILE *sfilefd[MAX_NUMBER_OF_WRITER_THREADS];
|
||||||
|
|
||||||
|
|
||||||
//***acquisition indices/count parameters***
|
//***acquisition indices/count parameters***
|
||||||
@ -640,9 +663,19 @@ private:
|
|||||||
|
|
||||||
/** Previous Frame number from last check to calculate loss */
|
/** Previous Frame number from last check to calculate loss */
|
||||||
int64_t frameNumberInPreviousCheck[MAX_NUMBER_OF_WRITER_THREADS];
|
int64_t frameNumberInPreviousCheck[MAX_NUMBER_OF_WRITER_THREADS];
|
||||||
|
|
||||||
/** total packet count from last check */
|
/** total packet count from last check */
|
||||||
int64_t totalWritingPacketCountFromLastCheck[MAX_NUMBER_OF_WRITER_THREADS];
|
int64_t totalWritingPacketCountFromLastCheck[MAX_NUMBER_OF_WRITER_THREADS];
|
||||||
|
|
||||||
|
/** Pckets currently in current file, starts new file when it reaches max */
|
||||||
|
int64_t lastFrameNumberInFile[MAX_NUMBER_OF_WRITER_THREADS];
|
||||||
|
|
||||||
|
/** packets in current file */
|
||||||
|
uint64_t totalPacketsInFile[MAX_NUMBER_OF_WRITER_THREADS];
|
||||||
|
|
||||||
|
/**Total packet count written by each writing thread */
|
||||||
|
uint64_t totalWritingPacketCount[MAX_NUMBER_OF_LISTENING_THREADS];
|
||||||
|
|
||||||
|
|
||||||
/* Acquisition started */
|
/* Acquisition started */
|
||||||
bool acqStarted;
|
bool acqStarted;
|
||||||
@ -656,14 +689,7 @@ private:
|
|||||||
/** Total packet Count ignored by listening threads */
|
/** Total packet Count ignored by listening threads */
|
||||||
int totalIgnoredPacketCount[MAX_NUMBER_OF_LISTENING_THREADS];
|
int totalIgnoredPacketCount[MAX_NUMBER_OF_LISTENING_THREADS];
|
||||||
|
|
||||||
/** Pckets currently in current file, starts new file when it reaches max */
|
|
||||||
int64_t lastFrameNumberInFile[MAX_NUMBER_OF_WRITER_THREADS];
|
|
||||||
|
|
||||||
/** packets in current file */
|
|
||||||
uint64_t totalPacketsInFile[MAX_NUMBER_OF_WRITER_THREADS];
|
|
||||||
|
|
||||||
/**Total packet count written by each writing thread */
|
|
||||||
uint64_t totalWritingPacketCount[MAX_NUMBER_OF_LISTENING_THREADS];
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -684,9 +710,6 @@ private:
|
|||||||
/** UDP Sockets - Detector to Receiver */
|
/** UDP Sockets - Detector to Receiver */
|
||||||
genericSocket* udpSocket[MAX_NUMBER_OF_LISTENING_THREADS];
|
genericSocket* udpSocket[MAX_NUMBER_OF_LISTENING_THREADS];
|
||||||
|
|
||||||
/** File Descriptor */
|
|
||||||
FILE *sfilefd[MAX_NUMBER_OF_WRITER_THREADS];
|
|
||||||
|
|
||||||
/** Number of Jobs Per Buffer */
|
/** Number of Jobs Per Buffer */
|
||||||
int numberofJobsPerBuffer;
|
int numberofJobsPerBuffer;
|
||||||
|
|
||||||
@ -696,9 +719,6 @@ private:
|
|||||||
/** fifo buffer header size */
|
/** fifo buffer header size */
|
||||||
uint32_t fifoBufferHeaderSize;
|
uint32_t fifoBufferHeaderSize;
|
||||||
|
|
||||||
/** Missing Packet */
|
|
||||||
int missingPacketinFile;
|
|
||||||
|
|
||||||
/** Dummy Packet identifier value */
|
/** Dummy Packet identifier value */
|
||||||
const static uint32_t dummyPacketValue = 0xFFFFFFFF;
|
const static uint32_t dummyPacketValue = 0xFFFFFFFF;
|
||||||
|
|
||||||
@ -790,16 +810,6 @@ private:
|
|||||||
bool killAllWritingThreads;
|
bool killAllWritingThreads;
|
||||||
|
|
||||||
|
|
||||||
//***deactivated parameters***
|
|
||||||
uint64_t deactivated_framenumber[MAX_NUMBER_OF_LISTENING_THREADS];
|
|
||||||
uint32_t deactivated_packetnumber[MAX_NUMBER_OF_LISTENING_THREADS];
|
|
||||||
|
|
||||||
//***deactivated parameters***
|
|
||||||
uint64_t deactivatedFrameNumber[MAX_NUMBER_OF_LISTENING_THREADS];
|
|
||||||
int deactivatedFrameIncrement;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//***filter parameters***
|
//***filter parameters***
|
||||||
/** Common Mode Subtraction Enable FIXME: Always false, only moench uses, Ask Anna */
|
/** Common Mode Subtraction Enable FIXME: Always false, only moench uses, Ask Anna */
|
||||||
bool commonModeSubtractionEnable;
|
bool commonModeSubtractionEnable;
|
||||||
|
@ -632,7 +632,13 @@ enum communicationProtocol{
|
|||||||
else{
|
else{
|
||||||
//normal
|
//normal
|
||||||
nsending=packet_size;
|
nsending=packet_size;
|
||||||
nsent = recvfrom(socketDescriptor,(char*)buf+total_sent,nsending, 0, (struct sockaddr *) &clientAddress, &clientAddress_length);
|
while(1){
|
||||||
|
nsent = recvfrom(socketDescriptor,(char*)buf+total_sent,nsending, 0, (struct sockaddr *) &clientAddress, &clientAddress_length);
|
||||||
|
if(nsent<=0 || nsent == packet_size)
|
||||||
|
break;
|
||||||
|
if(nsent != packet_size && nsent != header_packet_size)
|
||||||
|
cprintf(RED,"Incomplete Packet size %d\n",nsent);
|
||||||
|
}
|
||||||
//nsent = 1040;
|
//nsent = 1040;
|
||||||
total_sent+=nsent;
|
total_sent+=nsent;
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,10 @@ typedef struct {
|
|||||||
#define HEADER_SIZE_NUM_TOT_PACKETS 4
|
#define HEADER_SIZE_NUM_TOT_PACKETS 4
|
||||||
#define HEADER_SIZE_NUM_FRAMES 2
|
#define HEADER_SIZE_NUM_FRAMES 2
|
||||||
#define HEADER_SIZE_NUM_PACKETS 1
|
#define HEADER_SIZE_NUM_PACKETS 1
|
||||||
|
#define ALL_MASK_32 0xFFFFFFFF
|
||||||
|
|
||||||
|
#define FILE_FRAME_HEADER_LENGTH 16
|
||||||
|
#define FILE_HEADER_BUNCHID_OFFSET 8
|
||||||
|
|
||||||
|
|
||||||
//all max frames defined in sls_receiver_defs.h. 20000 gotthard, 100000 for short gotthard, 1000 for moench, eiger 20000
|
//all max frames defined in sls_receiver_defs.h. 20000 gotthard, 100000 for short gotthard, 1000 for moench, eiger 20000
|
||||||
@ -129,8 +133,6 @@ typedef struct {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define JFRAU_FILE_FRAME_HEADER_LENGTH 16
|
|
||||||
#define JFRAU_FILE_HEADER_BUNCHID_OFFSET 8
|
|
||||||
#define JFRAU_FIFO_SIZE 2500 //cannot be less than max jobs per thread = 1000
|
#define JFRAU_FIFO_SIZE 2500 //cannot be less than max jobs per thread = 1000
|
||||||
#define JFRAU_PACKETS_PER_FRAME 128
|
#define JFRAU_PACKETS_PER_FRAME 128
|
||||||
#define JFRAU_HEADER_LENGTH 22
|
#define JFRAU_HEADER_LENGTH 22
|
||||||
@ -172,7 +174,6 @@ typedef struct {
|
|||||||
#define EIGER_MAX_PORTS 2
|
#define EIGER_MAX_PORTS 2
|
||||||
#define EIGER_HEADER_PACKET_LENGTH 48
|
#define EIGER_HEADER_PACKET_LENGTH 48
|
||||||
|
|
||||||
|
|
||||||
#define EIGER_FIFO_SIZE 100
|
#define EIGER_FIFO_SIZE 100
|
||||||
/*#define EIGER_ALIGNED_FRAME_SIZE 65536*/
|
/*#define EIGER_ALIGNED_FRAME_SIZE 65536*/
|
||||||
#define EIGER_ONE_GIGA_CONSTANT 16
|
#define EIGER_ONE_GIGA_CONSTANT 16
|
||||||
|
@ -332,7 +332,7 @@ private:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** Socket */
|
/** Socket */
|
||||||
MySocketTCP* socket;
|
MySocketTCP* mySock;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ char *UDPBaseImplementation::getDetectorHostname() const{
|
|||||||
if(!strlen(detHostname))
|
if(!strlen(detHostname))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
char* output = new char[MAX_STR_LENGTH];
|
char* output = new char[MAX_STR_LENGTH]();
|
||||||
strcpy(output,detHostname);
|
strcpy(output,detHostname);
|
||||||
//freed by calling function
|
//freed by calling function
|
||||||
return output;
|
return output;
|
||||||
@ -113,7 +113,7 @@ char *UDPBaseImplementation::getFileName() const{
|
|||||||
if(!strlen(fileName))
|
if(!strlen(fileName))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
char* output = new char[MAX_STR_LENGTH];
|
char* output = new char[MAX_STR_LENGTH]();
|
||||||
strcpy(output,fileName);
|
strcpy(output,fileName);
|
||||||
//freed by calling function
|
//freed by calling function
|
||||||
return output;
|
return output;
|
||||||
@ -126,7 +126,7 @@ char *UDPBaseImplementation::getFilePath() const{
|
|||||||
if(!strlen(filePath))
|
if(!strlen(filePath))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
char* output = new char[MAX_STR_LENGTH];
|
char* output = new char[MAX_STR_LENGTH]();
|
||||||
strcpy(output,filePath);
|
strcpy(output,filePath);
|
||||||
//freed by calling function
|
//freed by calling function
|
||||||
return output;
|
return output;
|
||||||
@ -166,7 +166,7 @@ uint32_t UDPBaseImplementation::getUDPPortNumber2() const{ FILE_LOG(logDEBUG) <<
|
|||||||
char *UDPBaseImplementation::getEthernetInterface() const{
|
char *UDPBaseImplementation::getEthernetInterface() const{
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
char* output = new char[MAX_STR_LENGTH];
|
char* output = new char[MAX_STR_LENGTH]();
|
||||||
strcpy(output,eth);
|
strcpy(output,eth);
|
||||||
//freed by calling function
|
//freed by calling function
|
||||||
return output;
|
return output;
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user