Skip to content

Commit 1323cbd

Browse files
committed
io_uring: show total session time
1 parent da32f6a commit 1323cbd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/io_uring.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use crate::TCP_SERVER_PORT;
22
use bytesize::ByteSize;
3+
use humantime::format_duration;
34
use simplelog::*;
45
use std::rc::Rc;
56
use std::sync::atomic::{AtomicUsize, Ordering};
@@ -229,6 +230,7 @@ pub async fn io_loop(
229230
.await?;
230231

231232
info!("{} ♾️ Starting to proxy data between TCP and USB...", NAME);
233+
let started = Instant::now();
232234

233235
// `read` and `write` take owned buffers (more on that later), and
234236
// there's no "per-socket" buffer, so they actually take `&self`.
@@ -275,6 +277,11 @@ pub async fn io_loop(
275277
from_stream.abort();
276278
monitor.abort();
277279

280+
info!(
281+
"{} ⌛ session time: {}",
282+
NAME,
283+
format_duration(started.elapsed()).to_string()
284+
);
278285
// stream(s) closed, notify main loop to restart
279286
need_restart.notify_one();
280287
}

0 commit comments

Comments
 (0)