Changeset 9397 for trunk/libtransmission/torrent.c
- Timestamp:
- Oct 25, 2009, 2:42:57 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/torrent.c
r9396 r9397 980 980 switch( s->activity ) 981 981 { 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 982 987 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 ) 989 990 ? s->pieceDownloadSpeed /* if no recent previous speed, no need to smooth */ 990 : 0.8*tor->eta Speed + 0.2*s->pieceDownloadSpeed; /* smooth across 5 readings */991 tor->eta SpeedCalculatedAt = now;991 : 0.8*tor->etaDLSpeed + 0.2*s->pieceDownloadSpeed; /* smooth across 5 readings */ 992 tor->etaDLSpeedCalculatedAt = now; 992 993 } 993 994 … … 997 998 s->eta = TR_ETA_UNKNOWN; 998 999 else 999 s->eta = s->leftUntilDone / tor->eta Speed / 1024.0;1000 s->eta = s->leftUntilDone / tor->etaDLSpeed / 1024.0; 1000 1001 break; 1001 1002 … … 1003 1004 if( checkSeedRatio ) 1004 1005 { 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 1005 1013 if( s->pieceUploadSpeed < 0.1 ) 1006 1014 s->eta = TR_ETA_UNKNOWN; 1007 1015 else 1008 s->eta = (downloadedForRatio * (seedRatio - s->ratio)) / s->pieceUploadSpeed / 1024.0;1016 s->eta = (downloadedForRatio * (seedRatio - s->ratio)) / tor->etaULSpeed / 1024.0; 1009 1017 } 1010 1018 else
Note: See TracChangeset
for help on using the changeset viewer.