This forum has been archived. All content is frozen. Please use KDE Discuss instead.

ETA calculation

Tags: None
(comma "," separated)
Tanis
Registered Member
Posts
1
Karma
0

ETA calculation

Sun Dec 10, 2006 6:44 pm
Hi.

I have a question about the way ETA is calculated - it looks like it takes average speed calculated for entire torrent's "life". And this is pretty much useless... Since download speed changes quite often, it doesn't tell me anything. I would prefer to see how long should it take to download with current download rate. So, would it be possible to calculate ETA using current download speed (or, rather, based on some sliding time window - for example average from the last minute). In my opinion it would be more useful.

Another thing I wanted to ask about was per torrent speed limit, but I have found topic about that and that this feature is in TODO list - Great :)
imported4-Ivan
Registered Member
Posts
819
Karma
0

Mon Dec 11, 2006 4:36 pm
ETA is calculated per download stage. We switch algorithms in different downloading phases (just started, downloading, near end, end phase etc...) but most of the time ETA is calculated with moving average algorithm.

Note that this applies only to versions >= 2.1beta1
User avatar
bassmadrigal
Registered Member
Posts
113
Karma
0

Thu Dec 14, 2006 3:01 pm
Ivan wrote:Note that this applies only to versions >= 2.1beta1


Good to here, that is one thing that was driving me nuts with ktorrent.

Jeremy
Woosh
Registered Member
Posts
3
Karma
0

Thu Jan 18, 2007 12:01 am
Having an option to switch on only the "actual speed" algorithm would be a nice thing because, after 30%completion the eta is on +1h but hopping down 8 seconds every second (right now). Thats not really usefull.

If you give me a hint where to find that stuff in the source code i'd try to go for it.
imported4-Ivan
Registered Member
Posts
819
Karma
0

Thu Jan 18, 2007 12:54 pm
libktorrent/timeestimator.h /cpp

That's the class responsible for estimating.
Woosh
Registered Member
Posts
3
Karma
0

done

Thu Feb 08, 2007 2:33 am
So, i finally had a little bit of time to look in the source code and changed it, so the ETA is ALWAYS computed by the actual download rate. I just added 2 lines and changed three casts.

So here is what i did with Version 2.1:

In timeestimator.cpp i added lines 66-68
Code: Select all
64:      m_perc = perc;
65:      
66:      m_lastETA = estimateCSA();
67:      return m_lastETA;
68:      
69:      if(s.bytes_downloaded < 1024*1024*100 && sample > 0) // < 100KB


In timeestimator.h id changed line 108
Code: Select all
108:      return (int)floor( (float)s.bytes_left_to_download / (float)s.download_rate );

to
Code: Select all
111:      return (Uint32)floor( (double)s.bytes_left_to_download / (double)s.download_rate );


Now the ETA calculation function estimate() returns the ETA calculated with the actual d/l rate and returns it before it starts the decisions.

Then i recompiled it and replaced the original libktorrent-2.1.so with the new one and everything works fine for me.

If someone wants the source or binary files PM me.

Just one question regarding the GPL: am I allowed to give the recompiled libktorrent-2.1.so and the changed timeestimator.cpp to other people, or what do i have to give them not to violate the GPL?
imported4-Ivan
Registered Member
Posts
819
Karma
0

Thu Feb 08, 2007 7:47 pm
Lots of people have lots of different opinions, we can't satisfy all of them. Majority requested this kind of estimation so I changed it.

But, seeing that we still get this kind of requests I can make ETA configurable through settings. For example, you can choose to use Global AVG speed algorithm, Current speed algorithm or other implemented algorithms in KTorrent settings. That way you can use what you want.
I'll do that, it's very easy since we already have all implementations...

Concerning GPL - don't ask me. I simply don't understand it :)
George
Moderator
Posts
5421
Karma
1

Thu Feb 08, 2007 7:54 pm
You only have to provide the source if you distribute a binary version to somebody else. So if you use it on your own, you don't have to release anything.
Woosh
Registered Member
Posts
3
Karma
0

Thu Feb 08, 2007 8:02 pm
to Ivan:
If it helps, i could take care of the selecting estimation thing. Though i won't have time for it the next two weeks, because i have some tests to write at university.

to Geroge:
so if someone wants to have my altered libktorrent-2.1.so i just have to offer him the source as well, right?

Last edited by Woosh on Thu Feb 08, 2007 9:13 pm, edited 1 time in total.
George
Moderator
Posts
5421
Karma
1

Thu Feb 08, 2007 8:12 pm
Woosh wrote:to Geroge:
so if someone wants to have my altered libktorrent-2.1.so i just have to offer him the source as well, right?


Yeah, something like that, though I'm no lawyer.
imported4-Ivan
Registered Member
Posts
819
Karma
0

Thu Feb 08, 2007 9:40 pm
ETA algorithm is now configurable in advanced settings page. I've just committed. You can choose which algorithm you want, though a KT restart is required since I didn't want to iterate torrents on every settings::apply() for an option that probably won't be used frequently.

Algorithm names may look stupid so if anyone has a suggestion to change them, let me know.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot]