mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[UI] Fix speed calculation.
This commit is contained in:
@@ -299,7 +299,7 @@ public partial class Dump
|
||||
var newTrim = false;
|
||||
|
||||
_dumpStopwatch.Restart();
|
||||
_speedStopwatch.Restart();
|
||||
_speedStopwatch.Reset();
|
||||
ulong sectorSpeedStart = 0;
|
||||
InitProgress?.Invoke();
|
||||
|
||||
@@ -327,7 +327,9 @@ public 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();
|
||||
bool error = ataReader.ReadBlocks(out cmdBuf, i, blocksToRead, out duration, out _, out _);
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
_writeStopwatch.Restart();
|
||||
if(!error)
|
||||
@@ -364,12 +366,12 @@ public 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();
|
||||
@@ -570,7 +572,7 @@ public partial class Dump
|
||||
ulong currentBlock = 0;
|
||||
blocks = (ulong)(cylinders * heads * sectors);
|
||||
_dumpStopwatch.Restart();
|
||||
_speedStopwatch.Restart();
|
||||
_speedStopwatch.Reset();
|
||||
ulong sectorSpeedStart = 0;
|
||||
InitProgress?.Invoke();
|
||||
|
||||
@@ -601,9 +603,10 @@ public partial class Dump
|
||||
ByteSize.FromMegabytes(currentSpeed).
|
||||
Per(_oneSecond).
|
||||
Humanize()));
|
||||
|
||||
_speedStopwatch.Start();
|
||||
bool error =
|
||||
ataReader.ReadChs(out cmdBuf, cy, hd, sc, out duration, out recoveredError);
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
totalDuration += duration;
|
||||
|
||||
@@ -643,12 +646,12 @@ public 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,13 +217,13 @@ partial class Dump
|
||||
UpdateProgress?.
|
||||
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 = _dev.ReadCd(out cmdBuf, out senseBuf, firstSectorToRead, blockSize, blocksToRead,
|
||||
MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true,
|
||||
MmcErrorField.None, supportedSubchannel, _dev.Timeout, out cmdDuration);
|
||||
|
||||
totalDuration += cmdDuration;
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
double elapsed;
|
||||
|
||||
// Overcome the track mode change drive error
|
||||
@@ -234,13 +234,13 @@ partial class Dump
|
||||
UpdateProgress?.
|
||||
Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i + r, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)i + r, (long)blocks);
|
||||
|
||||
_speedStopwatch.Start();
|
||||
sense = _dev.ReadCd(out cmdBuf, out senseBuf, (uint)(i + r), blockSize, (uint)sectorsForOffset + 1,
|
||||
MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true,
|
||||
true, MmcErrorField.None, supportedSubchannel, _dev.Timeout, out cmdDuration);
|
||||
|
||||
totalDuration += cmdDuration;
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
mhddLog.Write(i + r, cmdDuration);
|
||||
@@ -313,17 +313,15 @@ partial class Dump
|
||||
|
||||
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.Restart();
|
||||
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
if(cdiReadyReadAsAudio)
|
||||
@@ -424,12 +422,12 @@ partial class Dump
|
||||
|
||||
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();
|
||||
|
||||
@@ -128,8 +128,6 @@ partial class Dump
|
||||
|
||||
for(ulong i = _resume.NextBlock; (long)i <= lastSector; i += blocksToRead)
|
||||
{
|
||||
_speedStopwatch.Restart();
|
||||
|
||||
if(_aborted)
|
||||
{
|
||||
currentTry.Extents = ExtentsConverter.ToMetadata(extents);
|
||||
@@ -280,18 +278,22 @@ partial class Dump
|
||||
|
||||
if(_supportsPlextorD8 && !inData)
|
||||
{
|
||||
_speedStopwatch.Start();
|
||||
sense = ReadPlextorWithSubchannel(out cmdBuf, out senseBuf, firstSectorToRead, blockSize, blocksToRead,
|
||||
supportedPlextorSubchannel, out cmdDuration);
|
||||
|
||||
totalDuration += cmdDuration;
|
||||
_speedStopwatch.Stop();
|
||||
}
|
||||
else if(readcd)
|
||||
{
|
||||
if(inData)
|
||||
{
|
||||
_speedStopwatch.Start();
|
||||
sense = _dev.ReadCd(out cmdBuf, out senseBuf, firstSectorToRead, blockSize, blocksToRead,
|
||||
MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true,
|
||||
true, MmcErrorField.None, supportedSubchannel, _dev.Timeout, out cmdDuration);
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
if(sense)
|
||||
{
|
||||
@@ -305,10 +307,12 @@ partial class Dump
|
||||
// Go one for one as the drive does not tell us which one failed
|
||||
for(var bi = 0; bi < blocksToRead; bi++)
|
||||
{
|
||||
_speedStopwatch.Start();
|
||||
sense = _dev.ReadCd(out cmdBuf, out senseBuf, (uint)(firstSectorToRead + bi), blockSize,
|
||||
1, MmcSectorTypes.AllTypes, false, false, true,
|
||||
MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None,
|
||||
supportedSubchannel, _dev.Timeout, out double cmdDuration2);
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
cmdDuration += cmdDuration2;
|
||||
|
||||
@@ -348,10 +352,12 @@ partial class Dump
|
||||
// Drive definitively didn't like to read everything so just do something clever...
|
||||
|
||||
// Try again
|
||||
_speedStopwatch.Start();
|
||||
sense = _dev.ReadCd(out cmdBuf, out senseBuf, firstSectorToRead, blockSize, blocksToRead,
|
||||
MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders,
|
||||
true, true, MmcErrorField.None, supportedSubchannel, _dev.Timeout,
|
||||
out cmdDuration);
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
if(sense)
|
||||
|
||||
@@ -359,10 +365,12 @@ partial class Dump
|
||||
{
|
||||
for(uint bi = blocksToRead; bi > 0; bi--)
|
||||
{
|
||||
_speedStopwatch.Start();
|
||||
sense = _dev.ReadCd(out cmdBuf, out senseBuf, firstSectorToRead, blockSize, bi,
|
||||
MmcSectorTypes.AllTypes, false, false, true,
|
||||
MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None,
|
||||
supportedSubchannel, _dev.Timeout, out cmdDuration);
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
if(sense)
|
||||
continue;
|
||||
@@ -377,9 +385,11 @@ partial class Dump
|
||||
}
|
||||
else
|
||||
{
|
||||
_speedStopwatch.Start();
|
||||
sense = _dev.ReadCd(out cmdBuf, out senseBuf, firstSectorToRead, blockSize, blocksToRead,
|
||||
MmcSectorTypes.Cdda, false, false, false, MmcHeaderCodes.None, true, false,
|
||||
MmcErrorField.None, supportedSubchannel, _dev.Timeout, out cmdDuration);
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
if(sense)
|
||||
{
|
||||
@@ -388,10 +398,12 @@ partial class Dump
|
||||
// Try to workaround firmware
|
||||
if(decSense is { ASC: 0x11, ASCQ: 0x05 } || decSense?.ASC == 0x64)
|
||||
{
|
||||
_speedStopwatch.Start();
|
||||
sense = _dev.ReadCd(out cmdBuf, out _, firstSectorToRead, blockSize, blocksToRead,
|
||||
MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders,
|
||||
true, true, MmcErrorField.None, supportedSubchannel, _dev.Timeout,
|
||||
out double cmdDuration2);
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
cmdDuration += cmdDuration2;
|
||||
}
|
||||
@@ -402,23 +414,31 @@ partial class Dump
|
||||
}
|
||||
else if(read16)
|
||||
{
|
||||
_speedStopwatch.Start();
|
||||
sense = _dev.Read16(out cmdBuf, out senseBuf, 0, false, false, false, firstSectorToRead, blockSize, 0,
|
||||
blocksToRead, false, _dev.Timeout, out cmdDuration);
|
||||
_speedStopwatch.Stop();
|
||||
}
|
||||
else if(read12)
|
||||
{
|
||||
_speedStopwatch.Start();
|
||||
sense = _dev.Read12(out cmdBuf, out senseBuf, 0, false, false, false, false, firstSectorToRead,
|
||||
blockSize, 0, blocksToRead, false, _dev.Timeout, out cmdDuration);
|
||||
_speedStopwatch.Stop();
|
||||
}
|
||||
else if(read10)
|
||||
{
|
||||
_speedStopwatch.Start();
|
||||
sense = _dev.Read10(out cmdBuf, out senseBuf, 0, false, false, false, false, firstSectorToRead,
|
||||
blockSize, 0, (ushort)blocksToRead, _dev.Timeout, out cmdDuration);
|
||||
_speedStopwatch.Stop();
|
||||
}
|
||||
else if(read6)
|
||||
{
|
||||
_speedStopwatch.Start();
|
||||
sense = _dev.Read6(out cmdBuf, out senseBuf, firstSectorToRead, blockSize, (byte)blocksToRead,
|
||||
_dev.Timeout, out cmdDuration);
|
||||
_speedStopwatch.Stop();
|
||||
}
|
||||
|
||||
double elapsed;
|
||||
@@ -426,8 +446,6 @@ partial class Dump
|
||||
// Overcome the track mode change drive error
|
||||
if(inData && !nextData && sense)
|
||||
{
|
||||
_speedStopwatch.Restart();
|
||||
|
||||
for(uint r = 0; r < blocksToRead; r++)
|
||||
{
|
||||
UpdateProgress?.
|
||||
@@ -441,10 +459,12 @@ partial class Dump
|
||||
if(offsetBytes < 0)
|
||||
adjustment = -sectorsForOffset;
|
||||
|
||||
_speedStopwatch.Start();
|
||||
sense = ReadPlextorWithSubchannel(out cmdBuf, out senseBuf,
|
||||
(uint)(firstSectorToRead + r + adjustment), blockSize,
|
||||
(uint)sectorsForOffset + 1, supportedPlextorSubchannel,
|
||||
out cmdDuration);
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
totalDuration += cmdDuration;
|
||||
|
||||
@@ -461,32 +481,42 @@ partial class Dump
|
||||
}
|
||||
else if(readcd)
|
||||
{
|
||||
_speedStopwatch.Start();
|
||||
sense = _dev.ReadCd(out cmdBuf, out senseBuf, (uint)(i + r), blockSize, 1,
|
||||
MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders,
|
||||
true, true, MmcErrorField.None, supportedSubchannel, _dev.Timeout,
|
||||
out cmdDuration);
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
totalDuration += cmdDuration;
|
||||
}
|
||||
else if(read16)
|
||||
{
|
||||
_speedStopwatch.Start();
|
||||
sense = _dev.Read16(out cmdBuf, out senseBuf, 0, false, true, false, i + r, blockSize, 0, 1,
|
||||
false, _dev.Timeout, out cmdDuration);
|
||||
_speedStopwatch.Stop();
|
||||
}
|
||||
else if(read12)
|
||||
{
|
||||
_speedStopwatch.Start();
|
||||
sense = _dev.Read12(out cmdBuf, out senseBuf, 0, false, true, false, false, (uint)(i + r),
|
||||
blockSize, 0, 1, false, _dev.Timeout, out cmdDuration);
|
||||
_speedStopwatch.Stop();
|
||||
}
|
||||
else if(read10)
|
||||
{
|
||||
_speedStopwatch.Start();
|
||||
sense = _dev.Read10(out cmdBuf, out senseBuf, 0, false, true, false, false, (uint)(i + r),
|
||||
blockSize, 0, 1, _dev.Timeout, out cmdDuration);
|
||||
_speedStopwatch.Stop();
|
||||
}
|
||||
else if(read6)
|
||||
{
|
||||
_speedStopwatch.Start();
|
||||
sense = _dev.Read6(out cmdBuf, out senseBuf, (uint)(i + r), blockSize, 1, _dev.Timeout,
|
||||
out cmdDuration);
|
||||
_speedStopwatch.Stop();
|
||||
}
|
||||
|
||||
if(!sense && !_dev.Error)
|
||||
@@ -628,12 +658,12 @@ partial class Dump
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
continue;
|
||||
@@ -810,12 +840,12 @@ partial class Dump
|
||||
|
||||
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();
|
||||
|
||||
@@ -286,9 +286,10 @@ public partial class Dump
|
||||
Invoke(string.Format(Localization.Core.Reading_byte_0_of_1_2, i * 512, romSize, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)i * 512, romSize);
|
||||
|
||||
_speedStopwatch.Start();
|
||||
sense = _dev.Read10(out readBuffer, out senseBuf, 0, false, true, false, false, (uint)(startSector + i),
|
||||
512, 0, (ushort)blocksToRead, _dev.Timeout, out double cmdDuration);
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
totalDuration += cmdDuration;
|
||||
|
||||
_writeStopwatch.Restart();
|
||||
@@ -317,12 +318,12 @@ public partial class Dump
|
||||
|
||||
double elapsed = _speedStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
if(elapsed <= 0)
|
||||
if(elapsed <= 0 || sectorSpeedStart * 512 < 524288)
|
||||
continue;
|
||||
|
||||
currentSpeed = sectorSpeedStart * 512 / (1048576 * elapsed);
|
||||
sectorSpeedStart = 0;
|
||||
_speedStopwatch.Restart();
|
||||
_speedStopwatch.Reset();
|
||||
}
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
@@ -348,7 +348,7 @@ partial class Dump
|
||||
}
|
||||
|
||||
var newTrim = false;
|
||||
_speedStopwatch.Restart();
|
||||
_speedStopwatch.Reset();
|
||||
ulong sectorSpeedStart = 0;
|
||||
InitProgress?.Invoke();
|
||||
|
||||
@@ -376,8 +376,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 = _dev.Read6(out readBuffer, out _, (uint)i, blockSize, (byte)blocksToRead, _dev.Timeout,
|
||||
out double cmdDuration);
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
totalDuration += cmdDuration;
|
||||
|
||||
@@ -422,12 +424,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();
|
||||
|
||||
@@ -212,8 +212,10 @@ public partial class Dump
|
||||
Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)i, blocks);
|
||||
|
||||
_speedStopwatch.Start();
|
||||
sense = _dev.Read12(out readBuffer, out senseBuf, 0, false, true, false, false, (uint)i, blockSize, 0,
|
||||
blocksToRead, false, _dev.Timeout, out double cmdDuration);
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
totalDuration += cmdDuration;
|
||||
|
||||
@@ -260,12 +262,12 @@ public 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();
|
||||
|
||||
@@ -206,7 +206,7 @@ public partial class Dump
|
||||
|
||||
var newTrim = false;
|
||||
|
||||
_speedStopwatch.Restart();
|
||||
_speedStopwatch.Reset();
|
||||
ulong sectorSpeedStart = 0;
|
||||
InitProgress?.Invoke();
|
||||
|
||||
@@ -234,8 +234,10 @@ public 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 = _dev.Read12(out readBuffer, out senseBuf, 0, false, true, false, false, (uint)(umdStart + i * 4),
|
||||
512, 0, blocksToRead * 4, false, _dev.Timeout, out double cmdDuration);
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
totalDuration += cmdDuration;
|
||||
|
||||
@@ -282,12 +284,12 @@ public 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();
|
||||
}
|
||||
|
||||
_resume.BadBlocks = _resume.BadBlocks.Distinct().ToList();
|
||||
|
||||
@@ -857,7 +857,7 @@ partial class Dump
|
||||
|
||||
InitProgress?.Invoke();
|
||||
|
||||
_speedStopwatch.Restart();
|
||||
_speedStopwatch.Reset();
|
||||
|
||||
while(currentPartition < totalPartitions)
|
||||
{
|
||||
@@ -919,9 +919,10 @@ partial class Dump
|
||||
PulseProgress?.Invoke(string.Format(Localization.Core.Reading_block_0_1, currentBlock,
|
||||
ByteSize.FromBytes(currentSpeed).Per(_oneSecond).Humanize()));
|
||||
|
||||
_speedStopwatch.Start();
|
||||
sense = _dev.Read6(out cmdBuf, out senseBuf, false, fixedLen, transferLen, blockSize, _dev.Timeout,
|
||||
out duration);
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
totalDuration += duration;
|
||||
|
||||
if(sense && senseBuf?.Length != 0 && !ArrayHelpers.ArrayIsNullOrEmpty(senseBuf))
|
||||
@@ -1093,12 +1094,12 @@ partial class Dump
|
||||
|
||||
double elapsed = _speedStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
if(elapsed <= 0)
|
||||
if(elapsed <= 0 || currentSpeedSize < 524288)
|
||||
continue;
|
||||
|
||||
currentSpeed = currentSpeedSize / (1048576 * elapsed);
|
||||
currentSpeedSize = 0;
|
||||
_speedStopwatch.Restart();
|
||||
_speedStopwatch.Reset();
|
||||
}
|
||||
|
||||
_resume.BadBlocks = _resume.BadBlocks.Distinct().ToList();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -619,7 +619,7 @@ public partial class Dump
|
||||
}
|
||||
|
||||
_dumpStopwatch.Restart();
|
||||
_speedStopwatch.Restart();
|
||||
_speedStopwatch.Reset();
|
||||
double imageWriteDuration = 0;
|
||||
var newTrim = false;
|
||||
ulong sectorSpeedStart = 0;
|
||||
@@ -650,6 +650,7 @@ public 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();
|
||||
if(blocksToRead == 1)
|
||||
{
|
||||
error = _dev.ReadSingleBlock(out cmdBuf, out _, (uint)i, blockSize, byteAddressed, timeout,
|
||||
@@ -668,6 +669,8 @@ public partial class Dump
|
||||
timeout, out duration);
|
||||
}
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
if(!error)
|
||||
{
|
||||
mhddLog.Write(i, duration, blocksToRead);
|
||||
@@ -705,12 +708,12 @@ public 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();
|
||||
}
|
||||
|
||||
_resume.BadBlocks = _resume.BadBlocks.Distinct().ToList();
|
||||
|
||||
@@ -580,7 +580,7 @@ partial class Dump
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Reading_game_partition);
|
||||
UpdateStatus?.Invoke(Localization.Core.Reading_game_partition);
|
||||
_speedStopwatch.Restart();
|
||||
_speedStopwatch.Reset();
|
||||
ulong sectorSpeedStart = 0;
|
||||
InitProgress?.Invoke();
|
||||
|
||||
@@ -659,8 +659,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)totalSize);
|
||||
|
||||
_speedStopwatch.Start();
|
||||
sense = _dev.Read12(out readBuffer, out senseBuf, 0, false, false, false, false, (uint)i, blockSize, 0,
|
||||
blocksToRead, false, _dev.Timeout, out cmdDuration);
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
totalDuration += cmdDuration;
|
||||
|
||||
@@ -723,12 +725,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();
|
||||
@@ -863,8 +865,10 @@ partial class Dump
|
||||
Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, currentSector, totalSize, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)currentSector, (long)totalSize);
|
||||
|
||||
_speedStopwatch.Start();
|
||||
sense = _dev.Read12(out readBuffer, out senseBuf, 0, false, false, false, false, (uint)l1, blockSize, 0,
|
||||
blocksToRead, false, _dev.Timeout, out cmdDuration);
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
totalDuration += cmdDuration;
|
||||
|
||||
@@ -919,12 +923,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();
|
||||
}
|
||||
|
||||
EndProgress?.Invoke();
|
||||
|
||||
Reference in New Issue
Block a user