pub struct Cache {
pub which: WhichCache,
pub operation: CacheOp,
pub result: CacheResult,
}Expand description
A cache event.
A cache event has three identifying characteristics:
-
which cache to observe (
which) -
what sort of request it’s handling (
operation) -
whether we want to count all cache accesses, or just misses (
result).
For example, to measure the L1 data cache’s miss rate:
// A `Cache` value representing L1 data cache read accesses.
const ACCESS: Cache = Cache {
which: WhichCache::L1D,
operation: CacheOp::READ,
result: CacheResult::ACCESS,
};
// A `Cache` value representing L1 data cache read misses.
const MISS: Cache = Cache { result: CacheResult::MISS, ..ACCESS };
// Construct a `Group` containing the two new counters, from which we
// can get counts over matching periods of time.
let mut group = Group::new()?;
let access_counter = Builder::new().group(&mut group).kind(ACCESS).build()?;
let miss_counter = Builder::new().group(&mut group).kind(MISS).build()?;Fields§
§which: WhichCacheWhich cache is being monitored? (data, instruction, …)
operation: CacheOpWhat operation is being monitored? (read, write, etc.)
result: CacheResultAll accesses, or just misses?
Trait Implementations§
impl Eq for Cache
impl StructuralPartialEq for Cache
Auto Trait Implementations§
impl Freeze for Cache
impl RefUnwindSafe for Cache
impl Send for Cache
impl Sync for Cache
impl Unpin for Cache
impl UnwindSafe for Cache
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