pub struct LlamaTimings { /* private fields */ }
Expand description

A wrapper around llama_timings.

Implementations§

source§

impl LlamaTimings

source

pub fn new( t_start_ms: f64, t_end_ms: f64, t_load_ms: f64, t_sample_ms: f64, t_p_eval_ms: f64, t_eval_ms: f64, n_sample: i32, n_p_eval: i32, n_eval: i32 ) -> Self

Create a new LlamaTimings.

let timings = LlamaTimings::new(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7, 8, 9);
let timings_str = "load time = 3.00 ms
sample time = 4.00 ms / 7 runs (0.57 ms per token, 1750.00 tokens per second)
prompt eval time = 5.00 ms / 8 tokens (0.62 ms per token, 1600.00 tokens per second)
eval time = 6.00 ms / 9 runs (0.67 ms per token, 1500.00 tokens per second)
total time = 1.00 ms";
assert_eq!(timings_str, format!("{}", timings));
source

pub fn t_start_ms(&self) -> f64

Get the start time in milliseconds.

source

pub fn t_end_ms(&self) -> f64

Get the end time in milliseconds.

source

pub fn t_load_ms(&self) -> f64

Get the load time in milliseconds.

source

pub fn t_sample_ms(&self) -> f64

Get the sample time in milliseconds.

source

pub fn t_p_eval_ms(&self) -> f64

Get the prompt evaluation time in milliseconds.

source

pub fn t_eval_ms(&self) -> f64

Get the evaluation time in milliseconds.

source

pub fn n_sample(&self) -> i32

Get the number of samples.

source

pub fn n_p_eval(&self) -> i32

Get the number of prompt evaluations.

source

pub fn n_eval(&self) -> i32

Get the number of evaluations.

source

pub fn set_t_start_ms(&mut self, t_start_ms: f64)

Set the start time in milliseconds.

source

pub fn set_t_end_ms(&mut self, t_end_ms: f64)

Set the end time in milliseconds.

source

pub fn set_t_load_ms(&mut self, t_load_ms: f64)

Set the load time in milliseconds.

source

pub fn set_t_sample_ms(&mut self, t_sample_ms: f64)

Set the sample time in milliseconds.

source

pub fn set_t_p_eval_ms(&mut self, t_p_eval_ms: f64)

Set the prompt evaluation time in milliseconds.

source

pub fn set_t_eval_ms(&mut self, t_eval_ms: f64)

Set the evaluation time in milliseconds.

source

pub fn set_n_sample(&mut self, n_sample: i32)

Set the number of samples.

source

pub fn set_n_p_eval(&mut self, n_p_eval: i32)

Set the number of prompt evaluations.

source

pub fn set_n_eval(&mut self, n_eval: i32)

Set the number of evaluations.

Trait Implementations§

source§

impl Clone for LlamaTimings

source§

fn clone(&self) -> LlamaTimings

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for LlamaTimings

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for LlamaTimings

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Copy for LlamaTimings

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more