pub struct TraceSession { /* private fields */ }Expand description
Streaming trace session writing TensorFlow-Profiler-style span JSONL.
Implementations§
Source§impl TraceSession
impl TraceSession
Sourcepub fn open(path: impl AsRef<Path>, run: ProfileRun) -> Result<Self>
pub fn open(path: impl AsRef<Path>, run: ProfileRun) -> Result<Self>
Open a trace and own its single root span until Self::finish.
Sourcepub fn begin_span(
&self,
name: impl Into<String>,
kind: SpanKind,
) -> SpanGuard<'_>
pub fn begin_span( &self, name: impl Into<String>, kind: SpanKind, ) -> SpanGuard<'_>
Begin a nested span; parent is the top of the session span stack (TF Profiler call tree).
Sourcepub fn begin_measurement(&self, name: impl Into<String>) -> SpanGuard<'_>
pub fn begin_measurement(&self, name: impl Into<String>) -> SpanGuard<'_>
Begin the single caller-controlled region used for total-time comparisons.
Sourcepub fn begin_step_span(
&self,
name: impl Into<String>,
step: ExecutionStep,
kind: SpanKind,
) -> SpanGuard<'_>
pub fn begin_step_span( &self, name: impl Into<String>, step: ExecutionStep, kind: SpanKind, ) -> SpanGuard<'_>
Begin a span tagged with a PyTorch-style training step (forward / backward / optimizer).
pub fn elapsed_ns(&self) -> u64
Sourcepub fn record_op(&self, span_id: SpanId, op: OpRecord<'_>) -> Result<()>
pub fn record_op(&self, span_id: SpanId, op: OpRecord<'_>) -> Result<()>
Record a timed op observation attached to span_id.
Sourcepub fn record_tensor(
&self,
span_id: SpanId,
tensor: TensorRecord<'_>,
) -> Result<()>
pub fn record_tensor( &self, span_id: SpanId, tensor: TensorRecord<'_>, ) -> Result<()>
Record tensor metadata and an allocation event.
Sourcepub fn record_memory_alloc(
&self,
span_id: SpanId,
mem: MemoryRecord<'_>,
) -> Result<()>
pub fn record_memory_alloc( &self, span_id: SpanId, mem: MemoryRecord<'_>, ) -> Result<()>
Record an explicit tensor allocation (TensorFlow memory timeline).
Sourcepub fn record_memory_free(
&self,
span_id: SpanId,
mem: MemoryRecord<'_>,
) -> Result<()>
pub fn record_memory_free( &self, span_id: SpanId, mem: MemoryRecord<'_>, ) -> Result<()>
Record an explicit tensor deallocation.
Sourcepub fn record_device_memory(
&self,
device: impl Into<String>,
used_bytes: u64,
free_bytes: u64,
timestamp_ns: Option<u64>,
) -> Result<()>
pub fn record_device_memory( &self, device: impl Into<String>, used_bytes: u64, free_bytes: u64, timestamp_ns: Option<u64>, ) -> Result<()>
Record a device-level memory checkpoint (cudaMemGetInfo-style).
Sourcepub fn record_gradient(
&self,
root: impl Into<String>,
key: impl Into<String>,
state: GradientState,
norm: Option<f64>,
) -> Result<()>
pub fn record_gradient( &self, root: impl Into<String>, key: impl Into<String>, state: GradientState, norm: Option<f64>, ) -> Result<()>
Record one parameter gradient fact from a probe run.
pub fn flush(&self) -> Result<()>
Auto Trait Implementations§
impl !Freeze for TraceSession
impl !RefUnwindSafe for TraceSession
impl !Sync for TraceSession
impl Send for TraceSession
impl Unpin for TraceSession
impl UnsafeUnpin for TraceSession
impl UnwindSafe for TraceSession
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
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