public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dietmar Maurer <dietmar@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 3/4] tape restore: add restore speed to logs
Date: Mon,  3 May 2021 13:23:36 +0200	[thread overview]
Message-ID: <20210503112337.29879-3-dietmar@proxmox.com> (raw)
In-Reply-To: <20210503112337.29879-1-dietmar@proxmox.com>

---
 src/api2/tape/restore.rs | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/api2/tape/restore.rs b/src/api2/tape/restore.rs
index 97fd822f..2e422cbc 100644
--- a/src/api2/tape/restore.rs
+++ b/src/api2/tape/restore.rs
@@ -698,6 +698,9 @@ fn restore_chunk_archive<'a>(
 
     let verify_and_write_channel = writer_pool.channel();
 
+    let start_time = std::time::SystemTime::now();
+    let mut bytes = 0;
+
     loop {
         let (digest, blob) = match decoder.next_chunk() {
             Ok(Some((digest, blob))) => (digest, blob),
@@ -728,6 +731,7 @@ fn restore_chunk_archive<'a>(
              if verbose {
                 task_log!(worker, "Insert chunk: {}", proxmox::tools::digest_to_hex(&digest));
             }
+            bytes += blob.raw_size();
             verify_and_write_channel.send((blob, digest.clone()))?;
          } else if verbose {
             task_log!(worker, "Found existing chunk: {}", proxmox::tools::digest_to_hex(&digest));
@@ -740,6 +744,15 @@ fn restore_chunk_archive<'a>(
 
     writer_pool.complete()?;
 
+    let elapsed = start_time.elapsed()?.as_secs_f64();
+
+    task_log!(
+        worker,
+        "restored {} bytes ({:.2} MB/s)",
+        bytes,
+        (bytes as f64) / (1_000_000.0 * elapsed)
+    );
+
     Ok(Some(chunks))
 }
 
-- 
2.20.1




  parent reply	other threads:[~2021-05-03 11:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-03 11:23 [pbs-devel] [PATCH proxmox-backup 1/4] tape restore: split restore_chunk_archive Dietmar Maurer
2021-05-03 11:23 ` [pbs-devel] [PATCH proxmox-backup 2/4] tape restore: write datastore in separate thread Dietmar Maurer
2021-05-03 11:23 ` Dietmar Maurer [this message]
2021-05-03 11:23 ` [pbs-devel] [PATCH proxmox-backup 4/4] tape restore: do not verify restored files Dietmar Maurer

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=20210503112337.29879-3-dietmar@proxmox.com \
    --to=dietmar@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal