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:
@@ -242,6 +242,8 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
bool newTrim = false;
|
||||
|
||||
start = DateTime.UtcNow;
|
||||
DateTime timeSpeedStart = DateTime.UtcNow;
|
||||
ulong sectorSpeedStart = 0;
|
||||
for(ulong i = resume.NextBlock; i < blocks; i += blocksToRead)
|
||||
{
|
||||
if(aborted)
|
||||
@@ -288,10 +290,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;
|
||||
@@ -399,6 +406,8 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
ulong currentBlock = 0;
|
||||
blocks = (ulong)(cylinders * heads * sectors);
|
||||
start = DateTime.UtcNow;
|
||||
DateTime timeSpeedStart = DateTime.UtcNow;
|
||||
ulong sectorSpeedStart = 0;
|
||||
for(ushort cy = 0; cy < cylinders; cy++)
|
||||
{
|
||||
for(byte hd = 0; hd < heads; hd++)
|
||||
@@ -448,11 +457,15 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
|
||||
}
|
||||
|
||||
double newSpeed =
|
||||
blockSize / (double)1048576 / (duration / 1000);
|
||||
if(!double.IsInfinity(newSpeed)) currentSpeed = newSpeed;
|
||||
|
||||
sectorSpeedStart++;
|
||||
currentBlock++;
|
||||
|
||||
double elapsed = (DateTime.UtcNow - timeSpeedStart).TotalSeconds;
|
||||
if(elapsed < 1) continue;
|
||||
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed);
|
||||
sectorSpeedStart = 0;
|
||||
timeSpeedStart = DateTime.UtcNow;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user