changes for the statistic moved to listener

This commit is contained in:
Dhanya Maliakal 2017-08-18 17:57:31 +02:00
parent d58dd1d035
commit cc5862533e
7 changed files with 13 additions and 79 deletions

View File

@ -13,7 +13,6 @@
#include <string> #include <string>
class Fifo;
class BinaryFile : private virtual slsReceiverDefs, public File, public BinaryFileStatic { 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 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, Fifo*& f); int* dindex, int* nunits, uint64_t* nf, uint32_t* dr, uint32_t* portno);
/** /**
* Destructor * Destructor

View File

@ -13,7 +13,6 @@
#include <string> #include <string>
class Fifo;
class File : private virtual slsReceiverDefs { class File : private virtual slsReceiverDefs {
@ -35,12 +34,11 @@ 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, Fifo*& f); int* dindex, int* nunits, uint64_t* nf, uint32_t* dr, uint32_t* portno);
/** /**
* Destructor * Destructor
@ -94,13 +92,6 @@ 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
@ -229,8 +220,5 @@ 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;
}; };

View File

@ -19,7 +19,6 @@
#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 {
@ -43,13 +42,12 @@ 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, Fifo*& f); uint32_t nx, uint32_t ny);
/** /**
* Destructor * Destructor

View File

@ -17,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, 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), filefd(0),
numFramesInFile(0), numFramesInFile(0),
numActualPacketsInFile(0) numActualPacketsInFile(0)
@ -45,12 +45,6 @@ slsReceiverDefs::fileFormat BinaryFile::GetFileType() {
int BinaryFile::CreateFile(uint64_t fnum) { int BinaryFile::CreateFile(uint64_t fnum) {
/*
//calculate packet loss
int64_t loss = -1;
if (numFramesInFile)
loss = (numFramesInFile*(*packetsPerFrame)) - numActualPacketsInFile;
*/
numFramesInFile = 0; numFramesInFile = 0;
numActualPacketsInFile = 0; numActualPacketsInFile = 0;
@ -60,24 +54,7 @@ int BinaryFile::CreateFile(uint64_t fnum) {
if (BinaryFileStatic::CreateDataFile(filefd, *overWriteEnable, currentFileName, FILE_BUFFER_SIZE) == FAIL) if (BinaryFileStatic::CreateDataFile(filefd, *overWriteEnable, currentFileName, FILE_BUFFER_SIZE) == FAIL)
return FAIL; return FAIL;
//first file, print entrire path FILE_LOG(logINFO) << "[" << *udpPortNumber << "]: Binary File created: " << currentFileName;
/*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));
}
*/
return OK; return OK;
} }

View File

@ -146,8 +146,6 @@ 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() {
@ -240,14 +238,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, fifo); generalData->nPixelsX, generalData->nPixelsY);
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, fifo); dindex, nunits, nf, dr, portno);
break; break;
} }
} }

View File

@ -5,7 +5,6 @@
***********************************************/ ***********************************************/
#include "File.h" #include "File.h"
#include "Fifo.h"
#include <iostream> #include <iostream>
using namespace std; using namespace std;
@ -14,7 +13,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, Fifo*& f): int* dindex, int* nunits, uint64_t* nf, uint32_t* dr, uint32_t* portno):
index(ind), index(ind),
maxFramesPerFile(maxf), maxFramesPerFile(maxf),
packetsPerFrame(ppf), packetsPerFrame(ppf),
@ -29,8 +28,7 @@ File::File(int ind, uint32_t maxf, const uint32_t* ppf,
numUnitsPerDetector(nunits), numUnitsPerDetector(nunits),
numImages(nf), numImages(nf),
dynamicRange(dr), dynamicRange(dr),
udpPortNumber(portno), udpPortNumber(portno)
fifo(f)
{ {
master = index?false:true; master = index?false:true;
@ -91,7 +89,3 @@ 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;
}

View File

@ -25,9 +25,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, 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), filefd(0),
dataspace(0), dataspace(0),
dataset(0), dataset(0),
@ -87,12 +87,6 @@ void HDF5File::UpdateDataType() {
int HDF5File::CreateFile(uint64_t fnum) { int HDF5File::CreateFile(uint64_t fnum) {
//calculate packet loss
int64_t loss = -1;
if (numFramesInFile)
loss = (numFramesInFile*(*packetsPerFrame)) - numActualPacketsInFile;
numFilesinAcquisition++; numFilesinAcquisition++;
numFramesInFile = 0; numFramesInFile = 0;
numActualPacketsInFile = 0; numActualPacketsInFile = 0;
@ -116,20 +110,7 @@ int HDF5File::CreateFile(uint64_t fnum) {
if (dataspace == NULL) if (dataspace == NULL)
bprintf(RED,"Got nothing!\n"); bprintf(RED,"Got nothing!\n");
//first file, print entrire path FILE_LOG(logINFO) << *udpPortNumber << ": HDF5 File created: " << currentFileName;
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));
}
return OK; return OK;
} }