Remove the code to do adaptive skipping. We should never sleep when doing Analysis unless an error occurred.

This commit is contained in:
Isaac Connor 2021-05-31 12:52:24 -04:00
parent b95cf72dc8
commit 610fdd3129
1 changed files with 0 additions and 25 deletions

View File

@ -22,28 +22,8 @@ void AnalysisThread::Start() {
} }
void AnalysisThread::Run() { void AnalysisThread::Run() {
Microseconds analysis_rate = Microseconds(monitor_->GetAnalysisRate());
Seconds analysis_update_delay = Seconds(monitor_->GetAnalysisUpdateDelay());
Debug(2, "AnalysisThread::Run() has an update delay of %" PRId64 "s",
static_cast<int64>(analysis_update_delay.count()));
monitor_->UpdateAdaptiveSkip();
TimePoint last_analysis_update_time = std::chrono::steady_clock::now();
TimePoint cur_time;
while (!(terminate_ or zm_terminate)) { while (!(terminate_ or zm_terminate)) {
// Some periodic updates are required for variable capturing framerate // Some periodic updates are required for variable capturing framerate
if (analysis_update_delay != Seconds::zero()) {
cur_time = std::chrono::steady_clock::now();
Debug(2, "Updating adaptive skip");
if ((cur_time - last_analysis_update_time) > analysis_update_delay) {
analysis_rate = Microseconds(monitor_->GetAnalysisRate());
monitor_->UpdateAdaptiveSkip();
last_analysis_update_time = cur_time;
}
}
Debug(2, "Analyzing"); Debug(2, "Analyzing");
if (!monitor_->Analyse()) { if (!monitor_->Analyse()) {
if (!(terminate_ or zm_terminate)) { if (!(terminate_ or zm_terminate)) {
@ -51,11 +31,6 @@ void AnalysisThread::Run() {
Debug(2, "Sleeping for %" PRId64 "us", int64(sleep_for.count())); Debug(2, "Sleeping for %" PRId64 "us", int64(sleep_for.count()));
std::this_thread::sleep_for(sleep_for); std::this_thread::sleep_for(sleep_for);
} }
} else if (analysis_rate != Microseconds::zero()) {
Debug(2, "Sleeping for %" PRId64 " us", int64(analysis_rate.count()));
std::this_thread::sleep_for(analysis_rate);
} else {
Debug(2, "Not sleeping");
} }
} }
} }