#include <unistd.h>
+#include <algorithm>
+#include <cmath>
#include <cstdio>
#include <fstream>
#include <TTraceWrapper.h>
const char kHistoryFileName[] = LOGDIR"/installation-history.log";
const int kLogRotationSize = 1024 * 256; // 256KB
const int kLogMaximumRotation = 3;
+const int kSignalCount = 10;
}
unsigned total_steps = steps_.size();
unsigned current_step = 1;
+ double div = total_steps / static_cast<double>(kSignalCount);
+ int interval = std::max(1, static_cast<int>(std::round(div)));
for (it_ = steps_.begin(); it_ != steps_.end(); ++it_, ++current_step) {
status_ = SafeExecute(*it_, &Step::precheck, "precheck");
if (!context_->pkgid.get().empty())
history_logger_.LogHistoryStart(context_->pkgid.get(),
GetPackageVersion(), context_->request_type.get());
- SendProgress(current_step * kProgressRange / total_steps);
+
+ if (current_step == total_steps || current_step % interval == 0)
+ SendProgress(current_step * kProgressRange / total_steps);
}
return result_;