Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/Logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ extern void L_LOG(const char* fileName, int line, const char* funName, L_LEVEL l
extern void LOG_PROGRESS(int64_t done, int64_t total, bool forceOutput)
{
static std::chrono::steady_clock::time_point lastlogtime;
static double lastPercentage = 0.0f;
static int64_t lastDone = -1;
static int64_t lastTotal = -1;

if (!logEnabled) {
return;
Expand All @@ -106,15 +107,16 @@ extern void LOG_PROGRESS(int64_t done, int64_t total, bool forceOutput)
return;
}

if (done == lastDone && total == lastTotal)
return;
lastDone = done;
lastTotal = total;

double percentage = 0;
if (total > 0) {
percentage = static_cast<double>(done) / static_cast<double>(total);
}

if (percentage == lastPercentage)
return;
lastPercentage = percentage;

// In case the toal/done are incorrect, put 50%
if (percentage < 0 || percentage > 1) {
percentage = 0.5;
Expand Down
Loading