39 #ifdef DEBUG_RATE_MONITOR
47 #ifdef DEBUG_RATE_MONITOR
48 static void x_PrintList(
const list<CRateMonitor::TMark>&
data)
51 list<CRateMonitor::TMark>::const_iterator it =
data.begin();
52 cout <<
data.size() <<
':' << endl;
53 for (
size_t n = 0;
n <
data.size();
n++) {
56 "p = " <<
next.first <<
",\t"
57 "t = " <<
next.second;
60 "dp = " <<
prev.first -
next.first <<
",\t"
61 "dt = " <<
prev.second -
next.second << endl;
74 if (
m_Data.front().first > pos ||
75 m_Data.front().second > time) {
82 list<TMark>::const_iterator it;
83 if (
m_Data.front().first == pos ||
m_Data.front().second == time
87 m_Data.front().first = pos;
88 m_Data.front().second = time;
89 #ifdef DEBUG_RATE_MONITOR
90 cout <<
"UPDATED" << endl;
99 m_Data.push_front(make_pair(pos, time));
100 #ifdef DEBUG_RATE_MONITOR
101 cout <<
"ADDED" << endl;
120 list<TMark>::const_iterator it =
m_Data.begin();
122 for (++it; it !=
m_Data.end(); ++it) {
124 double dt =
prev.second -
next.second;
126 #ifdef DEBUG_RATE_MONITOR
127 cout <<
"dt = " << dt <<
",\td =" << (
kSpan - dt)
128 <<
",\tn = " << distance(
m_Data.begin(), it) << endl;
134 gaps.push_back(make_pair(
prev.first -
next.first, dt));
138 double dt =
m_Data.front().second -
m_Data.back().second;
141 gaps.push_back(make_pair(
m_Data.front().first -
142 m_Data.back ().first, dt));
149 double rate = double(gaps.front().first) / gaps.front().second;
173 double eta = double(
m_Size - pos) / rate;
189 double time =
m_Data.front().second;
192 time = time * double(
m_Size) / double(pos) - time;
static DLIST_TYPE *DLIST_NAME() prev(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
static DLIST_TYPE *DLIST_NAME() next(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
uint64_t Uint8
8-byte (64-bit) unsigned integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
double GetETA(void) const
How long it will take to complete, at the current rate.
pair< Uint8, double > TMark
Uint8 GetPos(void) const
Get current progress position (position 0 when job starts)
Uint8 m_Size
Total size of job to be performed.
void Mark(Uint8 pos, double time)
Submit a mark of the job progress.
double GetTimeRemaining(void) const
How long it will take to complete, at the average pace.
list< TMark > m_Data
Measurements as submitted by Mark()
double GetRate(void) const
How fast the recent rate has been, in positions per time unit, using the weighted formula.
double GetPace(void) const
How fast the average pace has been so far, in positions per time unit.
double m_Rate
Cached rate from last calculation.
NCBI C++ auxiliary debug macros.