[][src]Struct perf_event::events::Cache

pub struct Cache {
    pub which: WhichCache,
    pub operation: CacheOp,
    pub result: CacheResult,
}

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: WhichCache

Which cache is being monitored? (data, instruction, ...)

operation: CacheOp

What operation is being monitored? (read, write, etc.)

result: CacheResult

All accesses, or just misses?

Trait Implementations

impl Clone for Cache[src]

impl Debug for Cache[src]

impl Eq for Cache[src]

impl From<Cache> for Event[src]

impl PartialEq<Cache> for Cache[src]

impl StructuralEq for Cache[src]

impl StructuralPartialEq for Cache[src]

Auto Trait Implementations

impl RefUnwindSafe for Cache

impl Send for Cache

impl Sync for Cache

impl Unpin for Cache

impl UnwindSafe for Cache

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.