Skip to content

Commit

Permalink
examples: downloader: Log how fast an upload was
Browse files Browse the repository at this point in the history
  • Loading branch information
dennis-hamester committed Nov 26, 2024
1 parent 0f2f3cc commit dfb9463
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions examples/downloader/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,13 @@ async fn upload(bus: &Handle, args: UploadArgs) -> Result<()> {
.send_item(&Chunk::Done(sha256.to_vec().into()))
.await?;

let duration = time.elapsed();
let mibps = size as f64 / duration.as_secs_f64() / 1024.0 / 1024.0;

println!(
"Upload finished in {} milliseconds.",
time.elapsed().as_millis()
"Upload finished in {} milliseconds ({:.2} MiB/s).",
duration.as_millis(),
mibps
);

Ok(())
Expand Down

0 comments on commit dfb9463

Please sign in to comment.