29 fprintf(
arberr,
"%s\n", msg);
33 fprintf(
arbout,
"%s\n", msg);
60 bool mayReconsiderHeight;
61 int printedAtHeightChange;
72 mayReconsiderHeight =
true;
73 printedAtHeightChange = 0;
84 fprintf(
arbout,
"Progress: %s\n", title);
89 fprintf(
arbout,
"[done]\n");
99 #if defined(FORCE_WEIGHTED_ESTIMATION)
100 if (strcmp(stitle,
"REQUEST_ESTIMATION") == 0) {
110 return seconds_passed / gauge;
116 int wanted =
int(gauge*WIDTH*height);
117 if (printed<wanted) {
118 #if defined(TRACE_BASIC_COUNTER)
119 fprintf(
arbout,
"\nBasicStatus::set_gauge(gauge=%f) -> wanted=%i printed=%i; ", gauge, wanted, printed);
121 while (printed<wanted) {
122 if (cursor && cursor[0]) {
131 if (printed == nextLF) {
132 mayReconsiderHeight =
false;
137 fprintf(
arbout,
" [%5.1f%%]", printed*100.0/(WIDTH*height));
138 bool done = (printed == (WIDTH*height));
139 double seconds = difftime(now, start);
141 const char *whatshown = done ?
"used" :
"left";
142 fprintf(
arbout,
" %s: ", whatshown);
150 else if (mayReconsiderHeight) {
151 if ((2*printed) > nextLF) {
152 mayReconsiderHeight =
false;
158 double seconds = difftime(now, start)+0.5;
161 int max_wanted_height =
int(overall_seconds/MIN_SECONDS_PER_ROW+0.5);
162 int min_wanted_height =
int(overall_seconds/MAX_SECONDS_PER_ROW+0.5);
164 arb_assert(min_wanted_height <= max_wanted_height);
166 int old_height = height;
168 height =
force_in_range(min_wanted_height, DEFAULT_HEIGHT, max_wanted_height);
171 if (old_height != height) {
172 #if defined(TRACE_BASIC_COUNTER)
173 fprintf(
arbout,
"redeciding height=%i printedAtHeightChange=%i printed=%i wanted=%i\n", height, printedAtHeightChange, printed, wanted);
175 printedAtHeightChange =
std::max(printedAtHeightChange, printed);
188 else if (!mayReconsiderHeight && printed>printedAtHeightChange && wanted<printed) {
190 int print_limit = (printed * 9) / 10;
191 if (wanted<print_limit) {
192 int print_again_from = (wanted * 8) / 10;
193 fprintf(
arbout,
"\n *** progress counter ran backwards *** (wanted=%i printed=%i print_limit=%i print_again_from=%i)\n", wanted, printed, print_limit, print_again_from);
194 printed = print_again_from;
void set_gauge(double gauge)
static bool basic_user_abort()
static arb_handlers arbout_handlers
static double estimate_overall_seconds(double seconds_passed, double gauge)
static void basic_openstatus(const char *title)
void open(const char *title)
arb_handlers * active_arb_handlers
static void basic_set_title(const char *)
CONSTEXPR_INLINE const T & force_in_range(const T &lower_bound, const T &value, const T &upper_bound)
static void to_arbout(const char *msg)
void set_subtitle(const char *stitle)
static void basic_closestatus()
const char * GBS_readable_timediff(size_t seconds)
static BasicStatus status
const int MIN_SECONDS_PER_ROW
static void basic_set_subtitle(const char *stitle)
fputs(TRACE_PREFIX, stderr)
static void to_arberr(const char *msg)
void ARB_install_handlers(arb_handlers &handlers)
static arb_status_implementation ARB_arbout_status
static void basic_set_gauge(double gauge)
const int MAX_SECONDS_PER_ROW
void ARB_redirect_handlers_to(FILE *errStream, FILE *outStream)
char * GBS_global_string_copy(const char *templat,...)