MCPcopy Create free account
hub / github.com/axboe/liburing / reap_events

Function reap_events

test/io_uring_enter.c:118–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

116}
117
118static void reap_events(struct io_uring *ring, unsigned nr)
119{
120 int ret;
121 unsigned left = nr;
122 struct io_uring_cqe *cqe;
123 struct iovec *iov;
124 struct timeval start, now, elapsed;
125
126 gettimeofday(&start, NULL);
127 while (left) {
128 ret = io_uring_wait_cqe(ring, &cqe);
129 if (ret < 0) {
130 fprintf(stderr, "io_uring_wait_cqe returned %d\n", ret);
131 exit(1);
132 }
133 if (cqe->res != 4096)
134 fprintf(stderr, "cqe->res: %d, expected 4096\n", cqe->res);
135 iov = io_uring_cqe_get_data(cqe);
136 free(iov->iov_base);
137 free(iov);
138 left--;
139 io_uring_cqe_seen(ring, cqe);
140
141 gettimeofday(&now, NULL);
142 timersub(&now, &start, &elapsed);
143 if (elapsed.tv_sec > 10) {
144 fprintf(stderr, "Timed out waiting for I/Os to complete.\n");
145 fprintf(stderr, "%u expected, %u completed\n", nr, left);
146 break;
147 }
148 }
149}
150
151static void submit_io(struct io_uring *ring, unsigned nr)
152{

Callers 1

mainFunction · 0.70

Calls 1

io_uring_cqe_get_dataFunction · 0.85

Tested by

no test coverage detected