mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Fix speed calculation on media dump and scan.
This commit is contained in:
@@ -280,8 +280,10 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
if(resume.NextBlock > 0) dumpLog.WriteLine("Resuming from block {0}.", resume.NextBlock);
|
||||
|
||||
start = DateTime.UtcNow;
|
||||
double imageWriteDuration = 0;
|
||||
bool newTrim = false;
|
||||
double imageWriteDuration = 0;
|
||||
bool newTrim = false;
|
||||
DateTime timeSpeedStart = DateTime.UtcNow;
|
||||
ulong sectorSpeedStart = 0;
|
||||
|
||||
for(ulong i = resume.NextBlock; i < blocks; i += blocksToRead)
|
||||
{
|
||||
@@ -330,10 +332,15 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
newTrim = true;
|
||||
}
|
||||
|
||||
double newSpeed =
|
||||
(double)blockSize * blocksToRead / 1048576 / (duration / 1000);
|
||||
if(!double.IsInfinity(newSpeed)) currentSpeed = newSpeed;
|
||||
resume.NextBlock = i + blocksToRead;
|
||||
sectorSpeedStart += blocksToRead;
|
||||
resume.NextBlock = i + blocksToRead;
|
||||
|
||||
double elapsed = (DateTime.UtcNow - timeSpeedStart).TotalSeconds;
|
||||
if(elapsed < 1) continue;
|
||||
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed);
|
||||
sectorSpeedStart = 0;
|
||||
timeSpeedStart = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
end = DateTime.Now;
|
||||
|
||||
Reference in New Issue
Block a user