diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2024-11-27 20:10:19 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2024-12-02 16:39:16 -0500 |
commit | 35c7c72601cee9692846de13117411d80b3d13f6 (patch) | |
tree | c111329c85ef972e536d32d1ff0c00f5f0990142 /src/ioq.h | |
parent | bac8214e90488fd562d29f6fea18ae75ecd9029e (diff) | |
download | bfs-35c7c72601cee9692846de13117411d80b3d13f6.tar.xz |
ioq: Add an ioq_nop() operation for benchmarking
Diffstat (limited to 'src/ioq.h')
-rw-r--r-- | src/ioq.h | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -22,6 +22,8 @@ struct ioq; * I/O queue operations. */ enum ioq_op { + /** ioq_nop(). */ + IOQ_NOP, /** ioq_close(). */ IOQ_CLOSE, /** ioq_opendir(). */ @@ -33,6 +35,16 @@ enum ioq_op { }; /** + * ioq_nop() types. + */ +enum ioq_nop_type { + /** A lightweight nop that avoids syscalls. */ + IOQ_NOP_LIGHT, + /** A heavyweight nop that involves a syscall. */ + IOQ_NOP_HEAVY, +}; + +/** * The I/O queue implementation needs two tag bits in each pointer to a struct * ioq_ent, so we need to ensure at least 4-byte alignment. The natural * alignment is enough on most architectures, but not m68k, so over-align it. @@ -54,6 +66,10 @@ struct ioq_ent { /** Operation-specific arguments. */ union { + /** ioq_nop() args. */ + struct ioq_nop { + enum ioq_nop_type type; + } nop; /** ioq_close() args. */ struct ioq_close { int fd; @@ -98,6 +114,20 @@ struct ioq *ioq_create(size_t depth, size_t nthreads); size_t ioq_capacity(const struct ioq *ioq); /** + * A no-op, for benchmarking. + * + * @ioq + * The I/O queue. + * @type + * The type of operation to perform. + * @ptr + * An arbitrary pointer to associate with the request. + * @return + * 0 on success, or -1 on failure. + */ +int ioq_nop(struct ioq *ioq, enum ioq_nop_type type, void *ptr); + +/** * Asynchronous close(). * * @ioq |