From 5bb6e86e0747ce57ab2033d1b878c49d0035dc00 Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Thu, 11 Jun 2020 00:24:14 +0200 Subject: Slightly less log spam --- proxy.c | 4 ++-- uring.c | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/proxy.c b/proxy.c index 630d8d2..9fda0c5 100644 --- a/proxy.c +++ b/proxy.c @@ -22,10 +22,10 @@ format_bytes(char *buf, size_t len, uint64_t val) const char *suffix = "B"; tmp = val * 10; - if (tx > 1152921504606846976ULL) { + if (val > 1152921504606846976ULL) { tmp = val / 115292150460684697ULL; suffix= "EiB"; - } else if (tx > 1125899906842624ULL) { + } else if (val > 1125899906842624ULL) { tmp /= 1125899906842624ULL; suffix = "PiB"; } else if (val > 1099511627776ULL) { diff --git a/uring.c b/uring.c index e6b232e..a2668b0 100644 --- a/uring.c +++ b/uring.c @@ -95,8 +95,10 @@ uring_task_put(struct cfg *cfg, struct uring_task *task) { struct uring_task *parent = task->parent; + /* fprintf(stderr, "%s: called with task %s (0x%p) and refcount %u\n", __func__, task->name, task, task->refcount); + */ task->refcount--; if (task->refcount > 0) @@ -125,8 +127,10 @@ uring_task_put(struct cfg *cfg, struct uring_task *task) void uring_task_get(struct cfg *cfg, struct uring_task *task) { + /* fprintf(stderr, "%s: called with task %s (0x%p) and refcount %u\n", __func__, task->name, task, task->refcount); + */ if (task->refcount < 0) error("Negative refcount!\n"); @@ -143,6 +147,8 @@ uring_task_set_buf(struct uring_task *task, struct uring_task_buf *tbuf) void uring_task_set_fd(struct uring_task *task, int fd) { + fprintf(stderr, "%s: task %s (%p) now uses fd %i\n", + __func__, task->name, task, fd); task->fd = fd; } @@ -539,7 +545,9 @@ uring_event_loop(struct cfg *cfg) io_uring_for_each_cqe(&cfg->uev->uring, head, cqe) { struct uring_task *task = io_uring_cqe_get_data(cqe); - fprintf(stderr, "%s: got CEQ (res: %i, task: 0x%p, cb: 0x%p)\n", __func__, cqe->res, task, task ? task->callback : NULL); + fprintf(stderr, "%s: got CEQ (res: %i, task: %s (%p), cb: %p)\n", + __func__, cqe->res, task ? task->name : "", + task, task ? task->callback : NULL); if (task && task->callback) task->callback(cfg, task, cqe->res); @@ -553,7 +561,7 @@ uring_event_loop(struct cfg *cfg) nr++; } - printf("%s: %u CQEs treated\n", __func__, nr); + //printf("%s: %u CQEs treated\n", __func__, nr); io_uring_cq_advance(&cfg->uev->uring, nr); } } -- cgit v1.2.3