[Dump] Use new speed calculation algorithm.

This commit is contained in:
2025-11-20 18:57:39 +00:00
parent c1af9a1f96
commit 8b83f9cbbb
10 changed files with 281 additions and 247 deletions

View File

@@ -331,6 +331,7 @@ partial class Dump
_speedStopwatch.Reset();
ulong sectorSpeedStart = 0;
InitProgress?.Invoke();
double elapsed = 0;
for(ulong i = _resume.NextBlock; i < blocks; i += blocksToRead)
{
@@ -355,24 +356,17 @@ partial class Dump
(long)i,
(long)blocks);
_speedStopwatch.Start();
_speedStopwatch.Restart();
sense = _dev.Read6(out readBuffer,
out _,
(uint)i,
blockSize,
(byte)blocksToRead,
_dev.Timeout,
out double cmdDuration);
sense = _dev.Read6(out readBuffer, out _, (uint)i, blockSize, (byte)blocksToRead, _dev.Timeout, out _);
_speedStopwatch.Stop();
totalDuration += cmdDuration;
totalDuration += _speedStopwatch.Elapsed.TotalMilliseconds;
if(!sense && !_dev.Error)
{
mhddLog.Write(i, cmdDuration, blocksToRead);
ibgLog.Write(i, currentSpeed * 1024);
mhddLog.Write(i, _speedStopwatch.Elapsed.TotalMilliseconds, blocksToRead);
_writeStopwatch.Restart();
outputFormat.WriteSectors(readBuffer,
@@ -405,9 +399,12 @@ partial class Dump
for(ulong b = i; b < i + _skip; b++) _resume.BadBlocks.Add(b);
mhddLog.Write(i, cmdDuration < 500 ? 65535 : cmdDuration, _skip);
mhddLog.Write(i,
_speedStopwatch.Elapsed.TotalMilliseconds < 500
? 65535
: _speedStopwatch.Elapsed.TotalMilliseconds,
_skip);
ibgLog.Write(i, 0);
AaruLogging.WriteLine(Localization.Core.Skipping_0_blocks_from_errored_block_1, _skip, i);
i += _skip - blocksToRead;
newTrim = true;
@@ -417,12 +414,12 @@ partial class Dump
sectorSpeedStart += blocksToRead;
_resume.NextBlock = i + blocksToRead;
double elapsed = _speedStopwatch.Elapsed.TotalSeconds;
if(elapsed < 100) continue;
if(elapsed <= 0 || sectorSpeedStart * blockSize < 524288) continue;
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed);
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed / 1000);
ibgLog.Write(i, currentSpeed * 1024);
sectorSpeedStart = 0;
elapsed = 0;
_speedStopwatch.Reset();
}
@@ -432,6 +429,7 @@ partial class Dump
_dumpStopwatch.Stop();
EndProgress?.Invoke();
mhddLog.Close();
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed / 1000);
ibgLog.Close(_dev,
blocks,