pub struct InferenceProfiler {
pub tokenization_us: u64,
pub forward_pass_us: u64,
pub sampling_us: u64,
pub constraints_us: u64,
pub detokenization_us: u64,
pub step_count: u64,
}Expand description
Profiler for tracking different stages of inference
Fields§
§tokenization_us: u64Time spent in tokenization (microseconds)
forward_pass_us: u64Time spent in model forward pass (microseconds)
sampling_us: u64Time spent in sampling (microseconds)
constraints_us: u64Time spent in constraint enforcement (microseconds)
detokenization_us: u64Time spent in detokenization (microseconds)
step_count: u64Number of profiled steps
Implementations§
Source§impl InferenceProfiler
impl InferenceProfiler
Sourcepub fn record_tokenization(&mut self, duration_us: u64)
pub fn record_tokenization(&mut self, duration_us: u64)
Record tokenization time
Sourcepub fn record_forward_pass(&mut self, duration_us: u64)
pub fn record_forward_pass(&mut self, duration_us: u64)
Record forward pass time
Sourcepub fn record_sampling(&mut self, duration_us: u64)
pub fn record_sampling(&mut self, duration_us: u64)
Record sampling time
Sourcepub fn record_constraints(&mut self, duration_us: u64)
pub fn record_constraints(&mut self, duration_us: u64)
Record constraint enforcement time
Sourcepub fn record_detokenization(&mut self, duration_us: u64)
pub fn record_detokenization(&mut self, duration_us: u64)
Record detokenization time
Sourcepub fn increment_step(&mut self)
pub fn increment_step(&mut self)
Increment step count
Sourcepub fn total_time_us(&self) -> u64
pub fn total_time_us(&self) -> u64
Get total time across all stages
Sourcepub fn breakdown(&self) -> ProfileBreakdown
pub fn breakdown(&self) -> ProfileBreakdown
Get breakdown percentages
Sourcepub fn print_report(&self)
pub fn print_report(&self)
Print profiling report
Trait Implementations§
Source§impl Clone for InferenceProfiler
impl Clone for InferenceProfiler
Source§fn clone(&self) -> InferenceProfiler
fn clone(&self) -> InferenceProfiler
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for InferenceProfiler
impl Debug for InferenceProfiler
Auto Trait Implementations§
impl Freeze for InferenceProfiler
impl RefUnwindSafe for InferenceProfiler
impl Send for InferenceProfiler
impl Sync for InferenceProfiler
impl Unpin for InferenceProfiler
impl UnwindSafe for InferenceProfiler
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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