pub struct TracePerformanceEventManager { /* private fields */ }Expand description
Kernel-wide manager of pid/tid to koid mappings, shared by all recording clients
(system tracing and CPU profiling). Stored in kernel.trace_event_manager.
The manager lives for the lifetime of the Kernel; whether recording is active is
tracked by the session count inside it, not by its presence. Clients start recording
by obtaining a PidKoidSession from TracePerformanceEventManager::open and stop
by dropping it, so overlapping sessions from independent clients compose correctly:
the map is seeded when the first session opens and released when the last one drops,
and cleanup runs on every exit path because it is driven by Drop.
When no session is active, task creation fast-paths out on a single relaxed atomic load with no locks and no allocations.
Implementations§
Source§impl TracePerformanceEventManager
impl TracePerformanceEventManager
Sourcepub fn new(weak_kernel: Weak<Kernel>) -> Self
pub fn new(weak_kernel: Weak<Kernel>) -> Self
Creates a new manager holding a weak reference to the enclosing Kernel.
Sourcepub fn is_recording(&self) -> bool
pub fn is_recording(&self) -> bool
Returns true if at least one session is actively recording mappings.
Sourcepub fn open(self: &Arc<Self>) -> PidKoidSession
pub fn open(self: &Arc<Self>) -> PidKoidSession
Opens a session. When the first session opens, the map is seeded with
all currently running Tasks; tasks created afterwards record themselves via
Task::record_pid_koid_mapping. Recording continues until all active sessions
have been dropped.
Sourcepub fn record(&self, pid: pid_t, tid: tid_t, identity: ZirconIdentity)
pub fn record(&self, pid: pid_t, tid: tid_t, identity: ZirconIdentity)
Records the mapping for one Task if recording is active. Called from Task
creation, after the task’s Zircon thread handle is attached, so the identity is
always complete.
Auto Trait Implementations§
impl !Freeze for TracePerformanceEventManager
impl !RefUnwindSafe for TracePerformanceEventManager
impl !UnwindSafe for TracePerformanceEventManager
impl Send for TracePerformanceEventManager
impl Sync for TracePerformanceEventManager
impl Unpin for TracePerformanceEventManager
impl UnsafeUnpin for TracePerformanceEventManager
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
Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
§impl<F, N> FidlIntoNative<Box<N>> for Fwhere
F: FidlIntoNative<N>,
impl<F, N> FidlIntoNative<Box<N>> for Fwhere
F: FidlIntoNative<N>,
fn fidl_into_native(self) -> Box<N>
§impl<T> InstanceFromServiceTransport<T> for T
impl<T> InstanceFromServiceTransport<T> for T
§fn from_service_transport(handle: T) -> T
fn from_service_transport(handle: T) -> T
T to [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> ⓘ
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> ⓘ
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