Skip to content

Commit

Permalink
Merge pull request #537 from rest-for-physics/feminos-daq-progress
Browse files Browse the repository at this point in the history
Show progress bar on feminos-daq
  • Loading branch information
lobis authored Sep 24, 2024
2 parents 907e693 + 28bf0ad commit 94c3bc6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions source/framework/core/inc/TRestRun.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class TRestRun : public TRestMetadata {
bool fHangUpEndFile = false; //!
bool fFromRML = false; //!

Long64_t fFeminosDaqTotalEvents = 0; //!

void InitFromConfigFile() override;

private:
Expand Down Expand Up @@ -216,6 +218,9 @@ class TRestRun : public TRestMetadata {
inline void HangUpEndFile() { fHangUpEndFile = true; }
inline void ReleaseEndFile() { fHangUpEndFile = false; }

inline void SetFeminosDaqTotalEvents(Long64_t n) { fFeminosDaqTotalEvents = n; }
inline Long64_t GetFeminosDaqTotalEvents() const { return fFeminosDaqTotalEvents; }

// Printers
void PrintStartDate();
void PrintEndDate();
Expand Down
6 changes: 4 additions & 2 deletions source/framework/core/src/TRestProcessRunner.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,9 @@ void TRestProcessRunner::PrintProcessedEvents(Int_t rateE) {
double progspeed = progsum / ncalculated / printInterval * 1000000;

double prog = 0;
if (fEventsToProcess == REST_MAXIMUM_EVENTS && fRunInfo->GetFileProcess() != nullptr)
if (fRunInfo->GetFeminosDaqTotalEvents() > 0) {
prog = fProcessedEvents / (double)fRunInfo->GetFeminosDaqTotalEvents() * 100;
} else if (fEventsToProcess == REST_MAXIMUM_EVENTS && fRunInfo->GetFileProcess() != nullptr)
// Nevents is unknown, reading external data file
{
prog = fRunInfo->GetBytesRead() / (double)fRunInfo->GetTotalBytes() * 100;
Expand All @@ -1104,7 +1106,7 @@ void TRestProcessRunner::PrintProcessedEvents(Int_t rateE) {
}

char* buffer = new char[500]();
if (fRunInfo->GetFileProcess() != nullptr) {
if (fRunInfo->GetFileProcess() != nullptr && speedbyte > 0) {
sprintf(buffer, "%d Events (%.1fMB/s), ", fProcessedEvents, speedbyte / 1024 / 1024);
} else {
sprintf(buffer, "%d Events, ", fProcessedEvents);
Expand Down

0 comments on commit 94c3bc6

Please sign in to comment.