|
ModErn Text Analysis
META Enumerates Textual Applications
|
Simple class for reporting progress of lengthy operations. More...
#include <progress.h>
Public Member Functions | |
| progress (const std::string &prefix, uint64_t length, int interval=500, uint64_t min_iters=10) | |
| Constructs a progress reporter with the given prefix and iteration length. More... | |
| void | print_endline (bool endline) |
| Sets whether or not an endline should be printed at completion. More... | |
| ~progress () | |
| Destroys this progress reporter. More... | |
| void | operator() (uint64_t iter) |
| Updates the progress indicator. More... | |
| void | end () |
| Marks the progress indicator as having finished. | |
| void | clear () const |
| Clears the last line the progress bar wrote. | |
Private Attributes | |
| std::string | prefix_ |
| The prefix for the progress report message. | |
| std::chrono::steady_clock::time_point | start_ |
| The start time of the job. | |
| std::chrono::steady_clock::time_point | last_update_ |
| The time of the last update. | |
| uint64_t | last_iter_ |
| The last iteration number. | |
| uint64_t | length_ |
| The total number of iterations. | |
| int | interval_ |
| The length of time, in milliseconds, to wait between updates. | |
| uint64_t | min_iters_ |
| The minimum number of iterations that must pass before progress reporting will be considered. | |
| uint64_t | str_len_ |
| The length of the last progress output message. | |
| bool | finished_ |
| Whether or not we have finished the job. | |
| bool | endline_ |
| Whether or not we should print an endline when done. | |
Simple class for reporting progress of lengthy operations.
Inspired by noamraph/tqdm.
| meta::printing::progress::progress | ( | const std::string & | prefix, |
| uint64_t | length, | ||
| int | interval = 500, |
||
| uint64_t | min_iters = 10 |
||
| ) |
Constructs a progress reporter with the given prefix and iteration length.
| prefix | The string to be printed right before the progress output |
| length | The number of iterations |
| interval | The length of time, in milliseconds, to wait between updates. Default = 500ms. |
| min_iters | The minimum number of iterations that must pass before progress reporting will be considered |
| meta::printing::progress::~progress | ( | ) |
Destroys this progress reporter.
It will call end() if it has not already been called.
| void meta::printing::progress::print_endline | ( | bool | endline | ) |
Sets whether or not an endline should be printed at completion.
| endline | Whether or not an endline should be printed at completion |
| void meta::printing::progress::operator() | ( | uint64_t | iter | ) |
Updates the progress indicator.
| iter | The current iteration number to update to |
1.8.9.1