pub struct RoutingStats {
pub total_routings: u64,
pub total_tokens: u64,
pub tokens_dropped: u64,
pub expert_utilization: Vec<f32>,
pub average_load_balance_loss: f32,
pub average_router_z_loss: f32,
pub routing_efficiency: f32,
pub expert_token_counts: Vec<u64>,
pub routing_latency_stats: LatencyStats,
pub load_variance_history: Vec<f32>,
pub capacity_stats: CapacityStats,
}Expand description
Routing statistics for monitoring and debugging
Tracks various metrics related to expert routing performance, efficiency, and utilization patterns over time.
Fields§
§total_routings: u64Total number of routing operations performed
total_tokens: u64Total number of tokens processed
tokens_dropped: u64Total number of tokens dropped due to capacity constraints
expert_utilization: Vec<f32>Expert utilization rates (running average per expert)
average_load_balance_loss: f32Average load balance loss across all routing operations
average_router_z_loss: f32Average router z-loss for numerical stability
routing_efficiency: f32Overall routing efficiency as a percentage
expert_token_counts: Vec<u64>Per-expert token assignment counts
routing_latency_stats: LatencyStatsRouting latency statistics
load_variance_history: Vec<f32>Expert load variance over time
capacity_stats: CapacityStatsCapacity utilization statistics
Implementations§
Source§impl RoutingStats
impl RoutingStats
Sourcepub fn record_routing(&mut self, routing_decision: &RoutingDecision)
pub fn record_routing(&mut self, routing_decision: &RoutingDecision)
Record a routing decision and update statistics
§Arguments
routing_decision- The routing decision to record
Sourcepub fn record_routing_latency(&mut self, latency: Duration)
pub fn record_routing_latency(&mut self, latency: Duration)
Record routing latency for performance monitoring
§Arguments
latency- The latency of the routing operation
Sourcepub fn utilization_cv(&self) -> f32
pub fn utilization_cv(&self) -> f32
Get the coefficient of variation for expert utilization
Sourcepub fn most_utilized_expert(&self) -> Option<(usize, f32)>
pub fn most_utilized_expert(&self) -> Option<(usize, f32)>
Get the most utilized expert
Sourcepub fn least_utilized_expert(&self) -> Option<(usize, f32)>
pub fn least_utilized_expert(&self) -> Option<(usize, f32)>
Get the least utilized expert
Sourcepub fn utilization_summary(&self) -> HashMap<String, f32>
pub fn utilization_summary(&self) -> HashMap<String, f32>
Get utilization statistics summary
Sourcepub fn recent_load_variance_trend(&self, window: usize) -> f32
pub fn recent_load_variance_trend(&self, window: usize) -> f32
Get recent load variance trend
Sourcepub fn throughput_stats(&self) -> ThroughputStats
pub fn throughput_stats(&self) -> ThroughputStats
Get throughput statistics
Trait Implementations§
Source§impl Clone for RoutingStats
impl Clone for RoutingStats
Source§fn clone(&self) -> RoutingStats
fn clone(&self) -> RoutingStats
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RoutingStats
impl Debug for RoutingStats
Source§impl Default for RoutingStats
impl Default for RoutingStats
Source§impl<'de> Deserialize<'de> for RoutingStats
impl<'de> Deserialize<'de> for RoutingStats
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for RoutingStats
impl RefUnwindSafe for RoutingStats
impl Send for RoutingStats
impl Sync for RoutingStats
impl Unpin for RoutingStats
impl UnsafeUnpin for RoutingStats
impl UnwindSafe for RoutingStats
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more