Struct ProfileNode

Source
pub struct ProfileNode {
    pub name: &'static str,
    pub calls: Cell<u32>,
    pub total_time: Cell<u64>,
    pub start_time: Cell<u64>,
    pub recursion: Cell<u32>,
    pub parent: Option<Rc<ProfileNode>>,
    pub children: RefCell<Vec<Rc<ProfileNode>>>,
}
Expand description

A single node in the profile tree.

NOTE: While the fields are public and are a cell, it is not advisable to modify them.

Fields§

§name: &'static str§calls: Cell<u32>

Number of calls made to this node.

§total_time: Cell<u64>

Total time in ns used by this node and all of its children.

Computed after the last pending ret.

§start_time: Cell<u64>

Timestamp in ns when the first call was made to this node.

§recursion: Cell<u32>

Number of recursive calls made to this node since the first call.

§parent: Option<Rc<ProfileNode>>

Parent in the profile tree.

§children: RefCell<Vec<Rc<ProfileNode>>>

Child nodes.

Implementations§

Source§

impl ProfileNode

Source

pub fn new(parent: Option<Rc<ProfileNode>>, name: &'static str) -> ProfileNode

Source

pub fn reset(&self)

Reset this node and its children, seting relevant fields to 0.

Source

pub fn make_child( &self, me: Rc<ProfileNode>, name: &'static str, ) -> Rc<ProfileNode>

Create a child named name.

Source

pub fn call(&self)

Enter this profile node.

Source

pub fn ret(&self) -> bool

Return from this profile node, returning true if there are no pending recursive calls.

Source

pub fn print(&self, indent: u32)

Print out the current timing information in a very naive way.

Uses indent to determine how deep to indent the line.

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> 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, 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.