Gnutella Forums

Gnutella Forums (https://www.gnutellaforums.com/)
-   New Feature Requests (https://www.gnutellaforums.com/new-feature-requests/)
-   -   My Suggestion: Making Download Times Better (https://www.gnutellaforums.com/new-feature-requests/60210-my-suggestion-making-download-times-better.html)

bsdman August 20th, 2006 09:31 AM

My Suggestion: Making Download Times Better
 
Whenver I download a file, and the other end is very irradic in its connection speed, the estimated time jumps everywhere from 2 minutes to 2 hours, and it changes a couple of times per second. I find it somewhat difficult to know when I need to look at my computer again if I want to leave it running for a while.

I would suggest making download time estimations stable in the face of connection speed variations by displaying a rolling average of the last few file ETAs which continues to change as new ETAs are computed.

I have read some of the code, and as I understand it, my suggestion could be implemented by changing the DownloadDataLine class in the com.limegroup.gnutella.gui.download package as follows:

Code:

/* Beginning on line 786 */
// If we have a valid rate (can't compute if rate is 0),
// then determine how much time (in seconds) is remaining.
if ( _speed > 0) {
        double kbLeft = ((_size/1024.0) -
                (_amountRead/1024.0));
        _timeLeft = newTimeRemaining((int)(kbLeft / _speed));
}

And then, add a new private method to do the rolling average, along with some member data:

Code:

// This member data is for the rolling average.
private final int N = 10; // the number of times to save, adjust at leasure
private boolean full = false; // to only use the average when we have N #s
private int index = 0; // the index for the element to replace in times[]
private int times[] = new int[N]; // the list of times
/**
 * This method calculates the new time remaining based on a rolling average.
 * @author bsdman
 */
private int newTimeRemaining(int anotherTime)
{
        times[index++] = anotherTime;
        if(index == N)
        {
                index = 0;
                full = true;
        }
        if(!full)
                return anotherTime; // since we can't average yet
        // otherwise, take the average
        // TODO this average could probably be written more efficeiently
        long total = 0;
        for(int i = 0; i < N; i++)
                total += times[i];
        return (int)(total/N);
}

I hope my code will be useful for getting it done -- if it works correctly. I haven't had an opportunity to test it yet, but since it compiles and I have faith in my programming skills with regard to such a simple problem, I think it will work.

Any comments are welcome.

Lord of the Rings August 20th, 2006 10:37 AM

I can't remember whether it was LW version 4.9 or 4.10 that introduced that erratic reading of the downld speeds. Perhaps you can submit your code to the LimeWire Beta forums in the Code Submission section. That is a different forum however so you'd need to register there 1st. My thought is your code suggestion may be seen a fraction sooner there.

And yes I already commented about these erratic & sometimes very inaccurate reading of the speeds many months ago in the beta section (now called the LimeWire Beta Archives.) By inaccurate I mean showing speeds that my connection isn't capable of or the addition of all downloads were too high for my connection. There was also some difference/discrepancy between what was shown for individual downlds & total downlds figure shown at the bottom of the interface.


All times are GMT -7. The time now is 04:40 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 ©2011, Crawlability, Inc.

Copyright © 2020 Gnutella Forums.
All Rights Reserved.