pub struct Prefetcher { /* private fields */ }Expand description
Speculative prefetcher that warms caches ahead of execution.
Implementations§
Source§impl Prefetcher
impl Prefetcher
Sourcepub fn new(config: PrefetchConfig) -> Self
pub fn new(config: PrefetchConfig) -> Self
Create a new prefetcher with the given configuration and an empty call graph.
Sourcepub fn build_call_graph(&mut self, blobs: &[([u8; 32], Vec<[u8; 32]>)])
pub fn build_call_graph(&mut self, blobs: &[([u8; 32], Vec<[u8; 32]>)])
Build (or replace) the internal call graph from blob dependency data.
Sourcepub fn prefetch(&mut self, function_hash: &[u8; 32])
pub fn prefetch(&mut self, function_hash: &[u8; 32])
Enqueue the top-N likely callees for speculative prefetch.
Walks up to max_prefetch_depth levels in the call graph, collecting
callees whose combined weight exceeds min_probability. Hashes are
appended to the internal prefetch queue for the cache layer to consume.
Sourcepub fn get_prefetch_queue(&self) -> Vec<[u8; 32]>
pub fn get_prefetch_queue(&self) -> Vec<[u8; 32]>
Consume and return all hashes currently in the prefetch queue.
Sourcepub fn record_call(&mut self, caller: &[u8; 32], callee: &[u8; 32], count: u64)
pub fn record_call(&mut self, caller: &[u8; 32], callee: &[u8; 32], count: u64)
Record an observed call from caller to callee, updating dynamic weights.
Sourcepub fn stats(&self) -> &PrefetchStats
pub fn stats(&self) -> &PrefetchStats
Return a reference to the current prefetch statistics.
Auto Trait Implementations§
impl Freeze for Prefetcher
impl RefUnwindSafe for Prefetcher
impl Send for Prefetcher
impl Sync for Prefetcher
impl Unpin for Prefetcher
impl UnsafeUnpin for Prefetcher
impl UnwindSafe for Prefetcher
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> 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