(copy_file_file_display_progress): remove dead code.

(file_op_total_context_t): bps_count member is unused. Remove it.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2024-08-11 15:26:43 +03:00
parent 23ed903814
commit ab5bbba2dd
2 changed files with 6 additions and 18 deletions

View File

@ -1154,25 +1154,14 @@ copy_file_file_display_progress (file_op_total_context_t *tctx, file_op_context_
/* Compute total ETA and BPS */
if (ctx->total_bytes != 0)
{
uintmax_t remain_bytes;
gint64 total_secs;
remain_bytes = ctx->total_bytes - tctx->copied_bytes;
#if 1
{
gint64 total_secs;
total_secs = (tv_current - tctx->transfer_start) / G_USEC_PER_SEC;
total_secs = MAX (1, total_secs);
total_secs = (tv_current - tctx->transfer_start) / G_USEC_PER_SEC;
total_secs = MAX (1, total_secs);
tctx->bps = tctx->copied_bytes / total_secs;
tctx->eta_secs = (tctx->bps != 0) ? remain_bytes / tctx->bps : 0;
}
#else
/* broken on lot of little files */
tctx->bps_count++;
tctx->bps = (tctx->bps * (tctx->bps_count - 1) + ctx->bps) / tctx->bps_count;
tctx->eta_secs = (tctx->bps != 0) ? remain_bytes / tctx->bps : 0;
#endif
tctx->bps = tctx->copied_bytes / total_secs;
const uintmax_t remain_bytes = ctx->total_bytes - tctx->copied_bytes;
tctx->eta_secs = tctx->bps != 0 ? remain_bytes / tctx->bps : 0;
}
}

View File

@ -166,7 +166,6 @@ typedef struct
uintmax_t progress_bytes;
uintmax_t copied_bytes;
size_t bps;
size_t bps_count;
gint64 transfer_start;
double eta_secs;