Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
|
#include <progress-updater.h>
Public Member Functions | |
ProgressUpdater (const std::string &label, int64_t max, int update_period=1) | |
ProgressUpdater () | |
void | set_logging_level (int level) |
void | Update (int64_t delta) |
bool | done () const |
Returns if all tasks are done. More... | |
int64_t | total () const |
int64_t | num_complete () const |
int64_t | remaining () const |
std::string | ToString () const |
Returns a string representation of the current progress. More... | |
Private Attributes | |
std::string | label_ |
int | logging_level_ |
int64_t | total_ |
int | update_period_ |
AtomicInt< int64_t > | num_complete_ |
int | last_output_percentage_ |
Utility class to update progress. This is split out so a different logging level can be set for these updates (GLOG_module) This class is thread safe. Example usage: ProgressUpdater updater("Task", 100, 10); // 100 items, print every 10% updater.Update(15); // 15 done, prints 15% updater.Update(3); // 18 done, doesn't print update.Update(5); // 23 done, prints 23%
Definition at line 34 of file progress-updater.h.
impala::ProgressUpdater::ProgressUpdater | ( | const std::string & | label, |
int64_t | max, | ||
int | update_period = 1 |
||
) |
label - label that is printed with each update. max - maximum number of work items update_period - how often the progress is spewed expressed as a percentage
ProgressUpdater::ProgressUpdater | ( | ) |
Definition at line 29 of file progress-updater.cc.
|
inline |
Returns if all tasks are done.
Definition at line 52 of file progress-updater.h.
References num_complete_, and total_.
Referenced by impala::HdfsScanNode::GetNext(), and impala::HdfsScanNode::ScannerThread().
|
inline |
Definition at line 55 of file progress-updater.h.
References num_complete_.
Referenced by remaining(), ToString(), and Update().
|
inline |
Definition at line 56 of file progress-updater.h.
References num_complete(), and total().
Referenced by impala::HdfsScanNode::ThreadTokenAvailableCb().
|
inline |
Sets the GLOG level for this progress updater. By default, this will use 2 but objects can override it.
Definition at line 45 of file progress-updater.h.
References logging_level_.
string ProgressUpdater::ToString | ( | ) | const |
Returns a string representation of the current progress.
Definition at line 62 of file progress-updater.cc.
References label_, num_complete(), num_complete_, and total_.
|
inline |
void ProgressUpdater::Update | ( | int64_t | delta | ) |
'delta' more of the work has been complete. Will potentially output to VLOG_PROGRESS
Definition at line 34 of file progress-updater.cc.
References label_, last_output_percentage_, logging_level_, num_complete(), num_complete_, total_, and update_period_.
|
private |
Definition at line 62 of file progress-updater.h.
Referenced by ToString(), and Update().
|
private |
Definition at line 68 of file progress-updater.h.
Referenced by Update().
|
private |
Definition at line 63 of file progress-updater.h.
Referenced by set_logging_level(), and Update().
|
private |
Definition at line 67 of file progress-updater.h.
Referenced by done(), num_complete(), ToString(), and Update().
|
private |
Definition at line 64 of file progress-updater.h.
Referenced by done(), ToString(), total(), and Update().
|
private |
Definition at line 65 of file progress-updater.h.
Referenced by Update().