Skip to main content

Stats

Struct Stats 

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

What one pass has to say about one function.

Built by the pass as it works, and read by the pass manager afterwards. The events come out in the order they were first recorded rather than sorted, so a pass that records its sites in the order it visits them produces output that reads like the walk.

Implementations§

Source§

impl Stats

Source

pub const fn new() -> Self

Nothing recorded yet, which is what every pass starts from and what a pass that found nothing to do ends with.

Source

pub fn optimized(&mut self, what: &'static str)

Records that the pass rewrote something, once.

Call this at the rewrite and not at the end, because a count kept in a local and written once is a count that is wrong on every early return.

Source

pub fn missed(&mut self, what: &'static str)

Records that the pass could have rewritten something and did not, once.

Source

pub fn note(&mut self, what: &'static str)

Records something that is neither a rewrite nor a missed one, once.

Source

pub fn record(&mut self, kind: Kind, what: &'static str, count: u32)

Adds count to the event with this kind and text, creating it if it is new.

A count of zero does nothing at all, so a pass may add a number it computed without first checking whether the number is zero and without producing an event that says a thing happened no times.

Source

pub fn merge(&mut self, other: &Self)

Takes everything in other into this, keeping the order the two of them are already in.

What the pass manager does across the functions of a module, so that the total for a pass is one set of named counts rather than one per function.

Source

pub fn changed(&self) -> bool

Whether the pass changed the function.

One optimized event is a change and any number of missed and note events is not. This is the whole reason the record is a return value: the pass manager has no other way to find out, so recording the rewrite is not a thing a pass can leave until later.

Source

pub fn is_empty(&self) -> bool

Whether the pass said anything at all.

Source

pub fn events(&self) -> &[Event]

Everything recorded, in the order it first arrived.

Source

pub fn of(&self, kind: Kind) -> impl Iterator<Item = &Event>

Everything of one kind, in the same order.

Source

pub fn count(&self, kind: Kind, what: &str) -> u32

How many times this exact thing was recorded, which is zero when it never was.

Source

pub fn total(&self, kind: Kind) -> u32

How many times anything of this kind was recorded.

Trait Implementations§

Source§

impl Clone for Stats

Source§

fn clone(&self) -> Stats

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 Debug for Stats

Source§

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

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

impl Default for Stats

Source§

fn default() -> Stats

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

impl Eq for Stats

Source§

impl PartialEq for Stats

Source§

fn eq(&self, other: &Stats) -> 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 Stats

Auto Trait Implementations§

§

impl Freeze for Stats

§

impl RefUnwindSafe for Stats

§

impl Send for Stats

§

impl Sync for Stats

§

impl Unpin for Stats

§

impl UnsafeUnpin for Stats

§

impl UnwindSafe for Stats

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

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.