diff options
-rw-r--r-- | uring.c | 6 | ||||
-rw-r--r-- | uring.h | 3 | ||||
-rw-r--r-- | utils.c | 5 |
3 files changed, 14 insertions, 0 deletions
@@ -16,6 +16,9 @@ struct uring_ev { struct uring_task task; }; +uint64_t sqe_count = 0; +uint64_t cqe_count = 0; + static struct io_uring_sqe * get_sqe(struct cfg *cfg, struct uring_task *task) { @@ -32,6 +35,7 @@ get_sqe(struct cfg *cfg, struct uring_task *task) perrordie("Failed to get an sqe!\n"); } + sqe_count++; uring_task_get(cfg, task); return sqe; } @@ -548,6 +552,8 @@ uring_event_loop(struct cfg *cfg) struct uring_task *task = io_uring_cqe_get_data(cqe); bool do_callback; + cqe_count++; + if (!task) die("%s: null task\n", __func__); @@ -1,6 +1,9 @@ #ifndef foouringhfoo #define foouringhfoo +extern uint64_t sqe_count; +extern uint64_t cqe_count; + void uring_task_refdump(struct uring_task *task); void uring_task_destroy(struct cfg *cfg, struct uring_task *task); @@ -11,9 +11,11 @@ #include <sys/socket.h> #include <netinet/in.h> #include <netinet/tcp.h> +#include <inttypes.h> #include "main.h" #include "utils.h" +#include "uring.h" static unsigned total_malloc_count = 0; static int malloc_count = 0; @@ -156,6 +158,9 @@ debug_resource_usage() fprintf(stderr, "Lost file descriptor(s)\n"); exit(EXIT_FAILURE); } + + fprintf(stderr, "CQEs used: %" PRIu64 ", SQEs used: %" PRIu64 "\n", + cqe_count, sqe_count); } void |