mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-01 18:30:05 +02:00
fifo fill level included
This commit is contained in:
parent
4aa73c607f
commit
781fea0a96
@ -13,6 +13,8 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
class Fifo;
|
||||
|
||||
class BinaryFile : private virtual slsReceiverDefs, public File, public BinaryFileStatic {
|
||||
|
||||
public:
|
||||
@ -33,11 +35,12 @@ class BinaryFile : private virtual slsReceiverDefs, public File, public BinaryFi
|
||||
* @param nf pointer to number of images in acquisition
|
||||
* @param dr pointer to dynamic range
|
||||
* @param portno pointer to udp port number for logging
|
||||
* @param fifo for logging fill level
|
||||
*/
|
||||
BinaryFile(int ind, uint32_t maxf, const uint32_t* ppf,
|
||||
int* nd, char* fname, char* fpath, uint64_t* findex,
|
||||
bool* frindexenable, bool* owenable,
|
||||
int* dindex, int* nunits, uint64_t* nf, uint32_t* dr, uint32_t* portno);
|
||||
int* dindex, int* nunits, uint64_t* nf, uint32_t* dr, uint32_t* portno, Fifo*& f);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
|
@ -61,6 +61,12 @@ class Fifo : private virtual slsReceiverDefs {
|
||||
*/
|
||||
void PopAddressToStream(char*& address);
|
||||
|
||||
/**
|
||||
* Get Maximum Level filled in Fifo Bound
|
||||
* and reset this value for next intake
|
||||
*/
|
||||
int GetMaxLevelForFifoBound();
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
@ -94,4 +100,6 @@ class Fifo : private virtual slsReceiverDefs {
|
||||
|
||||
/** Circular Fifo pointing to addresses of to be streamed data in memory */
|
||||
CircularFifo<char>* fifoStream;
|
||||
|
||||
int status_fifoBound;
|
||||
};
|
||||
|
@ -13,6 +13,8 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
class Fifo;
|
||||
|
||||
class File : private virtual slsReceiverDefs {
|
||||
|
||||
public:
|
||||
@ -33,11 +35,12 @@ class File : private virtual slsReceiverDefs {
|
||||
* @param nf pointer to number of images in acquisition
|
||||
* @param dr pointer to dynamic range
|
||||
* @param portno pointer to udp port number for logging
|
||||
* @param fifo for logging fill level
|
||||
*/
|
||||
File(int ind, uint32_t maxf, const uint32_t* ppf,
|
||||
int* nd, char* fname, char* fpath, uint64_t* findex,
|
||||
bool* frindexenable, bool* owenable,
|
||||
int* dindex, int* nunits, uint64_t* nf, uint32_t* dr, uint32_t* portno);
|
||||
int* dindex, int* nunits, uint64_t* nf, uint32_t* dr, uint32_t* portno, Fifo*& f);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
@ -91,6 +94,13 @@ class File : private virtual slsReceiverDefs {
|
||||
*/
|
||||
void SetPacketsPerFrame(const uint32_t* ppf);
|
||||
|
||||
/**
|
||||
* Set Fifo for logging fill level
|
||||
* @param f fifo reference
|
||||
*/
|
||||
void SetFifo(Fifo*& f);
|
||||
|
||||
|
||||
/**
|
||||
* Create file
|
||||
* @param fnum current frame index to include in file name
|
||||
@ -218,5 +228,8 @@ class File : private virtual slsReceiverDefs {
|
||||
/** UDP Port Number for logging */
|
||||
uint32_t* udpPortNumber;
|
||||
|
||||
/** Fifo structure for logging fill level*/
|
||||
Fifo* fifo;
|
||||
|
||||
};
|
||||
|
||||
|
@ -19,6 +19,8 @@
|
||||
#endif
|
||||
#include <string>
|
||||
|
||||
class Fifo;
|
||||
|
||||
class HDF5File : private virtual slsReceiverDefs, public File, public HDF5FileStatic {
|
||||
|
||||
public:
|
||||
@ -41,12 +43,13 @@ class HDF5File : private virtual slsReceiverDefs, public File, public HDF5FileSt
|
||||
* @param portno pointer to udp port number for logging
|
||||
* @param nx number of pixels in x direction
|
||||
* @param ny number of pixels in y direction
|
||||
* @param fifo for logging fill level
|
||||
*/
|
||||
HDF5File(int ind, uint32_t maxf, const uint32_t* ppf,
|
||||
int* nd, char* fname, char* fpath, uint64_t* findex,
|
||||
bool* frindexenable, bool* owenable,
|
||||
int* dindex, int* nunits, uint64_t* nf, uint32_t* dr, uint32_t* portno,
|
||||
uint32_t nx, uint32_t ny);
|
||||
uint32_t nx, uint32_t ny, Fifo*& f);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "BinaryFile.h"
|
||||
#include "receiver_defs.h"
|
||||
#include "Fifo.h"
|
||||
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
@ -16,9 +17,9 @@ FILE* BinaryFile::masterfd = 0;
|
||||
BinaryFile::BinaryFile(int ind, uint32_t maxf, const uint32_t* ppf,
|
||||
int* nd, char* fname, char* fpath, uint64_t* findex,
|
||||
bool* frindexenable, bool* owenable,
|
||||
int* dindex, int* nunits, uint64_t* nf, uint32_t* dr, uint32_t* portno):
|
||||
int* dindex, int* nunits, uint64_t* nf, uint32_t* dr, uint32_t* portno, Fifo*& f):
|
||||
|
||||
File(ind, maxf, ppf, nd, fname, fpath, findex, frindexenable, owenable, dindex, nunits, nf, dr, portno),
|
||||
File(ind, maxf, ppf, nd, fname, fpath, findex, frindexenable, owenable, dindex, nunits, nf, dr, portno, f),
|
||||
filefd(0),
|
||||
numFramesInFile(0),
|
||||
numActualPacketsInFile(0)
|
||||
@ -64,9 +65,11 @@ int BinaryFile::CreateFile(uint64_t fnum) {
|
||||
//other files
|
||||
else {
|
||||
if (loss)
|
||||
cprintf(RED,"[%u]: Packet_Loss:%lu \tNew_File:%s\n", *udpPortNumber,loss, basename(currentFileName.c_str()));
|
||||
cprintf(RED,"[%u]: Packet_Loss:%lu Fifo_Max_Level:%d \tNew_File:%s\n",
|
||||
*udpPortNumber,loss, fifo->GetMaxLevelForFifoBound() , basename(currentFileName.c_str()));
|
||||
else
|
||||
cprintf(GREEN,"[%u]: Packet_Loss:%lu \tNew_File:%s\n", *udpPortNumber,loss, basename(currentFileName.c_str()));
|
||||
cprintf(GREEN,"[%u]: Packet_Loss:%lu Fifo_Max_Level:%d \tNew_File:%s\n",
|
||||
*udpPortNumber,loss, fifo->GetMaxLevelForFifoBound(), basename(currentFileName.c_str()));
|
||||
}
|
||||
|
||||
return OK;
|
||||
|
@ -136,6 +136,8 @@ void DataProcessor::StopRunning() {
|
||||
|
||||
void DataProcessor::SetFifo(Fifo*& f) {
|
||||
fifo = f;
|
||||
if (file)
|
||||
file->SetFifo(f);
|
||||
}
|
||||
|
||||
void DataProcessor::ResetParametersforNewAcquisition() {
|
||||
@ -228,14 +230,14 @@ void DataProcessor::SetupFileWriter(int* nd, char* fname, char* fpath, uint64_t*
|
||||
nd, fname, fpath, findex,
|
||||
frindexenable, owenable,
|
||||
dindex, nunits, nf, dr, portno
|
||||
generalData->nPixelsX, generalData->nPixelsY);
|
||||
generalData->nPixelsX, generalData->nPixelsY, fifo);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
file = new BinaryFile(index, generalData->maxFramesPerFile, &generalData->packetsPerFrame,
|
||||
nd, fname, fpath, findex,
|
||||
frindexenable, owenable,
|
||||
dindex, nunits, nf, dr, portno);
|
||||
dindex, nunits, nf, dr, portno, fifo);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,8 @@ Fifo::Fifo(uint32_t fifoItemSize, uint32_t fifoDepth, bool &success):
|
||||
memory(0),
|
||||
fifoBound(0),
|
||||
fifoFree(0),
|
||||
fifoStream(0){
|
||||
fifoStream(0),
|
||||
status_fifoBound(0){
|
||||
FILE_LOG (logDEBUG) << __AT__ << " called";
|
||||
index = NumberofFifoClassObjects++;
|
||||
if(CreateFifos(fifoItemSize, fifoDepth) == FAIL)
|
||||
@ -100,6 +101,9 @@ void Fifo::GetNewAddress(char*& address) {
|
||||
|
||||
void Fifo::PushAddress(char*& address) {
|
||||
while(!fifoBound->push(address));
|
||||
int temp = fifoBound->getSemValue();
|
||||
if (temp > status_fifoBound)
|
||||
status_fifoBound = temp;
|
||||
}
|
||||
|
||||
void Fifo::PopAddress(char*& address) {
|
||||
@ -114,3 +118,9 @@ void Fifo::PopAddressToStream(char*& address) {
|
||||
fifoStream->pop(address);
|
||||
}
|
||||
|
||||
int Fifo::GetMaxLevelForFifoBound() {
|
||||
int temp = status_fifoBound;
|
||||
status_fifoBound = 0;
|
||||
return temp;
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
***********************************************/
|
||||
|
||||
#include "File.h"
|
||||
#include "Fifo.h"
|
||||
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
@ -13,7 +14,7 @@ using namespace std;
|
||||
File::File(int ind, uint32_t maxf, const uint32_t* ppf,
|
||||
int* nd, char* fname, char* fpath, uint64_t* findex,
|
||||
bool* frindexenable, bool* owenable,
|
||||
int* dindex, int* nunits, uint64_t* nf, uint32_t* dr, uint32_t* portno):
|
||||
int* dindex, int* nunits, uint64_t* nf, uint32_t* dr, uint32_t* portno, Fifo*& f):
|
||||
index(ind),
|
||||
maxFramesPerFile(maxf),
|
||||
packetsPerFrame(ppf),
|
||||
@ -107,3 +108,7 @@ void File::SetMaxFramesPerFile(uint32_t maxf) {
|
||||
void File::SetPacketsPerFrame(const uint32_t* ppf) {
|
||||
packetsPerFrame = ppf;
|
||||
}
|
||||
|
||||
void File::SetFifo(Fifo*& f) {
|
||||
fifo = f;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
***********************************************/
|
||||
#include "HDF5File.h"
|
||||
#include "receiver_defs.h"
|
||||
#include "Fifo.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
@ -22,9 +23,9 @@ HDF5File::HDF5File(int ind, uint32_t maxf, const uint32_t* ppf,
|
||||
int* nd, char* fname, char* fpath, uint64_t* findex,
|
||||
bool* frindexenable, bool* owenable,
|
||||
int* dindex, int* nunits, uint64_t* nf, uint32_t* dr, uint32_t* portno,
|
||||
uint32_t nx, uint32_t ny):
|
||||
uint32_t nx, uint32_t ny, Fifo*& f):
|
||||
|
||||
File(ind, maxf, ppf, nd, fname, fpath, findex, frindexenable, owenable, dindex, nunits, nf, dr, portno),
|
||||
File(ind, maxf, ppf, nd, fname, fpath, findex, frindexenable, owenable, dindex, nunits, nf, dr, portno, f),
|
||||
filefd(0),
|
||||
dataspace(0),
|
||||
dataset(0),
|
||||
@ -119,11 +120,14 @@ int HDF5File::CreateFile(uint64_t fnum) {
|
||||
//other files
|
||||
else {
|
||||
if (loss)
|
||||
cprintf(RED,"[%u]: Packet_Loss:%lu \tNew_File:%s\n", *udpPortNumber,loss, basename(currentFileName.c_str()));
|
||||
cprintf(RED,"[%u]: Packet_Loss:%lu Fifo_Max_Level:%d \tNew_File:%s\n",
|
||||
*udpPortNumber,loss, fifo->GetMaxLevelForFifoBound() , basename(currentFileName.c_str()));
|
||||
else
|
||||
cprintf(GREEN,"[%u]: Packet_Loss:%lu \tNew_File:%s\n", *udpPortNumber,loss, basename(currentFileName.c_str()));
|
||||
cprintf(GREEN,"[%u]: Packet_Loss:%lu Fifo_Max_Level:%d \tNew_File:%s\n",
|
||||
*udpPortNumber,loss, fifo->GetMaxLevelForFifoBound(), basename(currentFileName.c_str()));
|
||||
}
|
||||
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@ -743,7 +743,7 @@ int UDPStandardImplementation::SetupFifoStructure() {
|
||||
if(dataStreamer.size())dataStreamer[i]->SetFifo(fifo[i]);
|
||||
}
|
||||
|
||||
FILE_LOG (logINFO) << "Fifo structure(s) reconstructed";
|
||||
FILE_LOG (logINFO) << "Fifo structure(s) reconstructed with Fifo Depth: " << fifoDepth;
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user