summaryrefslogtreecommitdiff
path: root/klm/util/ersatz_progress.cc
diff options
context:
space:
mode:
authorKenneth Heafield <github@kheafield.com>2013-01-18 17:12:51 +0000
committerKenneth Heafield <github@kheafield.com>2013-01-18 17:12:51 +0000
commitd884099e0db8b4510847ec106b59ef7dca3c245b (patch)
treeb45a3f17eb002e224a7b728e0f985a15e2503196 /klm/util/ersatz_progress.cc
parentbae5fe99037ae7e101953ad0df118127191c711c (diff)
KenLM dffafbf with lmplz source (but not built)
Diffstat (limited to 'klm/util/ersatz_progress.cc')
-rw-r--r--klm/util/ersatz_progress.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/klm/util/ersatz_progress.cc b/klm/util/ersatz_progress.cc
index eb635ad8..498ab5c5 100644
--- a/klm/util/ersatz_progress.cc
+++ b/klm/util/ersatz_progress.cc
@@ -9,6 +9,8 @@ namespace util {
namespace { const unsigned char kWidth = 100; }
+const char kProgressBanner[] = "----5---10---15---20---25---30---35---40---45---50---55---60---65---70---75---80---85---90---95--100\n";
+
ErsatzProgress::ErsatzProgress() : current_(0), next_(std::numeric_limits<uint64_t>::max()), complete_(next_), out_(NULL) {}
ErsatzProgress::~ErsatzProgress() {
@@ -22,7 +24,7 @@ ErsatzProgress::ErsatzProgress(uint64_t complete, std::ostream *to, const std::s
return;
}
if (!message.empty()) *out_ << message << '\n';
- *out_ << "----5---10---15---20---25---30---35---40---45---50---55---60---65---70---75---80---85---90---95--100\n";
+ *out_ << kProgressBanner;
}
void ErsatzProgress::Milestone() {
@@ -38,7 +40,7 @@ void ErsatzProgress::Milestone() {
next_ = std::numeric_limits<uint64_t>::max();
out_ = NULL;
} else {
- next_ = std::max(next_, (stone * complete_) / kWidth);
+ next_ = std::max(next_, ((stone + 1) * complete_ + kWidth - 1) / kWidth);
}
}