[UI] Fix speed calculation.

This commit is contained in:
2024-04-26 03:16:36 +01:00
parent 0003093bf0
commit b48545b0b4
11 changed files with 99 additions and 50 deletions

View File

@@ -76,6 +76,7 @@ partial class Dump
var outputFormat = _outputPlugin as IWritableImage;
InitProgress?.Invoke();
_speedStopwatch.Reset();
for(ulong i = _resume.NextBlock; i < blocks; i += blocksToRead)
{
@@ -101,8 +102,10 @@ partial class Dump
Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
(long)i, (long)blocks);
_speedStopwatch.Start();
sense = scsiReader.ReadBlocks(out buffer, i, blocksToRead, out double cmdDuration, out _, out _);
totalDuration += cmdDuration;
_speedStopwatch.Stop();
if(!sense && !_dev.Error)
{
@@ -244,12 +247,12 @@ partial class Dump
double elapsed = _speedStopwatch.Elapsed.TotalSeconds;
if(elapsed <= 0)
if(elapsed <= 0 || sectorSpeedStart * blockSize < 524288)
continue;
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed);
sectorSpeedStart = 0;
_speedStopwatch.Restart();
_speedStopwatch.Reset();
}
_speedStopwatch.Stop();