Skip to main content

Trace

Struct Trace 

Source
pub struct Trace {
    pub early: &'static str,
    pub late: &'static str,
    pub fentry: bool,
}
Expand description

What a profiler’s hook at the top of every function is called on this platform.

A profiler wants to know which function called which and how often, and the only place a compiler can tell it that is the moment a function is entered. So -pg puts a call there, and what it calls is a routine the runtime provides rather than anything the program wrote.

Two of them, because there are two conventions for the same job and they disagree about where the call goes as well as what it is called. The older one runs once the frame is taken, so the hook can walk back through the frame pointer, which is why it needs one. The newer one runs before the prologue has done anything at all, which is what makes the return address the top thing on the stack and the arguments still in the registers they arrived in, and that is what lets a tracer replace the call with something else while the program runs. Linux’s ftrace is built on exactly that, and it is why every kernel is built with the newer one.

A convention that answers None is one this compiler has no hook for, and a command line that asks for one on such a target is told so rather than quietly given an unprofiled program.

Fields§

§early: &'static str

What is called in front of the prologue, which is what -mfentry asks for.

§late: &'static str

What is called once the frame is taken, which is what -mno-fentry asks for.

§fentry: bool

Which of the two a command line that named neither gets.

Trait Implementations§

Source§

impl Clone for Trace

Source§

fn clone(&self) -> Trace

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 Copy for Trace

Source§

impl Debug for Trace

Source§

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

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

impl Eq for Trace

Source§

impl PartialEq for Trace

Source§

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

Auto Trait Implementations§

§

impl Freeze for Trace

§

impl RefUnwindSafe for Trace

§

impl Send for Trace

§

impl Sync for Trace

§

impl Unpin for Trace

§

impl UnsafeUnpin for Trace

§

impl UnwindSafe for Trace

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.