summaryrefslogtreecommitdiff
path: root/klm/util/ersatz_progress.cc
diff options
context:
space:
mode:
Diffstat (limited to 'klm/util/ersatz_progress.cc')
-rw-r--r--klm/util/ersatz_progress.cc9
1 files changed, 3 insertions, 6 deletions
diff --git a/klm/util/ersatz_progress.cc b/klm/util/ersatz_progress.cc
index 09e3a106..55c182bd 100644
--- a/klm/util/ersatz_progress.cc
+++ b/klm/util/ersatz_progress.cc
@@ -13,10 +13,7 @@ ErsatzProgress::ErsatzProgress() : current_(0), next_(std::numeric_limits<std::s
ErsatzProgress::~ErsatzProgress() {
if (!out_) return;
- for (; stones_written_ < kWidth; ++stones_written_) {
- (*out_) << '*';
- }
- *out_ << '\n';
+ Finished();
}
ErsatzProgress::ErsatzProgress(std::ostream *to, const std::string &message, std::size_t complete)
@@ -36,8 +33,8 @@ void ErsatzProgress::Milestone() {
for (; stones_written_ < stone; ++stones_written_) {
(*out_) << '*';
}
-
- if (current_ >= complete_) {
+ if (stone == kWidth) {
+ (*out_) << std::endl;
next_ = std::numeric_limits<std::size_t>::max();
} else {
next_ = std::max(next_, (stone * complete_) / kWidth);