Enum CallgrindMetrics

Source
#[non_exhaustive]
pub enum CallgrindMetrics {
Show 13 variants Default, CacheMisses, CacheMissRates, CacheHits, CacheHitRates, CacheSim, CacheUse, SystemCalls, BranchSim, WriteBackBehaviour, All, None, SingleEvent(EventKind),
}
Available on crate feature default only.
Expand description

A collection of groups of EventKinds

Callgrind supports a large amount of metrics and their collection can be enabled with various command-line flags. CallgrindMetrics groups these metrics to make it less cumbersome to specify multiple EventKinds at once if necessary.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Default

The default group contains all event kinds except the CallgrindMetrics::CacheMisses, CallgrindMetrics::CacheMissRates, CallgrindMetrics::CacheHitRates and EventKind::Dr, EventKind::Dw. More specifically, the following event kinds and groups in this order:

use iai_callgrind::{CallgrindMetrics, EventKind};

let metrics: Vec<CallgrindMetrics> = vec![
    EventKind::Ir.into(),
    CallgrindMetrics::CacheHits,
    EventKind::TotalRW.into(),
    EventKind::EstimatedCycles.into(),
    CallgrindMetrics::SystemCalls,
    EventKind::Ge.into(),
    CallgrindMetrics::BranchSim,
    CallgrindMetrics::WriteBackBehaviour,
    CallgrindMetrics::CacheUse,
];
§

CacheMisses

The CacheMisses produced by --cache-sim=yes contain the following EventKinds in this order:

use iai_callgrind::{CallgrindMetrics, EventKind};

let metrics: Vec<CallgrindMetrics> = vec![
    EventKind::I1mr.into(),
    EventKind::D1mr.into(),
    EventKind::D1mw.into(),
    EventKind::ILmr.into(),
    EventKind::DLmr.into(),
    EventKind::DLmw.into(),
];
§

CacheMissRates

The cache miss rates calculated from the CallgrindMetrics::CacheMisses produced by --cache-sim:

use iai_callgrind::{CallgrindMetrics, EventKind};

let metrics: Vec<CallgrindMetrics> = vec![
    EventKind::I1MissRate.into(),
    EventKind::D1MissRate.into(),
    EventKind::LLiMissRate.into(),
    EventKind::LLdMissRate.into(),
    EventKind::LLMissRate.into(),
];
§

CacheHits

CacheHits are iai-callgrind specific and calculated from the metrics produced by --cache-sim=yes in this order:

use iai_callgrind::{CallgrindMetrics, EventKind};

let metrics: Vec<CallgrindMetrics> = vec![
    EventKind::L1hits.into(),
    EventKind::LLhits.into(),
    EventKind::RamHits.into(),
];
§

CacheHitRates

The cache hit rates calculated from the CallgrindMetrics::CacheHits:

use iai_callgrind::{CallgrindMetrics, EventKind};

let metrics: Vec<CallgrindMetrics> = vec![
    EventKind::L1HitRate.into(),
    EventKind::LLHitRate.into(),
    EventKind::RamHitRate.into(),
];
§

CacheSim

All metrics produced by --cache-sim=yes including the iai-callgrind specific metrics EventKind::L1hits, EventKind::LLhits, EventKind::RamHits, EventKind::TotalRW, EventKind::EstimatedCycles and miss/hit rates in this order:

use iai_callgrind::{CallgrindMetrics, EventKind};

let metrics: Vec<CallgrindMetrics> = vec![
    EventKind::Dr.into(),
    EventKind::Dw.into(),
    CallgrindMetrics::CacheMisses,
    CallgrindMetrics::CacheMissRates,
    CallgrindMetrics::CacheHits,
    EventKind::TotalRW.into(),
    CallgrindMetrics::CacheHitRates,
    EventKind::EstimatedCycles.into(),
];
§

CacheUse

The metrics produced by --cacheuse=yes in this order:

use iai_callgrind::{CallgrindMetrics, EventKind};

let metrics: Vec<CallgrindMetrics> = vec![
    EventKind::AcCost1.into(),
    EventKind::AcCost2.into(),
    EventKind::SpLoss1.into(),
    EventKind::SpLoss2.into(),
];
§

SystemCalls

SystemCalls are events of the --collect-systime=yes option in this order:

use iai_callgrind::{CallgrindMetrics, EventKind};

let metrics: Vec<CallgrindMetrics> = vec![
    EventKind::SysCount.into(),
    EventKind::SysTime.into(),
    EventKind::SysCpuTime.into(),
];
§

BranchSim

The metrics produced by --branch-sim=yes in this order:

use iai_callgrind::{CallgrindMetrics, EventKind};

let metrics: Vec<CallgrindMetrics> = vec![
    EventKind::Bc.into(),
    EventKind::Bcm.into(),
    EventKind::Bi.into(),
    EventKind::Bim.into(),
];
§

WriteBackBehaviour

All metrics of --simulate-wb=yes in this order:

use iai_callgrind::{CallgrindMetrics, EventKind};

let metrics: Vec<CallgrindMetrics> = vec![
    EventKind::ILdmr.into(),
    EventKind::DLdmr.into(),
    EventKind::DLdmw.into(),
];
§

All

All possible EventKinds in this order:

use iai_callgrind::{CallgrindMetrics, EventKind};

let metrics: Vec<CallgrindMetrics> = vec![
    EventKind::Ir.into(),
    CallgrindMetrics::CacheSim,
    CallgrindMetrics::SystemCalls,
    EventKind::Ge.into(),
    CallgrindMetrics::BranchSim,
    CallgrindMetrics::WriteBackBehaviour,
    CallgrindMetrics::CacheUse,
];
§

None

Selection of no EventKind at all

§

SingleEvent(EventKind)

Specify a single EventKind.

Note that EventKind implements the necessary traits to convert to the CallgrindMetrics::SingleEvent variant which is shorter to write.

§Examples

use iai_callgrind::{CallgrindMetrics, EventKind};

assert_eq!(
    CallgrindMetrics::SingleEvent(EventKind::Ir),
    EventKind::Ir.into()
);

Trait Implementations§

Source§

impl Clone for CallgrindMetrics

Source§

fn clone(&self) -> CallgrindMetrics

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CallgrindMetrics

Source§

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

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

impl Default for CallgrindMetrics

Source§

fn default() -> CallgrindMetrics

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

impl<'de> Deserialize<'de> for CallgrindMetrics

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<CallgrindMetrics, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<EventKind> for CallgrindMetrics

Source§

fn from(value: EventKind) -> CallgrindMetrics

Converts to this type from the input type.
Source§

impl PartialEq for CallgrindMetrics

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for CallgrindMetrics

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Copy for CallgrindMetrics

Source§

impl StructuralPartialEq for CallgrindMetrics

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> 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 = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,