This commit is contained in:
Dhanya Maliakal 2016-08-30 16:10:46 +02:00
parent e9b7a11cf6
commit be2bc15ab5
6 changed files with 505 additions and 841 deletions

View File

@ -513,7 +513,7 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
//***acquisition count parameters*** //***acquisition count parameters***
/** Total packets caught for an entire acquisition (including all scans) */ /** Total packets caught for an entire acquisition (including all scans) */
uint64_t totalPacketsCaught; uint64_t totalPacketsCaught;
/** Frames Caught for each real time acquisition (eg. for each scan) */ /** Packets Caught for each real time acquisition (eg. for each scan) */
uint64_t packetsCaught; uint64_t packetsCaught;
//***acquisition indices parameters*** //***acquisition indices parameters***

View File

@ -78,6 +78,19 @@ class UDPStandardImplementation: private virtual slsReceiverDefs, public UDPBase
*/ */
int setDataCompressionEnable(const bool b); int setDataCompressionEnable(const bool b);
//***acquisition count parameters***
/**
* Get Total Frames Caught for an entire acquisition (including all scans)
* @return total number of frames caught for entire acquisition
*/
uint64_t getTotalFramesCaught() const;
/**
* Get Frames Caught for each real time acquisition (eg. for each scan)
* @return number of frames caught for each scan
*/
uint64_t getFramesCaught() const;
//***acquisition parameters*** //***acquisition parameters***
/** /**
* Overridden method * Overridden method
@ -394,18 +407,6 @@ private:
*/ */
void startWriting(); void startWriting();
/**
* Called by processWritingBuffer and processWritingBufferPacketByPacket
* Pops buffer from all the FIFOs and checks for dummy frames and end of acquisition
* @param ithread current thread index
* @param wbuffer the buffer array that is popped from all the FIFOs
* @param ready if that FIFO is allowed to pop (depends on if dummy buffer already popped/ waiting for other FIFO to finish a frame(eiger))
* @param nP number of packets in the buffer popped out
* @param fifoTempFree circular fifo to save addresses of packets adding upto a frame before pushing into fifofree (eiger specific)
* @return true if end of acquisition else false
*/
bool popAndCheckEndofAcquisition(int ithread, char* wbuffer[], bool ready[], uint32_t nP[],CircularFifo<char>* fifoTempFree[]);
/** /**
* Called by processWritingBuffer and processWritingBufferPacketByPacket * Called by processWritingBuffer and processWritingBufferPacketByPacket
* When dummy-end buffers are popped from all FIFOs (acquisition over), this is called * When dummy-end buffers are popped from all FIFOs (acquisition over), this is called
@ -434,14 +435,14 @@ private:
* @param wbuffer is the address of buffer popped out of FIFO * @param wbuffer is the address of buffer popped out of FIFO
* @param numpackets is the number of packets * @param numpackets is the number of packets
*/ */
void writeFileWithoutCompression(int ithread, char* wbuffer[],uint32_t numpackets); void writeFileWithoutCompression(int ithread, char* wbuffer,uint32_t numpackets);
/** /**
* Called by writeToFileWithoutCompression * Called by writeToFileWithoutCompression
* Create headers for file writing (at the moment, this is eiger specific) * Create headers for file writing (at the moment, this is eiger specific)
* @param wbuffer writing buffer popped from FIFOs * @param wbuffer writing buffer popped from FIFOs
*/ */
void createHeaders(char* wbuffer[]); void createHeaders(char* wbuffer);
/** /**
* Updates the file header char aray, each time the corresp parameter is changed * Updates the file header char aray, each time the corresp parameter is changed
@ -456,11 +457,7 @@ private:
* @param ithread writer thread index * @param ithread writer thread index
* @param buffer buffer to copy * @param buffer buffer to copy
*/ */
void copyFrameToGui(int ithread, char* buffer[]); void copyFrameToGui(int ithread, char* buffer);
void processWritingBuffer(int ithread);
void processWritingBufferPacketByPacket(int ithread);
void waitWritingBufferForNextAcquisition(int ithread); void waitWritingBufferForNextAcquisition(int ithread);
@ -473,10 +470,28 @@ private:
* @param wbuffer writer buffer * @param wbuffer writer buffer
* @param nf number of frames * @param nf number of frames
*/ */
void handleDataCompression(int ithread, char* wbuffer[], uint64_t &nf); void handleDataCompression(int ithread, char* wbuffer, uint64_t &nf);
/**
* Get Frame Number
* @param ithread writer thread index
* @param wbuffer writer buffer
* @param tempframenumber reference to the frame number
* @return OK or FAIL
*/
int getFrameNumber(int ithread, char* wbuffer, uint64_t &tempframenumber);
/**
* Find offset upto this frame number and write it to file
* @param ithread writer thread index
* @param wbuffer writer buffer
* @param offset reference of offset to look from and replaces offset to starting of nextframenumber
* @param nextFrameNumber frame number up to which data written
* @param numpackets number of packets in buffer
* @param numPacketsWritten number of packets written to file
*/
int writeUptoFrameNumber(int ithread, char* wbuffer, int &offset, uint64_t nextFrameNumber, uint32_t numpackets, int &numPacketsWritten);
/************************************************************************* /*************************************************************************
* Class Members ********************************************************* * Class Members *********************************************************
@ -526,8 +541,11 @@ private:
/** Complete File name */ /** Complete File name */
char completeFileName[MAX_NUMBER_OF_WRITER_THREADS][MAX_STR_LENGTH]; char completeFileName[MAX_NUMBER_OF_WRITER_THREADS][MAX_STR_LENGTH];
/** File Name without frame index, file index and extension (_d0_f000000000000_8.raw)*/
char fileNamePerThread[MAX_NUMBER_OF_WRITER_THREADS][MAX_STR_LENGTH];
/** Maximum Frames Per File **/ /** Maximum Frames Per File **/
int maxFramesPerFile; uint64_t maxFramesPerFile;
/** If file created successfully for all Writer Threads */ /** If file created successfully for all Writer Threads */
bool fileCreateSuccess; bool fileCreateSuccess;
@ -550,12 +568,12 @@ private:
/** Current Frame Number */ /** Current Frame Number */
uint64_t currentFrameNumber[MAX_NUMBER_OF_WRITER_THREADS]; uint64_t currentFrameNumber[MAX_NUMBER_OF_WRITER_THREADS];
/** Previous Frame number from buffer to calculate loss */ /** Previous Frame number from buffer to calculate loss */
int64_t previousFrameNumber[MAX_NUMBER_OF_WRITER_THREADS]; int64_t frameNumberInPreviousFile[MAX_NUMBER_OF_WRITER_THREADS];
/** Last Frame Index Listened To */ /** Last Frame Index Listened To */
int32_t lastFrameIndex[MAX_NUMBER_OF_WRITER_THREADS]; int64_t lastFrameIndex[MAX_NUMBER_OF_WRITER_THREADS];
/* Acquisition started */ /* Acquisition started */
@ -564,25 +582,14 @@ private:
/* Measurement started - for each thread to get progress print outs*/ /* Measurement started - for each thread to get progress print outs*/
bool measurementStarted[MAX_NUMBER_OF_LISTENING_THREADS]; bool measurementStarted[MAX_NUMBER_OF_LISTENING_THREADS];
/** Total Frame Count listened to by listening threads */ /** Total packet Count listened to by listening threads */
int totalListeningFrameCount[MAX_NUMBER_OF_LISTENING_THREADS]; int totalListeningPacketCount[MAX_NUMBER_OF_LISTENING_THREADS];
/** Pckets currently in current file, starts new file when it reaches max */ /** Pckets currently in current file, starts new file when it reaches max */
uint32_t packetsInFile[MAX_NUMBER_OF_WRITER_THREADS]; uint64_t lastFrameNumberInFile[MAX_NUMBER_OF_WRITER_THREADS];
/** Number of Missing Packets per buffer*/
uint32_t numMissingPackets[MAX_NUMBER_OF_WRITER_THREADS];
/** Total Number of Missing Packets in acquisition*/
uint32_t numTotMissingPackets;
/** Number of Missing Packets in file */
uint32_t numTotMissingPacketsInFile[MAX_NUMBER_OF_WRITER_THREADS];
/** packets caught per thread */
uint64_t packetsCaughtPerThread[MAX_NUMBER_OF_WRITER_THREADS];
/** packets in current file */
uint64_t totalPacketsInFile[MAX_NUMBER_OF_WRITER_THREADS];
@ -721,8 +728,6 @@ private:
/** Progress (currentFrameNumber) Mutex */ /** Progress (currentFrameNumber) Mutex */
pthread_mutex_t progressMutex; pthread_mutex_t progressMutex;
/** Progress (currentFrameNumber) Mutex */
pthread_mutex_t udpSocketMutex[MAX_NUMBER_OF_LISTENING_THREADS];
//***callback*** //***callback***
/** The action which decides what the user and default responsibilities to save data are /** The action which decides what the user and default responsibilities to save data are

View File

@ -613,25 +613,13 @@ enum communicationProtocol{
while(length>0){ while(length>0){
nsending = (length>packet_size) ? packet_size:length; nsending = (length>packet_size) ? packet_size:length;
/*
//created for debugging on 11.05.2015
nsending=5000;
nsent = recvfrom(socketDescriptor,(char*)buf,nsending, 0, (struct sockaddr *) &clientAddress, &clientAddress_length);
if(nsent <1000){
if(nsent < 48){
cout << " "<<dec<<nsent<<" ";
}else{
cout << "nsent: " << dec<<nsent << "\tfnum:" <<
htonl(*(unsigned int*)((eiger_image_header32 *)((char*)(buf)))->fnum)<< "\t";
cout << k <<" packets" << endl;
k = 0;
}
}
else
k++;
*/
nsent = recvfrom(socketDescriptor,(char*)buf+total_sent,nsending, 0, (struct sockaddr *) &clientAddress, &clientAddress_length); nsent = recvfrom(socketDescriptor,(char*)buf+total_sent,nsending, 0, (struct sockaddr *) &clientAddress, &clientAddress_length);
if(!nsent) break; if(nsent < packet_size) {
if(nsent){
cout << "Incomplete Packet size " << nsent << endl;
}
break;
}
length-=nsent; length-=nsent;
total_sent+=nsent; total_sent+=nsent;
} }

