14 #ifndef _PROGRESS_MONITOR_
15 #define _PROGRESS_MONITOR_
18 #include <sys/ioctl.h>
28 namespace chc = std::chrono;
29 typedef chc::duration<float, std::milli>
float_ms;
31 #define TOTAL_PERCENTAGE 100.0
32 #define CHARACTER_WIDTH_PERCENTAGE 4
33 #define TERMINAL_WIDTH 120
50 explicit ProgressMonitor(
size_t fr_total,
bool b_bar =
true,
float report_interval = 250.0, std::ostream &out = std::cerr);
58 float report_interval;
59 std::atomic<int> fr_count_a;
61 chc::time_point<chc::high_resolution_clock> time_stamp;
65 const char *unit_space;
67 inline void Report(
size_t idx,
float print_val);
68 inline void ClearBarField();
69 inline int GetBarLength();
chc::duration< float, std::milli > float_ms
ProgressMonitor & operator+=(int step)
std::atomic< bool > report_set
std::atomic< size_t > fr_count_i
static const int DEFAULT_WIDTH
ProgressMonitor(size_t fr_total, bool b_bar=true, float report_interval=250.0, std::ostream &out=std::cerr)
ProgressMonitor & operator++()
std::atomic< size_t > fr_count
std::atomic< bool > report_set_public