Ignore:
Timestamp:
Oct 25, 2009, 2:42:57 AM (13 years ago)
Author:
livings124
Message:

smooth out the upload eta the same way as the download eta

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/torrent.c

    r9396 r9397  
    980980    switch( s->activity )
    981981    {
     982        /* etaXLSpeed exists because if we use the piece speed directly,
     983         * brief fluctuations cause the ETA to jump all over the place.
     984         * so, etaXLSpeed is a smoothed-out version of the piece speed
     985         * to dampen the effect of fluctuations */
     986
    982987        case TR_STATUS_DOWNLOAD:
    983             /* etaSpeed exists because if we pieceDownloadSpeed directly,
    984              * brief fluctuations cause the ETA to jump all over the place.
    985              * so, etaSpeed is a smoothed-out version of pieceDownloadSpeed
    986              * to dampen the effect of fluctuations */
    987             if( ( tor->etaSpeedCalculatedAt + 800 ) < now ) {
    988                 tor->etaSpeed = ( ( tor->etaSpeedCalculatedAt + 4000 ) < now )
     988            if( ( tor->etaDLSpeedCalculatedAt + 800 ) < now ) {
     989                tor->etaDLSpeed = ( ( tor->etaDLSpeedCalculatedAt + 4000 ) < now )
    989990                    ? s->pieceDownloadSpeed /* if no recent previous speed, no need to smooth */
    990                     : 0.8*tor->etaSpeed + 0.2*s->pieceDownloadSpeed; /* smooth across 5 readings */
    991                 tor->etaSpeedCalculatedAt = now;
     991                    : 0.8*tor->etaDLSpeed + 0.2*s->pieceDownloadSpeed; /* smooth across 5 readings */
     992                tor->etaDLSpeedCalculatedAt = now;
    992993            }
    993994           
     
    997998                s->eta = TR_ETA_UNKNOWN;
    998999            else
    999                 s->eta = s->leftUntilDone / tor->etaSpeed / 1024.0;
     1000                s->eta = s->leftUntilDone / tor->etaDLSpeed / 1024.0;
    10001001            break;
    10011002
     
    10031004            if( checkSeedRatio )
    10041005            {
     1006                if( ( tor->etaULSpeedCalculatedAt + 800 ) < now ) {
     1007                    tor->etaULSpeed = ( ( tor->etaULSpeedCalculatedAt + 4000 ) < now )
     1008                        ? s->pieceUploadSpeed /* if no recent previous speed, no need to smooth */
     1009                        : 0.8*tor->etaULSpeed + 0.2*s->pieceUploadSpeed; /* smooth across 5 readings */
     1010                    tor->etaULSpeedCalculatedAt = now;
     1011                }
     1012               
    10051013                if( s->pieceUploadSpeed < 0.1 )
    10061014                    s->eta = TR_ETA_UNKNOWN;
    10071015                else
    1008                     s->eta = (downloadedForRatio * (seedRatio - s->ratio)) / s->pieceUploadSpeed / 1024.0;
     1016                    s->eta = (downloadedForRatio * (seedRatio - s->ratio)) / tor->etaULSpeed / 1024.0;
    10091017            }
    10101018            else
Note: See TracChangeset for help on using the changeset viewer.