Struct tracy_client::ProfiledAllocator
source · pub struct ProfiledAllocator<T>(/* private fields */);
Expand description
A profiling wrapper around another allocator.
See documentation for std::alloc
for more information about global allocators.
Note that this wrapper will start up the client on the first allocation, if not enabled already.
§Examples
In your executable, add:
#[global_allocator]
static GLOBAL: ProfiledAllocator<std::alloc::System> =
ProfiledAllocator::new(std::alloc::System, 100);
Implementations§
source§impl<T> ProfiledAllocator<T>
impl<T> ProfiledAllocator<T>
sourcepub const fn new(inner_allocator: T, callstack_depth: u16) -> Self
pub const fn new(inner_allocator: T, callstack_depth: u16) -> Self
Construct a new ProfiledAllocator
.
Specifying a non-zero callstack_depth
will enable collection of callstack for this
message. The number provided will limit the number of call frames collected. Note that
enabling callstack collection introduces a non-trivial amount of overhead to each
allocation and deallocation.
Trait Implementations§
source§impl<T: GlobalAlloc> GlobalAlloc for ProfiledAllocator<T>
impl<T: GlobalAlloc> GlobalAlloc for ProfiledAllocator<T>
source§unsafe fn alloc(&self, layout: Layout) -> *mut u8
unsafe fn alloc(&self, layout: Layout) -> *mut u8
Allocates memory as described by the given
layout
. Read moreAuto Trait Implementations§
impl<T> Freeze for ProfiledAllocator<T>where
T: Freeze,
impl<T> RefUnwindSafe for ProfiledAllocator<T>where
T: RefUnwindSafe,
impl<T> Send for ProfiledAllocator<T>where
T: Send,
impl<T> Sync for ProfiledAllocator<T>where
T: Sync,
impl<T> Unpin for ProfiledAllocator<T>where
T: Unpin,
impl<T> UnwindSafe for ProfiledAllocator<T>where
T: UnwindSafe,
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