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

Function __test_nop

test/min-timeout-wait.c:152–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150}
151
152static int __test_nop(struct io_uring *ring, int nr_nops, int min_t, int max_t,
153 unsigned long long_wait, const char *name)
154{
155 struct __kernel_timespec ts;
156 struct io_uring_cqe *cqe;
157 struct timeval tv;
158 int i, ret;
159
160 for (i = 0; i < nr_nops; i++) {
161 struct io_uring_sqe *sqe;
162
163 sqe = io_uring_get_sqe(ring);
164 io_uring_prep_nop(sqe);
165 }
166
167 if (nr_nops)
168 io_uring_submit(ring);
169
170 ts.tv_sec = 0;
171 ts.tv_nsec = long_wait * 1000;
172 gettimeofday(&tv, NULL);
173 ret = io_uring_wait_cqes_min_timeout(ring, &cqe, 4, &ts, 50000, NULL);
174 io_uring_cq_advance(ring, nr_nops);
175 if (nr_nops) {
176 if (ret) {
177 fprintf(stderr, "wait_cqes: %d\n", ret);
178 return T_EXIT_FAIL;
179 }
180 } else {
181 if (ret != -ETIME) {
182 fprintf(stderr, "wait_cqes: %d\n", ret);
183 return T_EXIT_FAIL;
184 }
185 }
186
187 return time_pass(&tv, min_t, max_t, name);
188}
189
190/*
191 * Test doing min_wait for N events, where N/2 events are already available

Callers 5

test_someFunction · 0.85
test_alreadyFunction · 0.85
test_nothingFunction · 0.85
test_min_wait_biggestFunction · 0.85
test_min_wait_equalFunction · 0.85

Calls 4

io_uring_submitFunction · 0.85
time_passFunction · 0.85
io_uring_get_sqeFunction · 0.50

Tested by 5

test_someFunction · 0.68
test_alreadyFunction · 0.68
test_nothingFunction · 0.68
test_min_wait_biggestFunction · 0.68
test_min_wait_equalFunction · 0.68