Belle II Software  release-08-01-10
ProgressBarModule.h
1 #pragma once
2 /**************************************************************************
3  * basf2 (Belle II Analysis Software Framework) *
4  * Author: The Belle II Collaboration *
5  * *
6  * See git log for contributors and copyright holders. *
7  * This file is licensed under LGPL-3.0, see LICENSE.md. *
8  **************************************************************************/
9 
10 #include <framework/core/Module.h>
11 
12 namespace Belle2 {
24  class ProgressBarModule : public Module {
25 
26  public:
27 
30 
32  virtual void initialize() override;
34  virtual void event() override;
36  virtual void terminate() override;
37 
38  protected:
40  long m_evtNr;
42  long m_nTotal;
44  double m_startTime;
46  double m_lastPrint;
48  int m_progress{0};
50  bool m_isTTY;
51  };
53 } // end namespace Belle2
Base class for Modules.
Definition: Module.h:72
Display a progress bar and an estimate of remaining time when number of events is known (e....
long m_nTotal
Total number of events.
virtual void initialize() override
Init the module.
virtual void event() override
Show progress.
virtual void terminate() override
Don't break the terminal.
int m_progress
progress in percent since we last printed
double m_lastPrint
Timestamp when we last printed something (ns).
double m_startTime
Start time (ns).
long m_evtNr
Number of processed events.
bool m_isTTY
If true we don't show the interactive progress bar but just print a new one every time the progress a...
Abstract base class for different kinds of events.