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>
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

View File

@ -13,7 +13,6 @@
#include <string>
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;
};

View File

@ -19,7 +19,6 @@
#endif
#include <string>
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

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -5,7 +5,6 @@
***********************************************/
#include "File.h"
#include "Fifo.h"
#include <iostream>
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;
}

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,
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;
}