Skip to main content

SqpollIoUring

Struct SqpollIoUring 

Source
pub struct SqpollIoUring { /* private fields */ }
Expand description

IoUring créé avec IORING_SETUP_SQPOLL : un thread kernel scrute la SQ. En régime établi, la soumission ne fait aucun io_uring_enter (juste la publication release) → latence minimale.

Coût : un cœur kernel dédié à scruter. Excellent sous forte charge où le CPU abonde ; mauvais choix sur Pi 4 (cœurs rares). À réserver aux profils où la latence prime (mesure, Principe 5).

Implementations§

Source§

impl SqpollIoUring

Source

pub fn new( entries: NonZeroU32, idle: Duration, cpu: Option<u32>, ) -> Result<Self, Errno>

Crée un ring SQPOLL. idle : délai d’inactivité avant que le thread kernel ne s’endorme (NEED_WAKEUP). cpu : épinglage optionnel du thread (SQ_AFF).

§Errors

[Errno::EPERM] si SQPOLL n’est pas autorisé par la config ; autres erreurs de IoUringBuilder::build.

Source

pub fn submit(&mut self) -> Result<u32, Errno>

Soumet les SQE en attente. En SQPOLL, aucun io_uring_enter n’est émis si le thread kernel est éveillé (il consommera la SQ) ; s’il s’est endormi (IORING_SQ_NEED_WAKEUP), la façade le réveille automatiquement via io_uring_enter(.., SQ_WAKEUP)seule magie cachée, indispensable et documentée. Retourne le nombre de SQE en attente.

§Errors

[Errno::EINTR] remonté tel quel (ADR-021 conv. 2) ; autres errno d’enter.

Source

pub fn submit_nop(&mut self) -> Result<SubmissionToken, Errno>

submit_nop (Temps 1) : prépare un SQE (sans publier — Self::submit ou Self::submit_and_wait publie).

§Errors

Voir IoUring::submit_nop.

Source

pub fn submit_read( &mut self, fd: BorrowedFd<'_>, buffer: Vec<u8>, offset: Option<u64>, ) -> Result<SubmissionToken, Errno>

submit_read (Temps 2a) en mode SQPOLL.

§Errors

Voir IoUring::submit_read.

Source

pub fn submit_and_wait(&mut self, want: u32) -> Result<u32, Errno>

Publie (avec réveil SQPOLL si nécessaire) puis attend au moins want complétions (io_uring_enter(GETEVENTS)). L’attente requiert un syscall (la soumission, elle, peut n’en demander aucun).

§Errors

[Errno::EINTR] remonté tel quel ; autres errno d’enter.

Source

pub fn wait_completion(&mut self) -> Result<Completion, Errno>

wait_completion (Temps 1).

§Errors

Voir IoUring::wait_completion.

Source

pub fn in_flight(&self) -> u32

Nombre d’opérations en vol.

Trait Implementations§

Source§

impl Debug for SqpollIoUring

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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.