Author: stippi Date: 2010-01-17 20:47:22 +0100 (Sun, 17 Jan 2010) New Revision: 35131 Changeset: http://dev.haiku-os.org/changeset/35131/haiku Modified: haiku/trunk/src/kits/tracker/StatusWindow.cpp Log: Change the algorithm that calculates the average copy speed, so it begins to display much earlier (two seconds). Modified: haiku/trunk/src/kits/tracker/StatusWindow.cpp =================================================================== --- haiku/trunk/src/kits/tracker/StatusWindow.cpp 2010-01-17 19:18:31 UTC (rev 35130) +++ haiku/trunk/src/kits/tracker/StatusWindow.cpp 2010-01-17 19:47:22 UTC (rev 35131) @@ -783,16 +783,15 @@ 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(); }