Change the algorithm that calculates the average copy speed, so it begins to

display much earlier (two seconds).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35131 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2010-01-17 19:47:22 +00:00
parent bdf7d02094
commit 9589965cbd

View File

@ -783,16 +783,15 @@ BStatusView::UpdateStatus(const char *curItem, off_t itemSize, bool optional)
fLastSpeedReferenceSize = fSizeProcessed;
fLastSpeedReferenceTime = currentTime;
fBytesPerSecond = 0.0;
size_t count = 0;
for (size_t i = 0; i < kBytesPerSecondSlots; i++) {
if (fBytesPerSecondSlot[i] != 0.0)
if (fBytesPerSecondSlot[i] != 0.0) {
fBytesPerSecond += fBytesPerSecondSlot[i];
else {
fBytesPerSecond = 0.0;
break;
count++;
}
}
if (fBytesPerSecond != 0.0)
fBytesPerSecond /= kBytesPerSecondSlots;
if (count > 0)
fBytesPerSecond /= count;
Invalidate();
}