Skip to main content

Profiler

Struct Profiler 

Source
pub struct Profiler {
    pub memory: Arc<RwLock<MemoryProfiler>>,
    pub compute: Arc<RwLock<ComputeProfiler>>,
    pub timeline: Arc<RwLock<TimelineProfiler>>,
    /* private fields */
}
Expand description

Unified profiler combining memory, compute, and timeline profiling.

Fields§

§memory: Arc<RwLock<MemoryProfiler>>

Memory profiler instance

§compute: Arc<RwLock<ComputeProfiler>>

Compute profiler instance

§timeline: Arc<RwLock<TimelineProfiler>>

Timeline profiler instance

Implementations§

Source§

impl Profiler

Source

pub fn new() -> Self

Creates a new unified profiler.

Source

pub fn set_enabled(&mut self, enabled: bool)

Enables or disables profiling.

Source

pub fn is_enabled(&self) -> bool

Returns whether profiling is enabled.

Source

pub fn start(&self, name: &str)

Starts profiling an operation.

Source

pub fn stop(&self, name: &str)

Stops profiling an operation.

Source

pub fn record_alloc(&self, name: &str, bytes: usize)

Records a memory allocation.

Source

pub fn record_free(&self, name: &str, bytes: usize)

Records a memory deallocation.

Source

pub fn peak_memory(&self) -> usize

Gets peak memory usage in bytes.

Source

pub fn current_memory(&self) -> usize

Gets current memory usage in bytes.

Source

pub fn total_time(&self, name: &str) -> Duration

Gets the total time spent on an operation.

Source

pub fn avg_time(&self, name: &str) -> Duration

Gets the average time for an operation.

Source

pub fn reset(&self)

Resets all profiling data.

Source

pub fn summary(&self) -> ProfileReport

Generates a summary report.

Source

pub fn print_summary(&self)

Prints a summary to stdout.

Source

pub fn analyze_bottlenecks(&self) -> Vec<Bottleneck>

Analyzes for bottlenecks.

Trait Implementations§

Source§

impl Debug for Profiler

Source§

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

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

impl Default for Profiler

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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.