Hi,
I'm a bit new to rsync, and I recently learnt about the --info=progress2
flag to display complete transfer progress. However while transferring I
encountered some unusually large transfer rates being displayed repeatedly.
I used "rsync -av --info=progress2" to transfer a folder with several large
files. Every time a new file was started , the initial transfer rate was
unusually high (500~ MB/s instead of 30-40) and correspondingly showed an
impossibly small ETA.

It appeared as if rsync was calculating the entire file as transferred in
an instant (resulting in a very high rate displayed), followed by no change
in transfer amount resulting in the speed decaying, reaching actual speed
only when the file actually completes transferring. Although the file-wise
transfer rates displayed after completion are correct, the current file's
speed is always higher than what it should be.

A little bit of digging into the code showed that this was exactly what was
happening. Can someone tell if this was the expected behaviour or this is a
bug that can be fixed? I made a quick patch to try to reverse calculate the
correct transfer rate based on the offsets (find patch attached), which
seems to work correctly for my use-cases.

Regards
Anish
From 84d433a6bf22de336d3e80e0f92a7e12d8e9d360 Mon Sep 17 00:00:00 2001
From: Anish Shankar <rndan...@gmail.com>
Date: Mon, 20 Jan 2014 00:13:36 +0530
Subject: [PATCH] info=progress2 displays wrong transfer rates

info=progress2 sets the entire file size as instantaneously transferred
an shows a huge speed which slows down as file actually transfers.
This results in extremely large speeds and very short ETAs for most of
the time
---
 progress.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/progress.c b/progress.c
index 89ecff1..20106b3 100644
--- a/progress.c
+++ b/progress.c
@@ -177,6 +177,11 @@ void show_progress(OFF_T ofs, OFF_T size)
 
 	gettimeofday(&now, NULL);
 
+	if (INFO_GTE(PROGRESS, 2)) {
+		ofs = stats.total_transferred_size - size + ofs;
+		size = stats.total_size;
+	}
+
 	if (!ph_start.time.tv_sec) {
 		int i;
 
@@ -212,9 +217,5 @@ void show_progress(OFF_T ofs, OFF_T size)
 		return;
 #endif
 
-	if (INFO_GTE(PROGRESS, 2)) {
-		rprint_progress(stats.total_transferred_size,
-				stats.total_size, &now, False);
-	} else
-		rprint_progress(ofs, size, &now, False);
+	rprint_progress(ofs, size, &now, False);
 }
-- 
1.8.5.3

-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

Reply via email to