View File

@ -139,7 +139,7 @@ typedef struct {
#define JFRAU_BUFFER_SIZE (JFRAU_ONE_PACKET_SIZE*JFRAU_PACKETS_PER_FRAME) //8214*128 #define JFRAU_BUFFER_SIZE (JFRAU_ONE_PACKET_SIZE*JFRAU_PACKETS_PER_FRAME) //8214*128
#define JFRAU_FRAME_INDEX_MASK 0x0 //Not Applicable, use struct #define JFRAU_FRAME_INDEX_MASK 0xffffff //mask after using struct (48 bit)
#define JFRAU_FRAME_INDEX_OFFSET 0x0 //Not Applicable, use struct #define JFRAU_FRAME_INDEX_OFFSET 0x0 //Not Applicable, use struct
#define JFRAU_PACKET_INDEX_MASK 0x0//Not Applicable, use struct #define JFRAU_PACKET_INDEX_MASK 0x0//Not Applicable, use struct

File diff suppressed because it is too large Load Diff

View File

@ -930,6 +930,7 @@ int slsReceiverTCPIPInterface::get_frames_caught(){
strcpy(mess,SET_RECEIVER_ERR_MESSAGE); strcpy(mess,SET_RECEIVER_ERR_MESSAGE);
ret=FAIL; ret=FAIL;
}else retval=receiverBase->getTotalFramesCaught(); }else retval=receiverBase->getTotalFramesCaught();
cout<<"frames caught sent:"<<retval<<endl;
#endif #endif
if(ret==OK && socket->differentClients){ if(ret==OK && socket->differentClients){
FILE_LOG(logDEBUG) << "Force update"; FILE_LOG(logDEBUG) << "Force update";
@ -2487,9 +2488,9 @@ int slsReceiverTCPIPInterface::set_dynamic_range() {
dynamicrange = retval; dynamicrange = retval;
if(myDetectorType == EIGER){ if(myDetectorType == EIGER){
if(!tenGigaEnable) if(!tenGigaEnable)
packetsPerFrame = EIGER_ONE_GIGA_CONSTANT * dynamicrange * EIGER_MAX_PORTS; packetsPerFrame = EIGER_ONE_GIGA_CONSTANT * dynamicrange;
else else
packetsPerFrame = EIGER_TEN_GIGA_CONSTANT * dynamicrange * EIGER_MAX_PORTS; packetsPerFrame = EIGER_TEN_GIGA_CONSTANT * dynamicrange;
}else if (myDetectorType == JUNGFRAU) }else if (myDetectorType == JUNGFRAU)
packetsPerFrame = JFRAU_PACKETS_PER_FRAME; packetsPerFrame = JFRAU_PACKETS_PER_FRAME;
} }