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;
readCount = 0;
clock_gettime(CLOCK_REALTIME, &t0);
ta = t0;
// ta = t0;
t1 = t0;
printf("ReadDataThread for digi-%d running.\n", digi->GetSerialNumber());
@ -79,17 +79,17 @@ public:
t2 = t1;
}
if( isSaveData && !stop ) {
clock_gettime(CLOCK_REALTIME, &tb);
if( tb.tv_sec - ta.tv_sec > 2 ) {
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] (" + QString::number(readCount) + ")");
digiMTX[ID].unlock();
// readCount = 0;
ta = tb;
}
}
// if( isSaveData && !stop ) {
// clock_gettime(CLOCK_REALTIME, &tb);
// if( tb.tv_sec - ta.tv_sec > 2 ) {
// 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] (" + QString::number(readCount) + ")");
// digiMTX[ID].unlock();
// // readCount = 0;
// ta = tb;
// }
// }
}while(!stop);
printf("ReadDataThread for digi-%d stopped.\n", digi->GetSerialNumber());

View File

@ -891,6 +891,10 @@ void MainWindow::SetupScalar(){
lbAggCount[iDigi] = new QLabel("AggCount/ReadCount", scalar);
lbAggCount[iDigi]->setAlignment(Qt::AlignLeft | Qt::AlignCenter);
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);
lbDigi->setAlignment(Qt::AlignRight | Qt::AlignCenter);
@ -1003,6 +1007,7 @@ void MainWindow::UpdateScalar(){
blockCountStr += "/" + QString::number(readDataThread[iDigi]->GetReadCount());
readDataThread[iDigi]->SetReadCountZero();
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
if( chkSaveData->isChecked() ) totalFileSize += digi[iDigi]->GetData()->GetTotalFileSize();

View File

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

View File

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

View File

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