pub struct InstanceStats {
pub ops_observed: u64,
pub total_latency_ticks: u64,
pub contention_ops: u64,
pub op_kind_counts: [u64; 8],
pub last_seen_us_ago: u64,
pub migrations_triggered: u64,
pub per_op_kind_distinct_threads: [[u32; 4]; 8],
pub per_op_kind_distinct_count: [u8; 8],
}Expand description
Aggregated statistics for one registered instance.
Updated by the sidecar each poll cycle from drained observations.
Fields§
§ops_observed: u64§total_latency_ticks: u64§contention_ops: u64§op_kind_counts: [u64; 8]Per-op-kind counts. Index by Observation.op_kind (clamped to
the valid range). Primitives that adapt based on a ratio of
op kinds (e.g., reads vs writes) consume these.
last_seen_us_ago: u64§migrations_triggered: u64Number of migrations the sidecar has triggered on this instance (apply_migration calls that resulted in a tag change). Used by bench harnesses to measure adaptation-latency convergence.
per_op_kind_distinct_threads: [[u32; 4]; 8]Per-op-kind distinct-thread-id cache. Filled lazily by the
drain as observations arrive. Once a slot fills with a tid
that doesn’t match any earlier slot, the corresponding count
in per_op_kind_distinct_count increments.
per_op_kind_distinct_count: [u8; 8]Distinct thread count observed per op_kind (saturates at
MAX_TRACKED_THREADS_PER_KIND + 1 - meaning “more than the
slot table can hold”). >= 2 is the typical multi-producer
or multi-consumer detection threshold for primitive policies.
Implementations§
Source§impl InstanceStats
impl InstanceStats
pub fn average_latency_ticks(&self) -> u64
pub fn contention_rate(&self) -> f64
Sourcepub fn op_kind_total(&self) -> u64
pub fn op_kind_total(&self) -> u64
Total ops observed across all op kinds. Equals ops_observed
for primitives that always set a non-zero op_kind on their
observations.
Sourcepub fn ratio_of(&self, kind: u16, total_kinds: &[u16]) -> f64
pub fn ratio_of(&self, kind: u16, total_kinds: &[u16]) -> f64
Ratio of one op kind to the total of two op kinds. Returns 0.0 when both counts are zero (avoids divide-by-zero in policies).
Sourcepub fn distinct_threads_for(&self, kind: u16) -> u8
pub fn distinct_threads_for(&self, kind: u16) -> u8
Distinct producer-thread count observed for one op kind.
>= 2 indicates true multi-producer (or multi-consumer for the
recv-side op kind) usage on this primitive - the right signal
for a ChannelPolicy promoting SPSC → MPMC, an AdaptiveCell
noticing multi-writer churn, etc. Saturates at
MAX_TRACKED_THREADS_PER_KIND + 1.
Sourcepub fn is_multi_thread_for(&self, kind: u16) -> bool
pub fn is_multi_thread_for(&self, kind: u16) -> bool
True when the given op kind has been observed from more than one distinct producer thread.
Trait Implementations§
Source§impl Clone for InstanceStats
impl Clone for InstanceStats
Source§fn clone(&self) -> InstanceStats
fn clone(&self) -> InstanceStats
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more