fix: a truncated scan stays truncated, so a hit list with a hole is not reported clean

This commit is contained in:
Martino Ferrari committed 2026-10-08 10:03:46 +02:00
1 parent 415fceca87
commit 8ee4effb70
3 files changed
+8 -7

No files matched your search

+7 -5
View File
@@ -37,6 +37,7 @@ void BufferSearch::cancel() noexcept {
void BufferSearch::clear() noexcept {
state_ = State::Idle;
started_ = false;
truncated_ = false;
at_ = 0;
end_ = 0;
first_s_ = 0.0;
@@ -74,7 +75,6 @@ bool BufferSearch::prev() noexcept {
bool BufferSearch::pump(ScopeModel& model) {
if (state_ != State::Running) return false;
const auto chunk_t0 = std::chrono::steady_clock::now();
bool truncated = false;
u64 n = 0;
{
std::lock_guard<std::mutex> lock(model.mutex());
@@ -108,11 +108,11 @@ bool BufferSearch::pump(ScopeModel& model) {
const u64 base = store.time().base();
if (base > at_) {
at_ = base;
truncated = true;
truncated_ = true;
detector_.reset(); // the sequence has a gap in it; no pulse spans it
}
if (at_ >= end_) {
state_ = truncated ? State::Truncated : State::Done;
state_ = truncated_ ? State::Truncated : State::Done;
total_ms_ += ms_since(chunk_t0);
return false;
}
@@ -133,7 +133,9 @@ bool BufferSearch::pump(ScopeModel& model) {
scanned_s_ = t - first_s_;
state_ = State::Capped;
++chunks_;
total_ms_ += ms_since(chunk_t0);
const double cost = ms_since(chunk_t0);
if (cost > worst_chunk_ms_) worst_chunk_ms_ = cost;
total_ms_ += cost;
return false;
}
}
@@ -145,7 +147,7 @@ bool BufferSearch::pump(ScopeModel& model) {
if (cost > worst_chunk_ms_) worst_chunk_ms_ = cost;
total_ms_ += cost;
if (at_ >= end_) {
state_ = truncated ? State::Truncated : State::Done;
state_ = truncated_ ? State::Truncated : State::Done;
return false;
}
return true;