pub struct PerfContextData { /* private fields */ }Expand description
A wrapper around llama_perf_context_data.
Implementations§
Source§impl PerfContextData
impl PerfContextData
Sourcepub fn new(
t_start_ms: f64,
t_load_ms: f64,
t_p_eval_ms: f64,
t_eval_ms: f64,
n_p_eval: i32,
n_eval: i32,
) -> Self
pub fn new( t_start_ms: f64, t_load_ms: f64, t_p_eval_ms: f64, t_eval_ms: f64, n_p_eval: i32, n_eval: i32, ) -> Self
Create a new PerfContextData.
let timings = PerfContextData::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));Sourcepub fn print(ctx: &LlamaContext<'_>)
pub fn print(ctx: &LlamaContext<'_>)
print llama context performance data load time prompt eval time eval time total time
Sourcepub fn t_start_ms(&self) -> f64
pub fn t_start_ms(&self) -> f64
Get the start time in milliseconds.
Sourcepub fn t_p_eval_ms(&self) -> f64
pub fn t_p_eval_ms(&self) -> f64
Get the prompt evaluation time in milliseconds.
Sourcepub fn set_t_start_ms(&mut self, t_start_ms: f64)
pub fn set_t_start_ms(&mut self, t_start_ms: f64)
Set the start time in milliseconds.
Sourcepub fn set_t_load_ms(&mut self, t_load_ms: f64)
pub fn set_t_load_ms(&mut self, t_load_ms: f64)
Set the load time in milliseconds.
Sourcepub fn set_t_p_eval_ms(&mut self, t_p_eval_ms: f64)
pub fn set_t_p_eval_ms(&mut self, t_p_eval_ms: f64)
Set the prompt evaluation time in milliseconds.
Sourcepub fn set_t_eval_ms(&mut self, t_eval_ms: f64)
pub fn set_t_eval_ms(&mut self, t_eval_ms: f64)
Set the evaluation time in milliseconds.
Sourcepub fn set_n_p_eval(&mut self, n_p_eval: i32)
pub fn set_n_p_eval(&mut self, n_p_eval: i32)
Set the number of prompt evaluations.
Sourcepub fn set_n_eval(&mut self, n_eval: i32)
pub fn set_n_eval(&mut self, n_eval: i32)
Set the number of evaluations.
Trait Implementations§
Source§impl Clone for PerfContextData
impl Clone for PerfContextData
Source§fn clone(&self) -> PerfContextData
fn clone(&self) -> PerfContextData
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 PerfContextData
impl Debug for PerfContextData
Source§impl Display for PerfContextData
impl Display for PerfContextData
impl Copy for PerfContextData
Auto Trait Implementations§
impl Freeze for PerfContextData
impl RefUnwindSafe for PerfContextData
impl Send for PerfContextData
impl Sync for PerfContextData
impl Unpin for PerfContextData
impl UnsafeUnpin for PerfContextData
impl UnwindSafe for PerfContextData
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