Skip to main content

weir/fixed_point_resident_cache/
stats.rs

1/// Runtime counters for [`super::FixedPointResidentGraphCache`].
2#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
3pub struct FixedPointResidentGraphCacheStats {
4    /// Successful lookups that avoided resident graph upload.
5    pub hits: u64,
6    /// Lookups that uploaded invariant graph buffers.
7    pub misses: u64,
8    /// Resident graph uploads performed by this cache.
9    pub resident_uploads: u64,
10    /// Cumulative resident graph bytes uploaded by this cache.
11    pub resident_upload_bytes: u64,
12    /// Cumulative resident graph upload bytes avoided by cache hits.
13    pub resident_avoided_upload_bytes: u64,
14    /// Resident graph entries evicted to stay within the retained-byte limit.
15    pub evictions: u64,
16    /// Current resident graph bytes retained by the cache.
17    pub retained_bytes: usize,
18    /// Current resident graph entry count.
19    pub entries: usize,
20}
21
22impl FixedPointResidentGraphCacheStats {
23    /// Backend-neutral resident graph reuse telemetry for this cache snapshot.
24    #[must_use]
25    pub const fn resident_graph_reuse_telemetry(self) -> vyre::ResidentGraphReuseTelemetry {
26        vyre::ResidentGraphReuseTelemetry::from_counters(
27            self.misses,
28            self.hits,
29            self.resident_upload_bytes,
30            self.resident_avoided_upload_bytes,
31        )
32    }
33}