CacheOptimizedCpuData

Struct CacheOptimizedCpuData 

Source
#[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

Source

pub fn new(cpu_id: CpuId) -> Self

Source

pub fn get_current_thread(&self) -> Option<Arc<Thread>>

Fast path for getting current thread (single atomic read).

Source

pub fn set_current_thread(&self, thread: Option<Arc<Thread>>)

Fast path for setting current thread.

Source

pub fn is_local_queue_empty(&self) -> bool

Check if local run queue is empty (lock-free).

Source

pub fn local_queue_length(&self) -> usize

Get approximate local queue length.

Source

pub fn update_priority_count(&self, priority: u8, delta: isize)

Update priority count for thread scheduling.

Source

pub fn get_priority_count(&self, priority: u8) -> usize

Get thread count for a specific priority level.

Source

pub fn record_schedule(&self)

Record scheduling event.

Source

pub fn record_preemption(&self)

Record preemption event.

Source

pub fn record_yield(&self)

Record yield event.

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, 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.