pub struct RequestGenerator { /* private fields */ }Expand description
Generates requests based on workload configuration
Implementations§
Source§impl RequestGenerator
impl RequestGenerator
pub fn new(workload: WorkloadConfig) -> Self
Sourcepub fn from_dataset<I>(
workload: WorkloadConfig,
dataset_iterator: I,
_total_entries: Option<usize>,
tokenizer: BatchTokenizerFn,
) -> Self
pub fn from_dataset<I>( workload: WorkloadConfig, dataset_iterator: I, _total_entries: Option<usize>, tokenizer: BatchTokenizerFn, ) -> Self
Create a new generator from a dataset iterator Spawns a background thread to read, parse, and batch-tokenize entries in parallel Buffer size controls memory usage (entries buffered ahead of simulation)
Sourcepub fn is_dataset_mode(&self) -> bool
pub fn is_dataset_mode(&self) -> bool
Check if using dataset mode
Sourcepub fn peek_next_arrival_time(&self) -> f64
pub fn peek_next_arrival_time(&self) -> f64
Get the next scheduled arrival time
Sourcepub fn next_if_before(&mut self, current_time: f64) -> Option<Request>
pub fn next_if_before(&mut self, current_time: f64) -> Option<Request>
Get the next request if its arrival time is before the given time Returns None if no request is ready or all requests have been generated
Sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
Check if all requests have been generated
Sourcepub fn on_request_complete(&mut self, completion_time: f64)
pub fn on_request_complete(&mut self, completion_time: f64)
Called when a request completes (for closed-loop pattern) Generates a new request for that “user slot” at the completion time
Sourcepub fn num_generated(&self) -> usize
pub fn num_generated(&self) -> usize
Get number of requests generated so far
Sourcepub fn peek_next_arrival(&self) -> f64
pub fn peek_next_arrival(&self) -> f64
Peek at the next arrival time without generating the request
Auto Trait Implementations§
impl Freeze for RequestGenerator
impl RefUnwindSafe for RequestGenerator
impl Send for RequestGenerator
impl !Sync for RequestGenerator
impl Unpin for RequestGenerator
impl UnsafeUnpin for RequestGenerator
impl UnwindSafe for RequestGenerator
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