pub struct Cache {
pub which: CacheId,
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 = group.add(&Builder::new(ACCESS))?;
let miss_counter = group.add(&Builder::new(MISS))?;Fields§
§which: CacheIdWhich cache is being monitored? (data, instruction, …)
operation: CacheOpWhat operation is being monitored? (read, write, etc.)
result: CacheResultAll accesses, or just misses?
Trait Implementations§
Source§impl Event for Cache
impl Event for Cache
Source§fn update_attrs(self, attr: &mut perf_event_attr)
fn update_attrs(self, attr: &mut perf_event_attr)
Update the
perf_event_attr struct so that it will record the
requested event. Read moreSource§fn update_attrs_with_data(
self,
attr: &mut perf_event_attr,
) -> Option<Arc<dyn EventData>>
fn update_attrs_with_data( self, attr: &mut perf_event_attr, ) -> Option<Arc<dyn EventData>>
Update the
perf_event_attr struct so that it will record the
requested event. Read moreimpl 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