mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-21 00:58:01 +02:00
fifo fill level included
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user