Calculate Time Remaining

后端 未结 16 2651
一生所求
一生所求 2020-12-04 08:22

What\'s a good algorithm for determining the remaining time for something to complete? I know how many total lines there are, and how many have completed already, how shoul

16条回答
  •  天涯浪人
    2020-12-04 09:04

    Generally, you know three things at any point in time while processing:

    1. How many units/chunks/items have been processed up to that point in time (A).
    2. How long it has taken to process those items (B).
    3. The number of remaining items (C).

    Given those items, the estimate (unless the time to process an item is constant) of the remaining time will be

    B * C / A

提交回复
热议问题