Profile

Struct Profile 

Source
pub struct Profile { /* private fields */ }

Implementations§

Source§

impl Profile

Source

pub const INTERNED_EMPTY_STRING: GenerationalId<StringId>

Source

pub fn intern_function( &mut self, name: GenerationalId<StringId>, system_name: GenerationalId<StringId>, filename: GenerationalId<StringId>, ) -> Result<GenerationalId<FunctionId>>

Source

pub fn intern_label_num( &mut self, key: GenerationalId<StringId>, val: i64, unit: GenerationalId<StringId>, ) -> Result<GenerationalId<LabelId>>

Source

pub fn intern_label_str( &mut self, key: GenerationalId<StringId>, val: GenerationalId<StringId>, ) -> Result<GenerationalId<LabelId>>

Source

pub fn intern_labelset( &mut self, labels: &[GenerationalId<LabelId>], ) -> Result<GenerationalId<LabelSetId>>

Source

pub fn intern_location( &mut self, mapping_id: Option<GenerationalId<MappingId>>, function_id: GenerationalId<FunctionId>, address: u64, line: i64, ) -> Result<GenerationalId<LocationId>>

Source

pub fn intern_managed_string( &mut self, s: ManagedStringId, ) -> Result<GenerationalId<StringId>>

Source

pub fn intern_managed_strings( &mut self, s: &[ManagedStringId], out: &mut [GenerationalId<StringId>], ) -> Result<()>

Source

pub fn intern_mapping( &mut self, memory_start: u64, memory_limit: u64, file_offset: u64, filename: GenerationalId<StringId>, build_id: GenerationalId<StringId>, ) -> Result<GenerationalId<MappingId>>

Source

pub fn intern_sample( &mut self, stacktrace: GenerationalId<StackTraceId>, values: &[i64], labels: GenerationalId<LabelSetId>, timestamp: Option<Timestamp>, ) -> Result<()>

Source

pub fn intern_stacktrace( &mut self, locations: &[GenerationalId<LocationId>], ) -> Result<GenerationalId<StackTraceId>>

Source

pub fn intern_string(&mut self, s: &str) -> Result<GenerationalId<StringId>>

Source

pub fn intern_strings( &mut self, s: &[&str], out: &mut [GenerationalId<StringId>], ) -> Result<()>

Source

pub fn sample_block(&mut self) -> Result<u64>

Prevent any new samples from starting. Returns the number of remaining samples.

Source

pub fn sample_end(&mut self) -> Result<()>

Source

pub fn sample_start(&mut self) -> Result<()>

Source

pub fn samples_active(&mut self) -> Result<u64>

Source

pub fn samples_are_blocked(&mut self) -> Result<bool>

Source

pub fn samples_are_drained(&mut self) -> Result<bool>

Source§

impl Profile

Public API

Source

pub const COMPRESSION_LEVEL: i32 = 1i32

When testing on some profiles that can’t be shared publicly, level 1 provided better compressed files while taking less or equal time compared to lz4.

Source

pub fn add_endpoint( &mut self, local_root_span_id: u64, endpoint: Cow<'_, str>, ) -> Result<()>

Add the endpoint data to the endpoint mappings. The endpoint string will be interned.

Source

pub fn add_endpoint_count( &mut self, endpoint: Cow<'_, str>, value: i64, ) -> Result<()>

Source

pub fn try_add_sample( &mut self, sample: Sample<'_>, timestamp: Option<Timestamp>, ) -> Result<()>

Source

pub fn add_string_id_sample( &mut self, sample: StringIdSample<'_>, timestamp: Option<Timestamp>, ) -> Result<()>

Source

pub fn add_upscaling_rule( &mut self, offset_values: &[usize], label_name: &str, label_value: &str, upscaling_info: UpscalingInfo, ) -> Result<()>

Source

pub fn get_generation(&self) -> Result<Generation>

Source

pub fn resolve(&mut self, id: ManagedStringId) -> Result<StringId>

Source

pub fn try_new( sample_types: &[ValueType<'_>], period: Option<Period<'_>>, ) -> Result<Self>

Tries to create a profile with the given period. Initializes the string table to hold:

  • “” (the empty string)
  • “local root span id”
  • “trace endpoint”

All other fields are default.

Source

pub fn try_with_string_storage( sample_types: &[ValueType<'_>], period: Option<Period<'_>>, string_storage: Arc<Mutex<ManagedStringStorage>>, ) -> Result<Self>

Source

pub fn reset_and_return_previous(&mut self) -> Result<Profile>

Resets all data except the sample types and period. Returns the previous Profile on success.

Source

pub fn serialize_into_compressed_pprof( self, end_time: Option<SystemTime>, duration: Option<Duration>, ) -> Result<EncodedProfile>

Serialize the aggregated profile, adding the end time and duration.

§Arguments
  • end_time - Optional end time of the profile. Passing None will use the current time.
  • duration - Optional duration of the profile. Passing None will try to calculate the duration based on the end time minus the start time, but under anomalous conditions this may fail as system clocks can be adjusted. The programmer may also accidentally pass an earlier time. The duration will be set to zero these cases.
Source

pub fn set_start_time(&mut self, start_time: SystemTime) -> Result<()>

Source

pub fn with_start_time(self, start_time: SystemTime) -> Result<Self>

Source§

impl Profile

For testing and debugging purposes

Auto Trait Implementations§

§

impl !Freeze for Profile

§

impl !RefUnwindSafe for Profile

§

impl Send for Profile

§

impl !Sync for Profile

§

impl Unpin for Profile

§

impl !UnwindSafe for Profile

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more