geopm  3.1.1.dev272+gdfb40a8d
GEOPM - Global Extensible Open Power Manager
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
geopm::IOUringImp Class Referencefinal

Implementation of the IOUring batch interface. This implementation batches operations inside io_uring submission queues. More...

#include <IOUringImp.hpp>

Inheritance diagram for geopm::IOUringImp:
Inheritance graph
[legend]
Collaboration diagram for geopm::IOUringImp:
Collaboration graph
[legend]

Public Member Functions

 IOUringImp (unsigned entries)
 
virtual ~IOUringImp ()
 
 IOUringImp (const IOUringImp &other)=delete
 
IOUringImpoperator= (const IOUringImp &other)=delete
 
void submit () override
 Submit all prepared uring operations in a batch, and wait for all operations to return a result. Throws if there are errors interacting with the completion queue. Failures of batched operations are reported by ret from the operation's respective prep_... function call, and do not cause this function to throw. More...
 
void prep_read (std::shared_ptr< int > ret, int fd, void *buf, unsigned nbytes, off_t offset) override
 Perform a pread in the next batch submission. More...
 
void prep_write (std::shared_ptr< int > ret, int fd, const void *buf, unsigned nbytes, off_t offset) override
 Perform a pwrite in the next batch submission. More...
 
- Public Member Functions inherited from geopm::IOUring
 IOUring ()=default
 Create and initialize an IO uring. More...
 
virtual ~IOUring ()=default
 Clean up the IO uring. More...
 

Static Public Member Functions

static bool is_supported ()
 Return whether this implementation of IOUring is supported. More...
 
static std::unique_ptr< IOUringmake_unique (unsigned entries)
 Create an IO uring with queues of a given size. More...
 
- Static Public Member Functions inherited from geopm::IOUring
static std::unique_ptr< IOUringmake_unique (unsigned entries)
 Create an object that supports an io_uring-like interface. The created object uses io_uring if supported, otherwise uses individual read/write operations. More...
 

Protected Member Functions

struct io_uring_sqe * get_sqe_or_throw ()
 
void set_sqe_return_destination (struct io_uring_sqe *sqe, std::shared_ptr< int > destination)
 

Detailed Description

Implementation of the IOUring batch interface. This implementation batches operations inside io_uring submission queues.

Constructor & Destructor Documentation

◆ IOUringImp() [1/2]

geopm::IOUringImp::IOUringImp ( unsigned  entries)

◆ ~IOUringImp()

geopm::IOUringImp::~IOUringImp ( )
virtual

◆ IOUringImp() [2/2]

geopm::IOUringImp::IOUringImp ( const IOUringImp other)
delete

Member Function Documentation

◆ get_sqe_or_throw()

struct io_uring_sqe * geopm::IOUringImp::get_sqe_or_throw ( )
protected

◆ is_supported()

bool geopm::IOUringImp::is_supported ( )
static

Return whether this implementation of IOUring is supported.

◆ make_unique()

std::unique_ptr< IOUring > geopm::IOUringImp::make_unique ( unsigned  entries)
static

Create an IO uring with queues of a given size.

Parameters
entriesMaximum number of queue operations to contain within a single batch submission.

◆ operator=()

IOUringImp& geopm::IOUringImp::operator= ( const IOUringImp other)
delete

◆ prep_read()

void geopm::IOUringImp::prep_read ( std::shared_ptr< int >  ret,
int  fd,
void *  buf,
unsigned  nbytes,
off_t  offset 
)
overridevirtual

Perform a pread in the next batch submission.

Parameters
retWhere to store the operation's return value, which will be a non-negative number of bytes read, or -errno on failure, after submit() returns.
fdWhich already-opened file to read.
bufWhere to store the read data.
nbytesNumber of bytes to read into buf.
offsetOffset within fd to start the pread. -1 uses the existing offset of fd, like in read().
Exceptions
ifthe queue is already full.

Implements geopm::IOUring.

◆ prep_write()

void geopm::IOUringImp::prep_write ( std::shared_ptr< int >  ret,
int  fd,
const void *  buf,
unsigned  nbytes,
off_t  offset 
)
overridevirtual

Perform a pwrite in the next batch submission.

Parameters
retWhere to store the operation's return value, which will be a non-negative number of bytes written, or -errno on failure, after submit() returns.
fdWhich already-opened file to write.
bufWhich data to write to the file.
nbytesNumber of bytes to write from buf.
offsetOffset within fd to start the pwrite. -1 uses the existing offset of fd, like in write().
Exceptions
ifthe queue is already full.

Implements geopm::IOUring.

◆ set_sqe_return_destination()

void geopm::IOUringImp::set_sqe_return_destination ( struct io_uring_sqe *  sqe,
std::shared_ptr< int >  destination 
)
protected

◆ submit()

void geopm::IOUringImp::submit ( )
overridevirtual

Submit all prepared uring operations in a batch, and wait for all operations to return a result. Throws if there are errors interacting with the completion queue. Failures of batched operations are reported by ret from the operation's respective prep_... function call, and do not cause this function to throw.

Implements geopm::IOUring.


The documentation for this class was generated from the following files: