19 : m_start(0), m_end(1.0), m_ifirst(0), m_numSteps(1), m_notifyStep(1), m_notifyStepPct(1), m_step(1), m_i(0),
20 m_last_reported(-1), m_timeElapsed(
std::make_unique<
Timer>()), m_notifyStepPrecision(0) {
32 : m_start(start), m_end(end), m_ifirst(0), m_numSteps(numSteps), m_notifyStep(1), m_notifyStepPct(1), m_step(1),
33 m_i(0), m_last_reported(-1), m_timeElapsed(
std::make_unique<
Timer>()), m_notifyStepPrecision(0) {
34 if (start < 0. || start >= end) {
35 std::stringstream msg;
36 msg <<
"Progress range invalid 0 <= start=" << start <<
" <= end=" << end;
37 throw std::invalid_argument(msg.str());
51 : m_timeElapsed(
std::make_unique<
Timer>())
133 m_i +=
static_cast<int64_t
>(inc);
148 auto numSteps =
static_cast<double>(
m_numSteps);
163 if (start < 0. || start >= end) {
164 std::stringstream msg;
165 msg <<
"Progress range invalid 0 <= start=" << start <<
" <= end=" << end;
166 throw std::invalid_argument(msg.str());
206 double total = elapsed / prog;
207 return total - elapsed;
const std::vector< double > & rhs
double m_end
Ending progress.
ProgressBase & operator=(const ProgressBase &rhs)
int64_t m_numSteps
Loop counter upper bound.
int64_t m_ifirst
Loop counter initial value.
void resetNumSteps(int64_t nsteps, double start, double end)
Change the number of steps between start/end.
virtual void doReport(const std::string &msg="")=0
Pure virtual method that does the progress reporting, to be overridden.
std::unique_ptr< Kernel::Timer > m_timeElapsed
Timer that is started when the progress bar is constructed.
double m_step
Progress increment at each loop.
void reportIncrement(int inc, const std::string &msg="")
Sends the progress notification and increment the loop counter by more than one.
double m_notifyStepPct
Frequency of sending the notification (as a min percentage step, e.g.
int m_notifyStepPrecision
Digits of precision in the reporting.
double getEstimatedTime() const
Returns the estimated number of seconds until the algorithm completes.
void report()
Increments the loop counter by 1, then sends the progress notification on behalf of its algorithm.
void setNumSteps(int64_t nsteps)
Change the number of steps between start/end.
double m_start
Starting progress.
int64_t m_notifyStep
Frequency of sending the notification (every m_step times)
std::atomic< int64_t > m_i
Loop counter.
virtual ~ProgressBase()
Destructor.
ProgressBase()
Default constructor.
std::atomic< int64_t > m_last_reported
Last loop counter value the was a peport.
void setNotifyStep(double notifyStepPct)
Override the frequency at which notifications are sent out.
A simple class that provides a wall-clock (not processor time) timer.