27 }
else if (unit ==
"s") {
29 }
else if (unit ==
"min") {
32 return 1000 * 60 * 60;
39 : total_steps_(total_steps), start_time_(
Timing::Timestamp()) {}
52 if (!isatty(fileno(stdout))) {
53 std::cout <<
"<ProgressBar::PrintProgressBar> omits output because you "
59 out <<
"ET = Elapsed Time; TR = Time Remaining" << std::endl;
77 assert(fraction_computed <= 1);
78 real_t remaining_time = elapsed_time / fraction_computed - elapsed_time;
83 size_t n_steps_computed = std::floor(fraction_computed / 0.02);
86 std::string terminal_output =
"";
87 terminal_output.append(
"[")
88 .append(std::string(n_steps_computed,
'#'))
89 .append(std::string(50 - n_steps_computed,
' '))
95 terminal_output.append(
"( ET: ")
96 .append(std::to_string(elapsed_time))
98 .append(std::to_string(remaining_time))
102 terminal_output.append(
"\r");
110 terminal_output.append(
115 out << terminal_output;
125 if (time_unit ==
"ms" || time_unit ==
"s" || time_unit ==
"min" ||
131 "Time unit not supported. Use ms, s, min, h instead. ",
132 "Falling back to [s].");