From fa7b6d704e5fe93489e78cd33f3da5e49d41cca6 Mon Sep 17 00:00:00 2001 From: Wagner Bruna Date: Wed, 15 Oct 2025 22:28:15 -0300 Subject: [PATCH 1/2] fix: add missing line cleanup for s/it progress display --- util.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util.cpp b/util.cpp index d6d067525..ad5e20e5d 100644 --- a/util.cpp +++ b/util.cpp @@ -269,7 +269,7 @@ void pretty_progress(int step, int steps, float time) { } } progress += "|"; - printf(time > 1.0f ? "\r%s %i/%i - %.2fs/it" : "\r%s %i/%i - %.2fit/s\033[K", + printf(time > 1.0f ? "\r%s %i/%i - %.2fs/it\033[K" : "\r%s %i/%i - %.2fit/s\033[K", progress.c_str(), step, steps, time > 1.0f || time == 0 ? time : (1.0f / time)); fflush(stdout); // for linux From 3db8881267db3b2b2f619eaecfad427640fb53e2 Mon Sep 17 00:00:00 2001 From: Wagner Bruna Date: Wed, 15 Oct 2025 22:28:27 -0300 Subject: [PATCH 2/2] refactor: reorganize progress line formatting --- util.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/util.cpp b/util.cpp index ad5e20e5d..6c58f4046 100644 --- a/util.cpp +++ b/util.cpp @@ -269,13 +269,16 @@ void pretty_progress(int step, int steps, float time) { } } progress += "|"; - printf(time > 1.0f ? "\r%s %i/%i - %.2fs/it\033[K" : "\r%s %i/%i - %.2fit/s\033[K", - progress.c_str(), step, steps, - time > 1.0f || time == 0 ? time : (1.0f / time)); - fflush(stdout); // for linux - if (step == steps) { - printf("\n"); + + const char* lf = (step == steps ? "\n" : ""); + const char* unit = "s/it"; + float speed = time; + if (speed < 1.0f && speed > 0.f) { + speed = 1.0f / speed; + unit = "it/s"; } + printf("\r%s %i/%i - %.2f%s\033[K%s", progress.c_str(), step, steps, speed, unit, lf); + fflush(stdout); // for linux } std::string ltrim(const std::string& s) {