GClasses
GClasses::GProgressEstimator Class Reference

Detailed Description

This class is used with big loops to estimate the wall-clock time until completion. It works by computing the running median of the duration of recent iterations, and projecting that duration across the remaining iterations.

#include <GTime.h>

Public Member Functions

 GProgressEstimator (size_t total_iters, size_t sampleSize=13)
 
 ~GProgressEstimator ()
 
const char * estimate (size_t iter)
 

Protected Attributes

double m_iterStartTime
 
std::string m_message
 
double m_prevMedian
 
std::vector< double > m_queue
 
size_t m_queuePos
 
GIndexedMultiSet< double > m_samples
 
size_t m_sampleSize
 
double m_startTime
 
size_t m_totalIters
 

Constructor & Destructor Documentation

GClasses::GProgressEstimator::GProgressEstimator ( size_t  total_iters,
size_t  sampleSize = 13 
)
GClasses::GProgressEstimator::~GProgressEstimator ( )

Member Function Documentation

const char* GClasses::GProgressEstimator::estimate ( size_t  iter)

Member Data Documentation

double GClasses::GProgressEstimator::m_iterStartTime
protected
std::string GClasses::GProgressEstimator::m_message
protected
double GClasses::GProgressEstimator::m_prevMedian
protected
std::vector<double> GClasses::GProgressEstimator::m_queue
protected
size_t GClasses::GProgressEstimator::m_queuePos
protected
GIndexedMultiSet<double> GClasses::GProgressEstimator::m_samples
protected
size_t GClasses::GProgressEstimator::m_sampleSize
protected
double GClasses::GProgressEstimator::m_startTime
protected
size_t GClasses::GProgressEstimator::m_totalIters
protected