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