public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Pavel Begunkov <asml.silence@gmail.com>
To: io-uring@vger.kernel.org
Cc: asml.silence@gmail.com
Subject: [PATCH liburing v2 4/5] examples/send-zc: record time on disconnect
Date: Fri,  2 May 2025 17:54:01 +0100	[thread overview]
Message-ID: <0a9ede715e71e8eef7c169d5a32decfe4437834f.1746204705.git.asml.silence@gmail.com> (raw)
In-Reply-To: <cover.1746204705.git.asml.silence@gmail.com>

Record time even if the other end broke connection, the server can
specify a small timeout, and without the change we won't be able to
print stats at the end.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 examples/send-zerocopy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/examples/send-zerocopy.c b/examples/send-zerocopy.c
index a7465812..be8da2fc 100644
--- a/examples/send-zerocopy.c
+++ b/examples/send-zerocopy.c
@@ -458,7 +458,7 @@ static void do_tx(struct thread_data *td, int domain, int type, int protocol)
 				td->bytes += cqe->res;
 			} else if (cqe->res == -ECONNREFUSED || cqe->res == -EPIPE ||
 				   cqe->res == -ECONNRESET) {
-				fprintf(stderr, "Connection failure\n");
+				printf("Connection failure %i\n", cqe->res);
 				goto out_fail;
 			} else if (cqe->res != -EAGAIN) {
 				t_error(1, cqe->res, "send failed");
@@ -469,9 +469,9 @@ static void do_tx(struct thread_data *td, int domain, int type, int protocol)
 			break;
 	} while ((++loop % 16 != 0) || gettimeofday_ms() < tstart + cfg_runtime_ms);
 
+out_fail:
 	td->dt_ms = gettimeofday_ms() - tstart;
 
-out_fail:
 	shutdown(fd, SHUT_RDWR);
 	if (close(fd))
 		t_error(1, errno, "close");
-- 
2.48.1


  parent reply	other threads:[~2025-05-02 16:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-02 16:53 [PATCH liburing v2 0/5] enchance zc benchmarks Pavel Begunkov
2025-05-02 16:53 ` [PATCH liburing v2 1/5] examples/send-zc: warn about data reordering Pavel Begunkov
2025-05-02 16:53 ` [PATCH liburing v2 2/5] examples/send-zc: option to bind socket to device Pavel Begunkov
2025-05-02 16:54 ` [PATCH liburing v2 3/5] examples/send-zc: optionally fill data with a pattern Pavel Begunkov
2025-05-02 16:54 ` Pavel Begunkov [this message]
2025-05-02 16:54 ` [PATCH liburing v2 5/5] examples/zcrx: be more verbose on verification failure Pavel Begunkov
2025-05-04 16:53 ` [PATCH liburing v2 0/5] enchance zc benchmarks Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0a9ede715e71e8eef7c169d5a32decfe4437834f.1746204705.git.asml.silence@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=io-uring@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox