pub struct ScopeTracker {
pub active_scopes: ShardedRwLock<ScopeId, ScopeInfo>,
pub completed_scopes: OptimizedMutex<Vec<ScopeInfo>>,
pub scope_hierarchy: OptimizedMutex<ScopeHierarchy>,
pub scope_stack: ShardedRwLock<String, Vec<ScopeId>>,
/* private fields */
}
Expand description
Core scope tracking functionality
Fields§
§active_scopes: ShardedRwLock<ScopeId, ScopeInfo>
Active scopes using sharded storage for better concurrency
completed_scopes: OptimizedMutex<Vec<ScopeInfo>>
Completed scopes for analysis
scope_hierarchy: OptimizedMutex<ScopeHierarchy>
Scope hierarchy relationships
scope_stack: ShardedRwLock<String, Vec<ScopeId>>
Current scope stack per thread using sharded storage
Implementations§
Source§impl ScopeTracker
impl ScopeTracker
Sourcepub fn enter_scope(&self, name: String) -> TrackingResult<ScopeId>
pub fn enter_scope(&self, name: String) -> TrackingResult<ScopeId>
Enter a new scope
Sourcepub fn exit_scope(&self, scope_id: ScopeId) -> TrackingResult<()>
pub fn exit_scope(&self, scope_id: ScopeId) -> TrackingResult<()>
Exit a scope
Sourcepub fn associate_variable(
&self,
variable_name: String,
memory_size: usize,
) -> TrackingResult<()>
pub fn associate_variable( &self, variable_name: String, memory_size: usize, ) -> TrackingResult<()>
Associate a variable with the current scope
Sourcepub fn get_scope_analysis(&self) -> TrackingResult<ScopeAnalysis>
pub fn get_scope_analysis(&self) -> TrackingResult<ScopeAnalysis>
Get current scope analysis
Sourcepub fn get_scope_lifecycle_metrics(
&self,
) -> TrackingResult<Vec<ScopeLifecycleMetrics>>
pub fn get_scope_lifecycle_metrics( &self, ) -> TrackingResult<Vec<ScopeLifecycleMetrics>>
Get scope lifecycle metrics
Sourcepub fn get_all_scopes(&self) -> Vec<ScopeInfo>
pub fn get_all_scopes(&self) -> Vec<ScopeInfo>
Get all scopes (active and completed) for data localization
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ScopeTracker
impl !RefUnwindSafe for ScopeTracker
impl Send for ScopeTracker
impl Sync for ScopeTracker
impl Unpin for ScopeTracker
impl UnwindSafe for ScopeTracker
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more