pub struct Profile { /* private fields */ }Implementations§
Source§impl Profile
impl Profile
pub const INTERNED_EMPTY_STRING: GenerationalId<StringId>
pub fn intern_function( &mut self, name: GenerationalId<StringId>, system_name: GenerationalId<StringId>, filename: GenerationalId<StringId>, ) -> Result<GenerationalId<FunctionId>>
pub fn intern_label_num( &mut self, key: GenerationalId<StringId>, val: i64, unit: GenerationalId<StringId>, ) -> Result<GenerationalId<LabelId>>
pub fn intern_label_str( &mut self, key: GenerationalId<StringId>, val: GenerationalId<StringId>, ) -> Result<GenerationalId<LabelId>>
pub fn intern_labelset( &mut self, labels: &[GenerationalId<LabelId>], ) -> Result<GenerationalId<LabelSetId>>
pub fn intern_location( &mut self, mapping_id: Option<GenerationalId<MappingId>>, function_id: GenerationalId<FunctionId>, address: u64, line: i64, ) -> Result<GenerationalId<LocationId>>
pub fn intern_managed_string( &mut self, s: ManagedStringId, ) -> Result<GenerationalId<StringId>>
pub fn intern_managed_strings( &mut self, s: &[ManagedStringId], out: &mut [GenerationalId<StringId>], ) -> Result<()>
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>>
pub fn intern_sample( &mut self, stacktrace: GenerationalId<StackTraceId>, values: &[i64], labels: GenerationalId<LabelSetId>, timestamp: Option<Timestamp>, ) -> Result<()>
pub fn intern_stacktrace( &mut self, locations: &[GenerationalId<LocationId>], ) -> Result<GenerationalId<StackTraceId>>
pub fn intern_string(&mut self, s: &str) -> Result<GenerationalId<StringId>>
pub fn intern_strings( &mut self, s: &[&str], out: &mut [GenerationalId<StringId>], ) -> Result<()>
Sourcepub fn sample_block(&mut self) -> Result<u64>
pub fn sample_block(&mut self) -> Result<u64>
Prevent any new samples from starting. Returns the number of remaining samples.
pub fn sample_end(&mut self) -> Result<()>
pub fn sample_start(&mut self) -> Result<()>
pub fn samples_active(&mut self) -> Result<u64>
pub fn samples_are_blocked(&mut self) -> Result<bool>
pub fn samples_are_drained(&mut self) -> Result<bool>
Source§impl Profile
Public API
impl Profile
Public API
Sourcepub const COMPRESSION_LEVEL: i32 = 1i32
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.
Sourcepub fn add_endpoint(
&mut self,
local_root_span_id: u64,
endpoint: Cow<'_, str>,
) -> Result<()>
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.
pub fn add_endpoint_count( &mut self, endpoint: Cow<'_, str>, value: i64, ) -> Result<()>
pub fn try_add_sample( &mut self, sample: Sample<'_>, timestamp: Option<Timestamp>, ) -> Result<()>
pub fn add_string_id_sample( &mut self, sample: StringIdSample<'_>, timestamp: Option<Timestamp>, ) -> Result<()>
pub fn add_upscaling_rule( &mut self, offset_values: &[usize], label_name: &str, label_value: &str, upscaling_info: UpscalingInfo, ) -> Result<()>
pub fn get_generation(&self) -> Result<Generation>
pub fn resolve(&mut self, id: ManagedStringId) -> Result<StringId>
Sourcepub fn try_new(
sample_types: &[ValueType<'_>],
period: Option<Period<'_>>,
) -> Result<Self>
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.
pub fn try_with_string_storage( sample_types: &[ValueType<'_>], period: Option<Period<'_>>, string_storage: Arc<Mutex<ManagedStringStorage>>, ) -> Result<Self>
Sourcepub fn reset_and_return_previous(&mut self) -> Result<Profile>
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.
Sourcepub fn serialize_into_compressed_pprof(
self,
end_time: Option<SystemTime>,
duration: Option<Duration>,
) -> Result<EncodedProfile>
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.
pub fn set_start_time(&mut self, start_time: SystemTime) -> Result<()>
pub fn with_start_time(self, start_time: SystemTime) -> Result<Self>
Source§impl Profile
For testing and debugging purposes
impl Profile
For testing and debugging purposes
pub fn only_for_testing_num_aggregated_samples(&self) -> usize
pub fn only_for_testing_num_timestamped_samples(&self) -> usize
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more