feat: a late packet backfills the hole it left, values only
This commit is contained in:
1 parent
fc81e661d0
commit
7c60d79b65
4 files changed
+143
-37
No files matched your search
@@ -49,6 +49,17 @@ class ChannelBuffer final : public plot::data::Series {
|
||||
/// Consumer thread: forgets the published window (after a rebind or a reset).
|
||||
void invalidate() noexcept;
|
||||
|
||||
/// Producer thread, under `ScopeModel::mutex()`: records that absolute sample `absolute`
|
||||
/// has been backfilled, for `acquire()` to fold into the pyramid.
|
||||
///
|
||||
/// The pyramid is mutated *only* on the consumer thread, because a bucket is a 32-byte
|
||||
/// non-atomic aggregate the renderer reads unlocked at paint time: amending it from the
|
||||
/// producer would let a reader see a half-updated bucket whose `sum` did not match its
|
||||
/// `count`, which is a wrong mean out of a structure whose readers trust `count == 0` to
|
||||
/// mean absent. The value ring is amended by the producer, which owns its writes; the
|
||||
/// pyramid waits for here.
|
||||
void queue_amend(u64 absolute, f32 v) { pending_amends_.push_back({absolute, v}); }
|
||||
|
||||
void set_nominal_dt(f64 dt) noexcept { dt_ = dt; }
|
||||
/// Re-bases the x axis: `x0()`/`x_at()` become `epoch + timestamp`. Used to make
|
||||
/// the axis read seconds from the trigger event instead of from the stream.
|
||||
@@ -100,6 +111,13 @@ class ChannelBuffer final : public plot::data::Series {
|
||||
/// Timestamp of channel sample `absolute_index`, in seconds since `epoch_`.
|
||||
f64 time_of(u64 absolute_index) const noexcept;
|
||||
|
||||
struct Amend {
|
||||
u64 absolute;
|
||||
f32 value;
|
||||
};
|
||||
/// Backfills the producer has written into the value ring and the pyramid has not seen yet.
|
||||
std::vector<Amend> pending_amends_;
|
||||
|
||||
std::shared_ptr<const plot::data::RingBuffer<f32>> values_;
|
||||
std::shared_ptr<const plot::data::RingBuffer<f64>> times_;
|
||||
u64 stride_ = 1;
|
||||
|
||||
Reference in new issue
Block a user