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

Function test_update_multishot_timeouts

test/timeout.c:1087–1232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1085}
1086
1087static int test_update_multishot_timeouts(struct io_uring *ring, unsigned long ms)
1088{
1089 struct io_uring_sqe *sqe;
1090 struct io_uring_cqe *cqe;
1091 struct __kernel_timespec ts, ts_upd;
1092 unsigned long long exp_ms, base_ms = 10000;
1093 struct timeval tv1, tv2;
1094 int ret, i, nr = 6;
1095 __u32 mode = 0;
1096
1097 if (no_multishot)
1098 return T_EXIT_SKIP;
1099
1100 msec_to_ts(&ts, base_ms);
1101
1102 msec_to_ts(&ts_upd, ms);
1103 gettimeofday(&tv1, NULL);
1104 gettimeofday(&tv2, NULL);
1105
1106 sqe = io_uring_get_sqe(ring);
1107 if (!sqe) {
1108 fprintf(stderr, "%s: get sqe failed\n", __FUNCTION__);
1109 goto err;
1110 }
1111
1112 msec_to_ts(&ts, base_ms);
1113 io_uring_prep_timeout(sqe, &ts, 0, IORING_TIMEOUT_MULTISHOT);
1114 sqe->user_data = 1;
1115
1116 sqe = io_uring_get_sqe(ring);
1117 if (!sqe) {
1118 fprintf(stderr, "%s: get sqe failed\n", __FUNCTION__);
1119 goto err;
1120 }
1121
1122 io_uring_prep_timeout(sqe, &ts, 0, IORING_TIMEOUT_MULTISHOT);
1123 sqe->user_data = 2;
1124
1125 sqe = io_uring_get_sqe(ring);
1126 if (!sqe) {
1127 fprintf(stderr, "%s: get sqe failed\n", __FUNCTION__);
1128 goto err;
1129 }
1130
1131 io_uring_prep_timeout_update(sqe, &ts_upd, 1, mode);
1132 sqe->user_data = 3;
1133
1134 sqe = io_uring_get_sqe(ring);
1135 if (!sqe) {
1136 fprintf(stderr, "%s: get sqe failed\n", __FUNCTION__);
1137 goto err;
1138 }
1139
1140 io_uring_prep_timeout_update(sqe, &ts_upd, 2, mode);
1141 sqe->user_data = 4;
1142
1143 ret = io_uring_submit(ring);
1144 if (ret == 0) {

Callers 1

mainFunction · 0.85

Calls 4

io_uring_submitFunction · 0.85
msec_to_tsFunction · 0.70
mtime_since_nowFunction · 0.70
io_uring_get_sqeFunction · 0.50

Tested by

no test coverage detected