Windows如何确定对文件执行操作所需的时间?

how-does-windows-determine-the-amount-of-time-it-takes-to-perform-an-action-with-a-file-00

The ‘time remaining’ estimations on Windows are enough to drive anyone crazy at times, but have you ever wondered how Windows determines those times? Today’s SuperUser Q&A post has some answers for a curious, yet frustrated, reader’s question.

Windows上的“剩余时间”估计足以使任何人有时发疯,但是您是否想知道Windows如何确定那些时间? 今天的“超级用户问答”帖子为读者提出了一个好奇而又沮丧的问题的答案。

Today’s Question & Answer session comes to us courtesy of SuperUser—a subdivision of Stack Exchange, a community-driven grouping of Q&A web sites.

今天的“问答”环节由SuperUser提供,它是Stack Exchange的一个分支,该社区是由社区驱动的Q&A网站分组。

Windows 8.1 file transfer window screenshot courtesy of im really famecore.

Windows 8.1文件传输窗口截图由im famecore提供

问题 (The Question)

SuperUser reader ‘im really famecore’ wants to know how Windows determines the amount of time it will take to perform an operation with a file:

超级用户阅读器“我真的是famecore”想要了解Windows如何确定执行文件操作所花费的时间:

I wanted to know if there is an equation that Windows uses to determine how long it takes to perform an action with a file such as: deleting, copying, erasing, or installing.

我想知道Windows是否使用方程式来确定对文件执行操作所花费的时间,例如:删除,复制,擦除或安装。

how-does-windows-determine-the-amount-of-time-it-takes-to-perform-an-action-with-a-file-01

For example, when I delete a file and Windows says Time remaining: 18 seconds, how is it calculating this number, and what does it use to calculate it?

例如,当我删除文件并Windows提示“剩余时间:18秒”时 ,它如何计算该数字,以及它是如何计算的?

Does Windows use a special equation to determine the time remaining to perform an operation, or does it just provide a ‘best guess’ estimate?

Windows是否使用特殊方程式来确定执行操作所需的时间,还是仅提供“最佳猜测”估计?

答案 (The Answer)

SuperUser contributors Valmiky Arquissandas and Richard have the answer for us. First up, Valmiky Arquissandas:

超级用户贡献者Valmiky Arquissandas和Richard为我们提供了答案。 首先,Valmiky Arquissandas:

Have you noticed that it usually does not give you any estimates during the first few seconds?

您是否注意到它通常在最初的几秒钟内没有给出任何估计?

That is because during the first few seconds, it just does the operation it has to do. Then, after a short amount of time, it knows how much it has already copied/deleted/etc, and how long it took. That gives you the average speed of the operation.

那是因为在最初的几秒钟内,它只是执行它必须执行的操作。 然后,经过很短的时间,它知道已经复制/删除/等了 多少,花了多长时间 。 这样可以给您平均的操作速度

Then, divide the remaining bytes by the speed, and you have the time it will take to complete the operation.

然后,将剩余的字节除以速度,您就有时间来完成操作。

This is elementary school math. If you want to travel 360 km, and at the end of the first minute you have traveled 1 km, how long will it take you to reach your destination?

这是小学数学。 如果您要行驶360公里,并且在第一分钟结束时已经行驶1公里,那么到达目的地需要多长时间?

Well, the speed is 1 km/minute, so that is 60 km/hour. 360 km divided by 60 km/hour gives you an estimated time of 6 hours (or 360 km / 1 km/minute = 360 minutes = 6 hours). Since you have already traveled for one minute, then the estimated time left is 5 hours and 59 minutes.

好吧,速度为1公里/分钟,因此为60公里/小时。 360公里除以60公里/小时可得出6小时的估算时间(或360公里/ 1公里/分钟= 360分钟= 6小时)。 由于您已经旅行了一分钟,因此估计剩余时间为5小时59分钟。

Substitute travel with copy, km with bytes, and that answers your question.

用副本代替旅行,用字节代替km,就可以回答您的问题。

Different systems have different ways of estimating time. You can take the last minute and the estimates may vary wildly. Or you can take the full time, and if the speed actually changes permanently, your estimates may be far removed from reality. What I described is the simplest method.

不同的系统具有不同的估算时间的方法。 您可以花一分钟时间,估计值可能会有很大差异。 或者,您可以花费全部时间,并且如果速度实际发生永久性变化,则您的估算值可能与实际相差甚远。 我所描述的是最简单的方法。

Followed by the answer from Richard:

随后是Richard的回答:

If you are interested, this question tells you how Windows and OSX formats the time left into the progress bar once it has an idea how long it has remaining.

如果您有兴趣,此问题将告诉您Windows和OSX在知道剩余时间后如何格式化进度条中剩余的时间。

When shortening time expressions in progress dialogs, should they be rounded up or down?

缩短进度对话框中的时间表达式时,应将其四舍五入吗?

Raymond Chen, a developer on the Windows team at Microsoft, confirms this algorithm (see Valmiky’s answer above) in a posting on his blog. He also explains why it can be wrong.

Microsoft Windows团队的开发人员Raymond Chen在其博客中的帖子中证实了该算法( 请参见上面的Valmiky的回答 )。 他还解释了为什么它可能是错误的。

Why does the copy dialog give such horrible estimates?

为什么复制对话框给出了如此可怕的估计?



Have something to add to the explanation? Sound off in the comments. Want to read more answers from other tech-savvy Stack Exchange users? Check out the full discussion thread here.

有什么补充说明吗? 在评论中听起来不错。 是否想从其他精通Stack Exchange的用户那里获得更多答案? 在此处查看完整的讨论线程

翻译自: https://www.howtogeek.com/193373/how-does-windows-determine-the-amount-of-time-it-takes-to-perform-an-action-with-a-file/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值