Skip to main content

MonitorEvent

Struct MonitorEvent 

Source
pub struct MonitorEvent {
    pub snapshot: Arc<Snapshot>,
    pub origin: u64,
    pub mask: EventMask,
}
Expand description

A monitor event sent to subscribers when a PV value changes. Carries a full Snapshot so GR/CTRL metadata (PREC, EGU, limits) is available.

Fields§

§snapshot: Arc<Snapshot>

The posted value, shared with every other subscriber this post reached.

C never copies a wide value into an event at all. db_create_field_log stores anything wider than union native_value by reference (dbfl_type_ref, dtor == NULL, so dbfl_has_copy is false), and the value is read at DELIVERY: read_reply reserves the payload inside the client’s existing send buffer (cas_copy_in_header, camessage.c:516) and dbGet converts straight from the record’s live field into it (dbAccess.c:1020, the !dbfl_has_copy(pfl) arm). One array, N events pointing at it, zero retained copies.

The port cannot read the record at delivery — the event outlives the record lock — so it snapshots once at post time. Arc is what makes that snapshot C’s single array instead of one owned copy per subscriber: record_instance built make_monitor_snapshot once and then deep-cloned it per subscriber, so a 1 MiB waveform with four monitors cost 4 MiB retained where C costs four ~100-byte field logs. Measured consequence on x86_64-wrs-vxworks: memory allocation of 1048576 bytes failed and signal 6 at fan-out 4, while the same four clients without array monitors survived at a HIGHER MEM_USED (213,311,488 B vs the 211,804,160 B the aborting run died at) — the fan-out was the discriminator, not the memory level.

§origin: u64

Origin writer ID. When non-zero, subscribers with the same ignore_origin can filter out self-triggered events. Used to prevent sequencer write-back loops.

Scope: tagged explicitly by the put_*_post tier (put_pv_and_post_with_origin, records and simple PVs alike), and inherited by every post inside the put_*_process tier’s synchronous put+process cascade through the thread-local ambient write origin (AmbientWriteOriginScope) — both record funnels (notify_field_with_origin, notify_from_snapshot) and the simple-PV funnel (ProcessVariable::deliver) apply the same inheritance rule. Posts from work a cascade merely spawned (async record completions, driver pollers) run outside any scope and stay origin 0.

§mask: EventMask

The DBE_* event class(es) this post carries FOR THIS SUBSCRIBER — the poster’s mask intersected with the subscriber’s select, never the poster’s mask alone. C stamps exactly that on the field log (pLog->mask = caEventMask & pevent->select, dbEvent.c:896-900) and pvxs narrows per event from pDbFieldLog->mask (groupsource.cpp:331-337). The intersection is produced by Subscriber::delivered_mask, which is also the delivery gate, so the two cannot drift apart. Carrying it on the event lets subscribers narrow what they decode (e.g. a QSRV group monitor updating only alarm leaves on a DBE_ALARM-only event) and lets the .{dbnd}/.{sync}/.{dec} pre-chain filters see the classes the client actually asked for. When events coalesce under a slow consumer, masks accumulate by OR — the surviving snapshot is the newest, the mask reports every class that changed since the last delivered event.

Trait Implementations§

Source§

impl Clone for MonitorEvent

Source§

fn clone(&self) -> MonitorEvent

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MonitorEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more