#[non_exhaustive]pub struct ChiselCounters {
pub cache_hits: u64,
pub cache_misses: u64,
pub pages_allocated: u64,
pub fsync_calls: u64,
}Expand description
Cumulative engine-activity counters since open().
Snapshot semantics: Chisel::counters() returns a value-type copy. The
returned struct does NOT update as the engine continues to do work — read
it again to observe new totals. Counters are cumulative from open; they
reset implicitly on close() + reopen because the underlying PageCache
and PageIo are reconstructed.
Intended use: the bench harness reads counters() before and after each
measurement, reports the delta. General-purpose introspection (debugging,
observability) is also supported — the counters are cheap (Cell<u64>
increment in single-writer code paths).
Fields:
cache_hits—PageCache::getreturned a cached page without disk I/O.cache_misses—PageCache::gethad to load from disk (and validate checksum). Hit rate ishits / (hits + misses).pages_allocated— page allocations, counting BOTH file extensions (PageCache::new_page, a new id past the high-water mark) AND freemap reuses (PageCache::claim_page, a page id freed by a prior committed transaction and handed back out). Reuse is the common case once the handle table / membership index allocate COW pages through the freemap-aware path, so a counter that ignored it would read ~0 for a steady-state mutating workload. The actual disk write happens on the nextflush().fsync_calls—PageIo::fsyncinvocations that SUCCEEDED. Three per Chisel commit (pre-drain flush, data-page flush, then superblock fsync); zero between commits in a normal txn. A failed fsync poisons the engine (I1 / fsyncgate) and is not counted;cache_missesby contrast counts attempted misses even when the subsequent load fails. The asymmetry is intentional — seePageIo::fsyncand I1 in ISSUES.md for the rationale.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.cache_hits: u64§cache_misses: u64§pages_allocated: u64§fsync_calls: u64Trait Implementations§
Source§impl Clone for ChiselCounters
impl Clone for ChiselCounters
Source§fn clone(&self) -> ChiselCounters
fn clone(&self) -> ChiselCounters
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ChiselCounters
impl Debug for ChiselCounters
Source§impl Default for ChiselCounters
impl Default for ChiselCounters
Source§fn default() -> ChiselCounters
fn default() -> ChiselCounters
Returns the “default value” for a type. Read more
impl Eq for ChiselCounters
Source§impl PartialEq for ChiselCounters
impl PartialEq for ChiselCounters
impl StructuralPartialEq for ChiselCounters
Auto Trait Implementations§
impl Freeze for ChiselCounters
impl RefUnwindSafe for ChiselCounters
impl Send for ChiselCounters
impl Sync for ChiselCounters
impl Unpin for ChiselCounters
impl UnsafeUnpin for ChiselCounters
impl UnwindSafe for ChiselCounters
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
Mutably borrows from an owned value. Read more