Skip to main content

PprofBuilder

Struct PprofBuilder 

Source
pub struct PprofBuilder {
    pub functions: Vec<Function>,
    /* private fields */
}

Fields§

§functions: Vec<Function>

Implementations§

Source§

impl PprofBuilder

Source

pub fn new( profile_start: SystemTime, duration: Duration, freq_in_hz: u64, ) -> Self

Source

pub fn validate(&self) -> Result<(), PprofError>

Run some validations to ensure that the profile is semantically correct.

Source

pub fn string_id(&self, string: &str) -> Option<i64>

Returns the id for a string in the string table or None if it’s not present.

Source

pub fn get_or_insert_string(&mut self, string: &str) -> i64

Inserts a string in the string table and returns its id.

Source

pub fn add_function(&mut self, func_name: &str, filename: Option<String>) -> u64

Source

pub fn add_line( &mut self, func_name: &str, file_name: Option<String>, line: Option<u32>, ) -> (Line, u64)

Source

pub fn add_location( &mut self, address: u64, mapping_id: u64, lines: Vec<Line>, ) -> u64

Source

pub fn add_mapping( &mut self, id: u64, start: u64, end: u64, offset: u64, filename: &str, build_id: &str, ) -> u64

Adds a memory mapping. The id of the mapping is derived from the hash of the code region and should be unique.

Source

pub fn add_sample( &mut self, location_ids: Vec<u64>, count: i64, labels: &[Label], )

Source

pub fn new_label(&mut self, key: &str, value: LabelStringOrNumber) -> Label

Source

pub fn build(self) -> Profile

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.