TPIE

v1.1rc1-6-g0c97303
tpie::pipelining::bits::proxy_progress_indicator Class Reference

Inherits tpie::progress_indicator_base.

Public Member Functions

 proxy_progress_indicator (node &s)
 
void refresh ()
 Display the indicator. More...
 
void step (stream_size_type step=1)
 Record an increment to the indicator and advance the indicator. More...
 
void raw_step (stream_size_type step)
 
virtual void init (stream_size_type range=0)
 Initialize progress indicator. More...
 
virtual void done ()
 Advance the indicator to the end. More...
 
virtual void set_range (stream_size_type range)
 Set the upper bound of the counting range. More...
 
stream_size_type get_current ()
 Get the current value of the step counter. More...
 
stream_size_type get_range ()
 Get the maximum value of the current range. More...
 
execution_time_predictorget_time_predictor ()
 
void set_time_predictor (execution_time_predictor *p)
 
std::string estimated_remaining_time ()
 
virtual void push_breadcrumb (const char *, description_importance)
 
virtual void pop_breadcrumb ()
 

Protected Attributes

stream_size_type m_range
 The upper bound of the counting range. More...
 
stream_size_type m_current
 The current progress count [m_minRange...m_maxRange]. More...
 

Detailed Description

Definition at line 37 of file node.h.

Member Function Documentation

stream_size_type tpie::progress_indicator_base::get_current ( )
inlineinherited

Get the current value of the step counter.

Definition at line 162 of file progress_indicator_base.h.

References tpie::progress_indicator_base::m_current.

Referenced by refresh().

162 { return m_current; }
stream_size_type m_current
The current progress count [m_minRange...m_maxRange].
stream_size_type tpie::progress_indicator_base::get_range ( )
inlineinherited

Get the maximum value of the current range.

Definition at line 167 of file progress_indicator_base.h.

References tpie::progress_indicator_base::m_range.

Referenced by refresh().

167 { return m_range; }
stream_size_type m_range
The upper bound of the counting range.
virtual void tpie::progress_indicator_base::init ( stream_size_type  range = 0)
inlinevirtualinherited

Initialize progress indicator.

Parameters
rangeThe number of times step() is going to be called.

Reimplemented in tpie::fractional_subindicator, tpie::progress_indicator_null, and tpie::progress_indicator_subindicator.

Definition at line 124 of file progress_indicator_base.h.

References tpie::progress_indicator_base::m_current, tpie::progress_indicator_base::refresh(), and tpie::progress_indicator_base::set_range().

Referenced by tpie::merge_sorter< T, UseProgress, pred_t >::calc(), tpie::pipelining::passive_reverser< T >::source_t< dest_t >::go(), tpie::pipelining::serialization_bits::sort_calc_t< Traits >::go(), and tpie::parallel_sort().

124  {
125  if (range != 0) set_range(range);
126  m_current = 0;
127  refresh();
128 
129  m_start = getticks();
130  m_next = 1;
131 
132 #ifndef TPIE_NDEBUG
133  m_lastCalled = getticks();
134 #endif
135  }
virtual void refresh()=0
Display the indicator.
stream_size_type m_current
The current progress count [m_minRange...m_maxRange].
virtual void set_range(stream_size_type range)
Set the upper bound of the counting range.
void tpie::pipelining::bits::proxy_progress_indicator::refresh ( )
inlinevirtual

Display the indicator.

Implements tpie::progress_indicator_base.

Definition at line 657 of file node.h.

References tpie::progress_indicator_base::get_current(), tpie::progress_indicator_base::get_range(), and tpie::pipelining::node::step().

657  {
658  double proxyMax = static_cast<double>(get_range());
659  double proxyCur = static_cast<double>(get_current());
660  double parentMax = static_cast<double>(m_node.m_stepsTotal);
661  double parentCur = static_cast<double>(m_node.m_stepsTotal-m_node.m_stepsLeft);
662  double missing = parentMax*proxyCur/proxyMax - parentCur;
663  if (missing < 1.0) return;
664  stream_size_type times = static_cast<stream_size_type>(1.0+missing);
665  times = std::min(m_node.m_stepsLeft, times);
666  m_node.step(times);
667 }
stream_size_type get_range()
Get the maximum value of the current range.
stream_size_type get_current()
Get the current value of the step counter.
void step(stream_size_type steps=1)
Step the progress indicator.
Definition: node.h:586
virtual void tpie::progress_indicator_base::set_range ( stream_size_type  range)
inlinevirtualinherited

Set the upper bound of the counting range.

This method also implies a reset of the counter. In order to be able to set the uper bound independent of setting the lower bound, no range checking is done.

Parameters
rangeThe new upper bound.

Reimplemented in tpie::progress_indicator_null.

Definition at line 150 of file progress_indicator_base.h.

References tpie::progress_indicator_base::m_range.

Referenced by tpie::progress_indicator_base::init().

150  {
151  m_range = range;
152  }
stream_size_type m_range
The upper bound of the counting range.
void tpie::progress_indicator_base::step ( stream_size_type  step = 1)
inlineinherited

Record an increment to the indicator and advance the indicator.

Definition at line 89 of file progress_indicator_base.h.

References tpie::log_debug(), tpie::progress_indicator_base::m_current, and tpie::progress_indicator_base::refresh().

Referenced by tpie::merge_sorter< T, UseProgress, pred_t >::calc(), tpie::pipelining::passive_reverser< T >::source_t< dest_t >::go(), tpie::pipelining::serialization_bits::sort_calc_t< Traits >::go(), tpie::ami::Internal_Sorter_Obj< T, Compare >::sort(), and tpie::pipelining::node::step().

89  {
90  m_current += step;
91 
92 #ifndef TPIE_NDEBUG
93  {
94  ticks currentTicks = getticks();
95  if (elapsed(currentTicks,m_lastCalled) > m_frequency * m_threshold * 5)
96  tpie::log_debug() << "Step was not called for an estimated "
97  << (elapsed(currentTicks,m_lastCalled) / (m_frequency * m_threshold))
98  << " seconds" << std::endl;;
99  m_lastCalled = currentTicks;
100  }
101 #endif
102  if (m_current > m_next) {
103  ticks currentTicks = getticks();
104  m_next = static_cast<stream_size_type>(
105  static_cast<double>(m_current) * (elapsed(currentTicks, m_start) + m_threshold)/
106  elapsed(currentTicks, m_start));
107  if (m_next > m_current *2) m_next=m_current*2; //For bad guestimation in the beginning
108  refresh();
109  }
110  }
virtual void refresh()=0
Display the indicator.
stream_size_type m_current
The current progress count [m_minRange...m_maxRange].
void step(stream_size_type step=1)
Record an increment to the indicator and advance the indicator.
logstream & log_debug()
Return logstream for writing debug log messages.
Definition: tpie_log.h:124

Member Data Documentation

stream_size_type tpie::progress_indicator_base::m_range
protectedinherited

The documentation for this class was generated from the following file: