Print out rsync stats

This commit is contained in:
Kovid Goyal 2021-10-03 13:40:53 +05:30
parent a8e06a67c2
commit 2080b3d7fa
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 14 additions and 1 deletions

View File

@ -49,7 +49,8 @@ and ask for confirmation.
type=bool-set type=bool-set
If a file on the receiving side already exists, use the rsync algorithm to update it to match If a file on the receiving side already exists, use the rsync algorithm to update it to match
the file on the sending side, potentially saving lots of bandwidth and also automatically resuming the file on the sending side, potentially saving lots of bandwidth and also automatically resuming
partial transfers. partial transfers. Note that this will actually degrade performance on fast links with not too
large files, so use with care.
''' '''

View File

@ -252,6 +252,7 @@ class ProgressTracker:
self.transfered_stats_amt = 0 self.transfered_stats_amt = 0
self.transfered_stats_interval = 0. self.transfered_stats_interval = 0.
self.started_at = 0. self.started_at = 0.
self.signature_bytes = 0
self.total_reported_progress = 0 self.total_reported_progress = 0
def change_active_file(self, nf: File) -> None: def change_active_file(self, nf: File) -> None:
@ -414,6 +415,7 @@ class SendManager:
sl = file.signature_loader sl = file.signature_loader
assert sl is not None assert sl is not None
sl.add_chunk(ftc.data) sl.add_chunk(ftc.data)
self.progress.signature_bytes += len(ftc.data)
if ftc.action is Action.end_data: if ftc.action is Action.end_data:
sl.commit() sl.commit()
file.start_delta_calculation() file.start_delta_calculation()
@ -718,6 +720,16 @@ def send_main(cli_opts: TransferCLIOptions, args: List[str]) -> None:
loop = Loop() loop = Loop()
handler = Send(cli_opts, files) handler = Send(cli_opts, files)
loop.loop(handler) loop.loop(handler)
if handler.manager.has_rsync:
tsf = 0
p = handler.manager.progress
for f in files:
if f.ttype is TransmissionType.rsync:
tsf += f.file_size
print(
f'Rsync stats: Delta size: {human_size(p.total_transferred)} Signature size: {human_size(p.signature_bytes)}',
f'Total rsynced files size: {human_size(tsf)}'
)
if handler.failed_files: if handler.failed_files:
print(f'Transfer of {len(handler.failed_files)} out of {len(handler.manager.files)} files failed') print(f'Transfer of {len(handler.failed_files)} out of {len(handler.manager.files)} files failed')
for ff in handler.failed_files: for ff in handler.failed_files: