diff options
Diffstat (limited to 'main/openssh/openssh5.9-peaktput.diff')
-rw-r--r-- | main/openssh/openssh5.9-peaktput.diff | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/main/openssh/openssh5.9-peaktput.diff b/main/openssh/openssh5.9-peaktput.diff new file mode 100644 index 0000000000..b376433d8a --- /dev/null +++ b/main/openssh/openssh5.9-peaktput.diff @@ -0,0 +1,75 @@ +From: Timo Teräs <timo.teras@iki.fi> +Date: Tue, 17 Jan 2012 07:45:35 +0000 +Subject: [PATCH 1/2] peakput + +--- + progressmeter.c | 19 ++++++++++++++++++- + 1 files changed, 18 insertions(+), 1 deletions(-) + +diff --git a/progressmeter.c b/progressmeter.c +index 0f95222..6b22511 100644 +--- a/progressmeter.c ++++ b/progressmeter.c +@@ -68,6 +68,8 @@ static time_t last_update; /* last progress update */ + static char *file; /* name of the file being transferred */ + static off_t end_pos; /* ending position of transfer */ + static off_t cur_pos; /* transfer position as of last refresh */ ++static off_t last_pos; ++static off_t max_delta_pos = 0; + static volatile off_t *counter; /* progress counter */ + static long stalled; /* how long we have been stalled */ + static int bytes_per_second; /* current speed in bytes per second */ +@@ -128,12 +130,17 @@ refresh_progress_meter(void) + int hours, minutes, seconds; + int i, len; + int file_len; ++ off_t delta_pos; + + transferred = *counter - cur_pos; + cur_pos = *counter; + now = time(NULL); + bytes_left = end_pos - cur_pos; + ++ delta_pos = cur_pos - last_pos; ++ if (delta_pos > max_delta_pos) ++ max_delta_pos = delta_pos; ++ + if (bytes_left > 0) + elapsed = now - last_update; + else { +@@ -158,7 +165,7 @@ refresh_progress_meter(void) + + /* filename */ + buf[0] = '\0'; +- file_len = win_size - 35; ++ file_len = win_size - 45; + if (file_len > 0) { + len = snprintf(buf, file_len + 1, "\r%s", file); + if (len < 0) +@@ -188,6 +195,15 @@ refresh_progress_meter(void) + (off_t)bytes_per_second); + strlcat(buf, "/s ", win_size); + ++ /* instantaneous rate */ ++ if (bytes_left > 0) ++ format_rate(buf + strlen(buf), win_size - strlen(buf), ++ delta_pos); ++ else ++ format_rate(buf + strlen(buf), win_size - strlen(buf), ++ max_delta_pos); ++ strlcat(buf, "/s ", win_size); ++ + /* ETA */ + if (!transferred) + stalled += elapsed; +@@ -224,6 +240,7 @@ refresh_progress_meter(void) + + atomicio(vwrite, STDOUT_FILENO, buf, win_size - 1); + last_update = now; ++ last_pos = cur_pos; + } + + /*ARGSUSED*/ +-- +1.7.8.3 + |