-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathio_engine.hpp
More file actions
49 lines (34 loc) · 1.34 KB
/
io_engine.hpp
File metadata and controls
49 lines (34 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef __IO_ENGINE_HPP__
#define __IO_ENGINE_HPP__
#include "simulation.hpp"
#include "utils.hpp"
#include "stream_stat.hpp"
#define DEFAULT_MIN_OP_TIME_IN_MS 1000000.0f
class io_engine_t {
public:
io_engine_t(std::vector<ticks_t> *_latencies, stream_stat_t *_stream_stat, pthread_mutex_t *_latency_mutex)
: config(NULL), fd(0), is_done(NULL), ops(0),
latencies(_latencies), stream_stat(_stream_stat), latency_mutex(_latency_mutex)
{}
virtual int contribute_open_flags();
virtual void post_open_setup();
virtual void pre_close_teardown();
virtual void run_benchmark();
virtual int perform_op(char *buf, long long ops, rnd_gen_t rnd_gen);
virtual void perform_read_op(off64_t offset, char *buf) = 0;
virtual void perform_write_op(off64_t offset, char *buf) = 0;
virtual void perform_trim_op(off64_t offset);
virtual void copy_io_state(io_engine_t *io_engine);
protected:
void push_latency(ticks_t latency);
public:
int fd;
workload_config_t *config;
int *is_done;
long ops;
std::vector<ticks_t> *latencies;
stream_stat_t *stream_stat;
pthread_mutex_t *latency_mutex;
};
io_engine_t* make_engine(io_type_t engine_type, std::vector<ticks_t> *_latencies, stream_stat_t *_stream_stat, pthread_mutex_t *_latency_mutex);
#endif // __IO_ENGINE_HPP__