From cc5862533ebc9d2b3ba4e169a8ebf8ec971382d5 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Fri, 18 Aug 2017 17:57:31 +0200 Subject: [PATCH] changes for the statistic moved to listener --- slsReceiverSoftware/include/BinaryFile.h | 4 +--- slsReceiverSoftware/include/File.h | 14 +---------- slsReceiverSoftware/include/HDF5File.h | 4 +--- slsReceiverSoftware/src/BinaryFile.cpp | 29 +++-------------------- slsReceiverSoftware/src/DataProcessor.cpp | 6 ++--- slsReceiverSoftware/src/File.cpp | 10 ++------ slsReceiverSoftware/src/HDF5File.cpp | 25 +++---------------- 7 files changed, 13 insertions(+), 79 deletions(-) diff --git a/slsReceiverSoftware/include/BinaryFile.h b/slsReceiverSoftware/include/BinaryFile.h index e109fbd08..407ba1c59 100644 --- a/slsReceiverSoftware/include/BinaryFile.h +++ b/slsReceiverSoftware/include/BinaryFile.h @@ -13,7 +13,6 @@ #include -class Fifo; class BinaryFile : private virtual slsReceiverDefs, public File, public BinaryFileStatic { @@ -35,12 +34,11 @@ 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, Fifo*& f); + int* dindex, int* nunits, uint64_t* nf, uint32_t* dr, uint32_t* portno); /** * Destructor diff --git a/slsReceiverSoftware/include/File.h b/slsReceiverSoftware/include/File.h index 00d730ce0..ec61996f6 100644 --- a/slsReceiverSoftware/include/File.h +++ b/slsReceiverSoftware/include/File.h @@ -13,7 +13,6 @@ #include -class Fifo; class File : private virtual slsReceiverDefs { @@ -35,12 +34,11 @@ 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, Fifo*& f); + int* dindex, int* nunits, uint64_t* nf, uint32_t* dr, uint32_t* portno); /** * Destructor @@ -94,13 +92,6 @@ 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 @@ -229,8 +220,5 @@ class File : private virtual slsReceiverDefs { /** UDP Port Number for logging */ uint32_t* udpPortNumber; - /** Fifo structure for logging fill level*/ - Fifo* fifo; - }; diff --git a/slsReceiverSoftware/include/HDF5File.h b/slsReceiverSoftware/include/HDF5File.h index 16d0300c1..c765fbfec 100644 --- a/slsReceiverSoftware/include/HDF5File.h +++ b/slsReceiverSoftware/include/HDF5File.h @@ -19,7 +19,6 @@ #endif #include -class Fifo; class HDF5File : private virtual slsReceiverDefs, public File, public HDF5FileStatic { @@ -43,13 +42,12 @@ 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, Fifo*& f); + uint32_t nx, uint32_t ny); /** * Destructor diff --git a/slsReceiverSoftware/src/BinaryFile.cpp b/slsReceiverSoftware/src/BinaryFile.cpp index c20083374..b50beee37 100644 --- a/slsReceiverSoftware/src/BinaryFile.cpp +++ b/slsReceiverSoftware/src/BinaryFile.cpp @@ -17,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, Fifo*& f): + int* dindex, int* nunits, uint64_t* nf, uint32_t* dr, uint32_t* portno): - File(ind, maxf, ppf, nd, fname, fpath, findex, frindexenable, owenable, dindex, nunits, nf, dr, portno, f), + File(ind, maxf, ppf, nd, fname, fpath, findex, frindexenable, owenable, dindex, nunits, nf, dr, portno), filefd(0), numFramesInFile(0), numActualPacketsInFile(0) @@ -45,12 +45,6 @@ slsReceiverDefs::fileFormat BinaryFile::GetFileType() { int BinaryFile::CreateFile(uint64_t fnum) { - /* - //calculate packet loss - int64_t loss = -1; - if (numFramesInFile) - loss = (numFramesInFile*(*packetsPerFrame)) - numActualPacketsInFile; -*/ numFramesInFile = 0; numActualPacketsInFile = 0; @@ -60,24 +54,7 @@ int BinaryFile::CreateFile(uint64_t fnum) { if (BinaryFileStatic::CreateDataFile(filefd, *overWriteEnable, currentFileName, FILE_BUFFER_SIZE) == FAIL) return FAIL; - //first file, print entrire path - /*if (loss == -1)*/ - if (!numFramesInFile) - FILE_LOG(logINFO) << "[" << *udpPortNumber << "]: Binary File created: " << currentFileName; - - /* - //other files - else { - char c[1000]; strcpy(c, currentFileName.c_str()); - if (loss) - bprintf(RED,"[%u]: Packet_Loss:%lu Used_Fifo_Max_Level:%d \tFree_Slots_Min_Level:%d \tNew_File:%s\n", - *udpPortNumber,loss, fifo->GetMaxLevelForFifoBound() , fifo->GetMinLevelForFifoFree(), basename(c)); - else - bprintf(GREEN,"[%u]: Packet_Loss:%lu Used_Fifo_Max_Level:%d \tFree_Slots_Min_Level:%d \tNew_File:%s\n", - *udpPortNumber,loss, fifo->GetMaxLevelForFifoBound(), fifo->GetMinLevelForFifoFree(), basename(c)); - } - */ - + FILE_LOG(logINFO) << "[" << *udpPortNumber << "]: Binary File created: " << currentFileName; return OK; } diff --git a/slsReceiverSoftware/src/DataProcessor.cpp b/slsReceiverSoftware/src/DataProcessor.cpp index 9a704ff5a..b3dbc0462 100644 --- a/slsReceiverSoftware/src/DataProcessor.cpp +++ b/slsReceiverSoftware/src/DataProcessor.cpp @@ -146,8 +146,6 @@ void DataProcessor::StopRunning() { void DataProcessor::SetFifo(Fifo*& f) { fifo = f; - if (file) - file->SetFifo(f); } void DataProcessor::ResetParametersforNewAcquisition() { @@ -240,14 +238,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, fifo); + generalData->nPixelsX, generalData->nPixelsY); break; #endif default: file = new BinaryFile(index, generalData->maxFramesPerFile, &generalData->packetsPerFrame, nd, fname, fpath, findex, frindexenable, owenable, - dindex, nunits, nf, dr, portno, fifo); + dindex, nunits, nf, dr, portno); break; } } diff --git a/slsReceiverSoftware/src/File.cpp b/slsReceiverSoftware/src/File.cpp index 177f33bb8..ee135a076 100644 --- a/slsReceiverSoftware/src/File.cpp +++ b/slsReceiverSoftware/src/File.cpp @@ -5,7 +5,6 @@ ***********************************************/ #include "File.h" -#include "Fifo.h" #include using namespace std; @@ -14,7 +13,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, Fifo*& f): + int* dindex, int* nunits, uint64_t* nf, uint32_t* dr, uint32_t* portno): index(ind), maxFramesPerFile(maxf), packetsPerFrame(ppf), @@ -29,8 +28,7 @@ File::File(int ind, uint32_t maxf, const uint32_t* ppf, numUnitsPerDetector(nunits), numImages(nf), dynamicRange(dr), - udpPortNumber(portno), - fifo(f) + udpPortNumber(portno) { master = index?false:true; @@ -91,7 +89,3 @@ void File::SetMaxFramesPerFile(uint32_t maxf) { void File::SetPacketsPerFrame(const uint32_t* ppf) { packetsPerFrame = ppf; } - -void File::SetFifo(Fifo*& f) { - fifo = f; -} diff --git a/slsReceiverSoftware/src/HDF5File.cpp b/slsReceiverSoftware/src/HDF5File.cpp index 92035d207..a24814097 100644 --- a/slsReceiverSoftware/src/HDF5File.cpp +++ b/slsReceiverSoftware/src/HDF5File.cpp @@ -25,9 +25,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, Fifo*& f): + uint32_t nx, uint32_t ny): - File(ind, maxf, ppf, nd, fname, fpath, findex, frindexenable, owenable, dindex, nunits, nf, dr, portno, f), + File(ind, maxf, ppf, nd, fname, fpath, findex, frindexenable, owenable, dindex, nunits, nf, dr, portno), filefd(0), dataspace(0), dataset(0), @@ -87,12 +87,6 @@ void HDF5File::UpdateDataType() { int HDF5File::CreateFile(uint64_t fnum) { - - //calculate packet loss - int64_t loss = -1; - if (numFramesInFile) - loss = (numFramesInFile*(*packetsPerFrame)) - numActualPacketsInFile; - numFilesinAcquisition++; numFramesInFile = 0; numActualPacketsInFile = 0; @@ -116,20 +110,7 @@ int HDF5File::CreateFile(uint64_t fnum) { if (dataspace == NULL) bprintf(RED,"Got nothing!\n"); - //first file, print entrire path - if (loss == -1) - FILE_LOG(logINFO) << *udpPortNumber << ": HDF5 File created: " << currentFileName; - //other files - else { - char c[1000]; strcpy(c, currentFileName.c_str()); - if (loss) - bprintf(RED,"[%u]: Packet_Loss:%lu Fifo_Max_Level:%d \tNew_File:%s\n", - *udpPortNumber,loss, fifo->GetMaxLevelForFifoBound() , basename(c)); - else - bprintf(GREEN,"[%u]: Packet_Loss:%lu Fifo_Max_Level:%d \tNew_File:%s\n", - *udpPortNumber,loss, fifo->GetMaxLevelForFifoBound(), basename(c)); - } - + FILE_LOG(logINFO) << *udpPortNumber << ": HDF5 File created: " << currentFileName; return OK; }