计算剩余下载时间的最佳方式是什么? [英] What's the best way to calculate remaining download time?

查看:846
本文介绍了计算剩余下载时间的最佳方式是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设您想要计算剩余的下载时间,并且具有所需的所有信息,即:文件大小,分辨率大小,剩余大小,时间流逝,瞬时dl速度等。
如何计算剩余的dl时间?



当然,直接的方法是:大小左/瞬间dl速度,或:(时间过去/大小)*剩余大小。
只有第一个将以瞬间速度发生偏差,后者将不适应改变速度。



必须是更聪明的方式要这样做吧?看看你当前用uTorrent下载的盗版软件和音乐。很容易注意到,它比以前提到的简单计算更多。实际上,我注意到有时dl速度下降时,剩下的时间也会下降一段时间直到重新调整。

解决方案



考虑如果我开始同时下载文件时间9其他。我只有正常速度的10%,但通过文件的一半,另外9完成。现在我以10倍的速度下载我开始的速度。我原来的10%的速度不应该是剩下多少时间的因素。



个人来说,我可能会在过去30秒左右的时间内平均使用,并使用它。这应该根据最近的速度进行计算,而不会波动。 30秒可能不是正确的数量,这将需要一些实验来确定一个很好的数量。



另一个选择是设置一种波动阈值在速度变化超过该阈值的情况下,您不进行任何重新计算。例如(随机数,再次需要实验),您可以将阈值设置为10%。然后,如果您以100kb / s的速度下载,则不会重新计算剩余时间,直到下载速度变为低于90kb / s或110kb / s。如果发生这些更改之一,则重新计算时间并设置新阈值。


Let's say you want to calculate the remaining download time, and you have all the information needed, that is: File size, dl'ed size, size left, time elapsed, momentary dl speed, etc'. How would you calculate the remaining dl time?

Ofcourse, the straightforward way would be either: size left/momentary dl speed, or: (time elapsed/dl'ed size)*size left. Only that the first would be subject to deviations in the momentary speed, and the latter wouldn't adapt well to altering speeds.

Must be some smarter way to do that, right? Take a look at the pirated software and music you currently download with uTorrent. It's easy to notice that it does more than the simple calculation mentioned before. Actually, I notices that sometimes when the dl speed drops, the time remaining also drops for a couple of moments until it readjusts.

解决方案

Well, as you said, using the absolutely current download speed isn't a great method, because it tends to fluctuate. However, something like an overall average isn't a great idea either, because there may be large fluctuations there as well.

Consider if I start downloading a file at the same time as 9 others. I'm only getting 10% of my normal speed, but halfway through the file, the other 9 finish. Now I'm downloading at 10x the speed I started at. My original 10% speed shouldn't be a factor in the "how much time is left?" calculation any more.

Personally, I'd probably take an average over the last 30 seconds or so, and use that. That should do calculations based on recent speed, without fluctuating wildly. 30 seconds may not be the right amount, it would take some experimentation to figure out a good amount.

Another option would be to set a sort of "fluctuation threshold", where you don't do any recalculation until the speed changes by more than that threshold. For example (random number, again, would require experimentation), you could set the threshold at 10%. Then, if you're downloading at 100kb/s, you don't recalculate the remaining time until the download speed changes to either below 90kb/s or 110kb/s. If one of those changes happens, the time is recalculated and a new threshold is set.

这篇关于计算剩余下载时间的最佳方式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