On Fri, Feb 17, 2023 at 01:21:40PM +0100, anubis23 via rsync wrote: > Hi, > > I've read through the rsync manpage, this mailing list, asked Google and > studied lots of posts on stackexchange.com (stackoverflow, > superuser...), askubuntu.com and some others, concerning rsync's > capabilities of showing progress information. But all I've found was > what I already knew: --progress (or -P) shows a progress information for > *every* file transmitted, --info=progress2 shows an overall progress of > the whole transfer (more useful, but slower, if combined with > --no-inc-recursive/--no-i-r...). > > What I am looking for is a way to show the progress on file-level (like > --progress or -P) but only for files bigger than a certain threshold, > say for example >25 MB for a transfer to a remote host or >250 MB for a > local copy. Printing the progress of files which are transfered within > just one or two seconds is not really necessary. Is this possible? If > not, the best I can imagine, would be a switch, maybe called > "--progress-threshold=x", where 'x' is the threshold level (e.g. 25m for > 25 MB...).
I'd base the threshold on time, not size. Could look like below, though PROGRESS_REPORT_THRESHOLD_MS would need to become an option, and default to 0 (and, if paranoid about time jumps, possibly be explicitly tested against 0) to not change current behaviour. Cheers, Lars diff --git a/progress.c b/progress.c index 87207fbf..22de7723 100644 --- a/progress.c +++ b/progress.c @@ -35,6 +35,7 @@ extern struct file_list *cur_flist; BOOL want_progress_now = False; #define PROGRESS_HISTORY_SECS 5 +#define PROGRESS_REPORT_THRESHOLD_MS 2500 #ifdef GETPGRP_VOID #define GETPGRP_ARG @@ -173,7 +174,9 @@ void end_progress(OFF_T size) rprint_progress(stats.total_transferred_size, stats.total_size, &now, True); } else { - rprint_progress(size, size, &now, True); + /* Do not report progress for "quick" transfers, based on starting time. */ + if (msdiff(&ph_start.time, &now) >= PROGRESS_REPORT_THRESHOLD_MS) + rprint_progress(size, size, &now, True); memset(&ph_start, 0, sizeof ph_start); } } @@ -237,5 +240,9 @@ void show_progress(OFF_T ofs, OFF_T size) return; #endif + /* Do not report progress for "quick" transfers, based on starting time. */ + if (msdiff(&ph_start.time, &now) < PROGRESS_REPORT_THRESHOLD_MS) + return; + rprint_progress(ofs, size, &now, False); } -- 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