move saving file size to Scalar

This commit is contained in:
Ryan Tang 2024-04-09 13:54:44 -04:00
parent ff3f94e0de
commit 6d7daaa13c
5 changed files with 31 additions and 23 deletions

View File

@ -35,7 +35,7 @@ public:
stop = false; stop = false;
readCount = 0; readCount = 0;
clock_gettime(CLOCK_REALTIME, &t0); clock_gettime(CLOCK_REALTIME, &t0);
ta = t0; // ta = t0;
t1 = t0; t1 = t0;
printf("ReadDataThread for digi-%d running.\n", digi->GetSerialNumber()); printf("ReadDataThread for digi-%d running.\n", digi->GetSerialNumber());
@ -79,17 +79,17 @@ public:
t2 = t1; t2 = t1;
} }
if( isSaveData && !stop ) { // if( isSaveData && !stop ) {
clock_gettime(CLOCK_REALTIME, &tb); // clock_gettime(CLOCK_REALTIME, &tb);
if( tb.tv_sec - ta.tv_sec > 2 ) { // if( tb.tv_sec - ta.tv_sec > 2 ) {
digiMTX[ID].lock(); // digiMTX[ID].lock();
emit sendMsg("FileSize ("+ QString::number(digi->GetSerialNumber()) +"): " + QString::number(digi->GetData()->GetTotalFileSize()/1024./1024., 'f', 4) + " MB [" + QString::number(tb.tv_sec-t0.tv_sec) + " sec]"); // emit sendMsg("FileSize ("+ QString::number(digi->GetSerialNumber()) +"): " + QString::number(digi->GetData()->GetTotalFileSize()/1024./1024., 'f', 4) + " MB [" + QString::number(tb.tv_sec-t0.tv_sec) + " sec]");
//emit sendMsg("FileSize ("+ QString::number(digi->GetSerialNumber()) +"): " + QString::number(digi->GetData()->GetTotalFileSize()/1024./1024., 'f', 4) + " MB [" + QString::number(tb.tv_sec-t0.tv_sec) + " sec] (" + QString::number(readCount) + ")"); // //emit sendMsg("FileSize ("+ QString::number(digi->GetSerialNumber()) +"): " + QString::number(digi->GetData()->GetTotalFileSize()/1024./1024., 'f', 4) + " MB [" + QString::number(tb.tv_sec-t0.tv_sec) + " sec] (" + QString::number(readCount) + ")");
digiMTX[ID].unlock(); // digiMTX[ID].unlock();
// readCount = 0; // // readCount = 0;
ta = tb; // ta = tb;
} // }
} // }
}while(!stop); }while(!stop);
printf("ReadDataThread for digi-%d stopped.\n", digi->GetSerialNumber()); printf("ReadDataThread for digi-%d stopped.\n", digi->GetSerialNumber());

View File

@ -892,6 +892,10 @@ void MainWindow::SetupScalar(){
lbAggCount[iDigi]->setAlignment(Qt::AlignLeft | Qt::AlignCenter); lbAggCount[iDigi]->setAlignment(Qt::AlignLeft | Qt::AlignCenter);
hBoxLayout->addWidget(lbAggCount[iDigi]); hBoxLayout->addWidget(lbAggCount[iDigi]);
lbFileSize[iDigi] = new QLabel("File Size", scalar);
lbFileSize[iDigi]->setAlignment(Qt::AlignLeft | Qt::AlignCenter);
hBoxLayout->addWidget(lbFileSize[iDigi]);
QLabel * lbDigi = new QLabel("Digi-" + QString::number(digi[iDigi]->GetSerialNumber()), scalar); QLabel * lbDigi = new QLabel("Digi-" + QString::number(digi[iDigi]->GetSerialNumber()), scalar);
lbDigi->setAlignment(Qt::AlignRight | Qt::AlignCenter); lbDigi->setAlignment(Qt::AlignRight | Qt::AlignCenter);
hBoxLayout->addWidget(lbDigi); hBoxLayout->addWidget(lbDigi);
@ -1003,6 +1007,7 @@ void MainWindow::UpdateScalar(){
blockCountStr += "/" + QString::number(readDataThread[iDigi]->GetReadCount()); blockCountStr += "/" + QString::number(readDataThread[iDigi]->GetReadCount());
readDataThread[iDigi]->SetReadCountZero(); readDataThread[iDigi]->SetReadCountZero();
lbAggCount[iDigi]->setText(blockCountStr); lbAggCount[iDigi]->setText(blockCountStr);
lbFileSize[iDigi]->setText(QString::number(digi[iDigi]->GetData()->GetTotalFileSize()/1024./1024., 'f', 3) + " MB");
digi[iDigi]->GetData()->CalTriggerRate(); //this will reset NumEventDecode & AggCount digi[iDigi]->GetData()->CalTriggerRate(); //this will reset NumEventDecode & AggCount
if( chkSaveData->isChecked() ) totalFileSize += digi[iDigi]->GetData()->GetTotalFileSize(); if( chkSaveData->isChecked() ) totalFileSize += digi[iDigi]->GetData()->GetTotalFileSize();

View File

@ -171,6 +171,8 @@ private:
QLabel * lbLastUpdateTime; QLabel * lbLastUpdateTime;
QLabel * lbScalarACQStatus; QLabel * lbScalarACQStatus;
QLabel * lbAggCount[MaxNDigitizer]; QLabel * lbAggCount[MaxNDigitizer];
QLabel * lbFileSize[MaxNDigitizer];
//@----- Run Record //@----- Run Record
QMainWindow * runRecord; QMainWindow * runRecord;

View File

@ -11,7 +11,7 @@
#define MaxRecordLength 0x3fff * 8 #define MaxRecordLength 0x3fff * 8
#define MaxSaveFileSize 1024 * 1024 * 1024 * 2 #define MaxSaveFileSize 1024 * 1024 * 1024 * 2
#define MaxDisplayTraceTimeLength 10000 //ns #define MaxDisplayTraceTimeLength 20000 //ns
#define ScopeUpdateMiliSec 200 // msec #define ScopeUpdateMiliSec 200 // msec
#define MaxNumberOfTrace 5 // in an event #define MaxNumberOfTrace 5 // in an event

View File

@ -9,20 +9,21 @@
#include <QObject> #include <QObject>
#include <QDebug> #include <QDebug>
class CustomApplication : public QApplication{ // class CustomApplication : public QApplication{
public: // public:
CustomApplication(int &argc, char **argv) : QApplication(argc, argv) {} // CustomApplication(int &argc, char **argv) : QApplication(argc, argv) {}
protected: // protected:
bool notify(QObject *receiver, QEvent *event) override{ // bool notify(QObject *receiver, QEvent *event) override{
qDebug() << "Event:" << event->type() << "Receiver:" << receiver; // qDebug() << event->type() << "Receiver:" << receiver;
return QApplication::notify(receiver, event); // return QApplication::notify(receiver, event);
} // }
}; // };
int main(int argc, char *argv[]){ int main(int argc, char *argv[]){
CustomApplication a(argc, argv); // CustomApplication a(argc, argv);
QApplication a(argc, argv);
bool isLock = false; bool isLock = false;
int pid = 0; int pid = 0;