#[repr(align(64))]pub struct CacheOptimizedCpuData {
pub cpu_id: CpuId,
pub current_thread: AtomicPtr<Thread>,
pub local_queue_head: AtomicUsize,
pub local_queue_tail: AtomicUsize,
pub priority_counts: [AtomicUsize; 11],
pub perf_stats: CacheLinePadded<CpuPerfStats>,
/* private fields */
}
Expand description
Cache-optimized per-CPU scheduler data structure.
Fields§
§cpu_id: CpuId
CPU ID this data belongs to
current_thread: AtomicPtr<Thread>
Currently running thread (hot data)
local_queue_head: AtomicUsize
CPU-local run queue head (frequently accessed)
local_queue_tail: AtomicUsize
§priority_counts: [AtomicUsize; 11]
Thread priority statistics (moderately hot)
perf_stats: CacheLinePadded<CpuPerfStats>
Performance counters (cache line padded)
Implementations§
Source§impl CacheOptimizedCpuData
impl CacheOptimizedCpuData
pub fn new(cpu_id: CpuId) -> Self
Sourcepub fn get_current_thread(&self) -> Option<Arc<Thread>>
pub fn get_current_thread(&self) -> Option<Arc<Thread>>
Fast path for getting current thread (single atomic read).
Sourcepub fn set_current_thread(&self, thread: Option<Arc<Thread>>)
pub fn set_current_thread(&self, thread: Option<Arc<Thread>>)
Fast path for setting current thread.
Sourcepub fn is_local_queue_empty(&self) -> bool
pub fn is_local_queue_empty(&self) -> bool
Check if local run queue is empty (lock-free).
Sourcepub fn local_queue_length(&self) -> usize
pub fn local_queue_length(&self) -> usize
Get approximate local queue length.
Sourcepub fn update_priority_count(&self, priority: u8, delta: isize)
pub fn update_priority_count(&self, priority: u8, delta: isize)
Update priority count for thread scheduling.
Sourcepub fn get_priority_count(&self, priority: u8) -> usize
pub fn get_priority_count(&self, priority: u8) -> usize
Get thread count for a specific priority level.
Sourcepub fn record_schedule(&self)
pub fn record_schedule(&self)
Record scheduling event.
Sourcepub fn record_preemption(&self)
pub fn record_preemption(&self)
Record preemption event.
Sourcepub fn record_yield(&self)
pub fn record_yield(&self)
Record yield event.
Auto Trait Implementations§
impl !Freeze for CacheOptimizedCpuData
impl RefUnwindSafe for CacheOptimizedCpuData
impl Send for CacheOptimizedCpuData
impl Sync for CacheOptimizedCpuData
impl Unpin for CacheOptimizedCpuData
impl !UnwindSafe for CacheOptimizedCpuData
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