Skip to main content

MetadataCacheStats

Struct MetadataCacheStats 

Source
pub struct MetadataCacheStats { /* private fields */ }
Expand description

What a file’s metadata cache has done, and what it is holding.

Returned by crate::File::metadata_cache_stats. This is the hdf5-pure counterpart to HDF5’s H5Fget_mdc_hit_rate and H5Fget_mdc_size: entries and bytes are a point-in-time view of occupancy, and the counters are cumulative since the file was opened or since the last reset_metadata_cache_stats.

The reason to look is that MetadataCacheConfig is a budget chosen before a single read has happened, and nothing else reports whether it was the right one:

  • hit_rate says whether the cache is earning its memory.
  • evictions says whether the budget is the binding constraint. A hit rate below expectations with no evictions is not a budget problem, and raising it will not help.
  • oversize_reads says whether max_entry_bytes is turning reads away before they reach the cache at all.
  • invalidations says how much of the cache a read-write session is throwing away with its own writes.

Implementations§

Source§

impl MetadataCacheStats

Source

pub const fn hits(&self) -> u64

Metadata reads served from the cache.

Source

pub const fn misses(&self) -> u64

Metadata reads eligible for the cache that were not in it.

Source

pub const fn oversize_reads(&self) -> u64

Metadata reads that bypassed the cache because they exceed MetadataCacheConfig::max_entry_bytes (or the whole budget).

These are counted apart from misses rather than folded into them: the cache was never offered the read, so charging it as a miss would report a failure at work it could not have done. They still show up in reads.

Source

pub const fn evictions(&self) -> u64

Entries dropped to stay inside MetadataCacheConfig::max_bytes.

Source

pub const fn invalidations(&self) -> u64

Entries dropped because an in-place write overlapped them.

Only a read-write session invalidates; this stays zero on a read-only open. Invalidations approaching misses mean the session is rewriting the metadata it is caching, and a larger budget will not change that.

Source

pub const fn entries(&self) -> usize

Entries currently held.

Against bytes this is the mean entry size, which is what says whether a few large reads are spending the budget; pair it with oversize_reads to see the ones already refused.

Source

pub const fn bytes(&self) -> usize

Bytes currently held, to compare against MetadataCacheConfig::max_bytes.

Source

pub const fn reads(&self) -> u64

Every metadata read through this source: hits, misses, and reads too large to admit.

The last of those three is not in hit_rate’s denominator, so hits() / reads() is a different figure and a lower one.

Source

pub fn hit_rate(&self) -> Option<f64>

The fraction of eligible metadata reads served from the cache, or None before any eligible read has happened.

None rather than C’s 0.0, which H5Fget_mdc_hit_rate also returns for a cache that has missed every access: the two mean opposite things to a caller deciding whether to raise the budget, and only one of them is a reason to.

Trait Implementations§

Source§

impl Clone for MetadataCacheStats

Source§

fn clone(&self) -> MetadataCacheStats

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 Copy for MetadataCacheStats

Source§

impl Debug for MetadataCacheStats

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for MetadataCacheStats

Source§

fn default() -> MetadataCacheStats

Returns the “default value” for a type. Read more
Source§

impl Eq for MetadataCacheStats

Source§

impl PartialEq for MetadataCacheStats

Source§

fn eq(&self, other: &MetadataCacheStats) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for MetadataCacheStats

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, 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> Same for T

Source§

type Output = T

Should always be Self
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.