geopm 3.1.1.dev456+g3ba31824
GEOPM - Global Extensible Open Power Manager
Loading...
Searching...
No Matches
IOUringFallback.hpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2015 - 2024 Intel Corporation
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#ifndef IOURINGFALLBACK_HPP_INCLUDE
7#define IOURINGFALLBACK_HPP_INCLUDE
8
9#include "IOUring.hpp"
10
11#include <functional>
12#include <vector>
13
14namespace geopm
15{
19 class IOUringFallback final : public IOUring
20 {
21 public:
22 IOUringFallback(unsigned entries);
23 virtual ~IOUringFallback();
24
25 void submit() override;
26
27 void prep_read(std::shared_ptr<int> ret, int fd,
28 void *buf, unsigned nbytes, off_t offset) override;
29
30 void prep_write(std::shared_ptr<int> ret, int fd,
31 const void *buf, unsigned nbytes, off_t offset) override;
32
36 static std::unique_ptr<IOUring> make_unique(unsigned entries);
37 private:
38 // Pairs of pointers where operation results are desired, and functions
39 // that perform the operation and forward its return value.
40 using FutureOperation = std::pair<std::shared_ptr<int>, std::function<int()> >;
41 std::vector<FutureOperation> m_operations;
42 };
43}
44#endif // IOURINGFALLBACK_HPP_INCLUDE
Fallback implementation of the IOUring batch interface. This implementation uses queues of individual...
Definition IOUringFallback.hpp:20
virtual ~IOUringFallback()
Definition IOUringFallback.cpp:21
static std::unique_ptr< IOUring > make_unique(unsigned entries)
Create a fallback implementation of IOUring that uses non-batched IO operations, in case we cannot us...
Definition IOUringFallback.cpp:58
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.
Definition IOUringFallback.cpp:46
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.
Definition IOUringFallback.cpp:52
void submit() override
Submit all prepared uring operations in a batch, and wait for all operations to return a result....
Definition IOUringFallback.cpp:25
Definition IOUring.hpp:18
Definition Agg.cpp:20