mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Use a more precise mechanism to measure elapsed times in operations.
This commit is contained in:
@@ -98,14 +98,11 @@ public partial class Dump
|
||||
{
|
||||
Identify.IdentifyDevice ataId = ataIdNullable.Value;
|
||||
byte[] ataIdentify = cmdBuf;
|
||||
cmdBuf = Array.Empty<byte>();
|
||||
|
||||
DateTime start;
|
||||
DateTime end;
|
||||
double totalDuration = 0;
|
||||
double currentSpeed = 0;
|
||||
double maxSpeed = double.MinValue;
|
||||
double minSpeed = double.MaxValue;
|
||||
cmdBuf = Array.Empty<byte>();
|
||||
|
||||
// Initialize reader
|
||||
UpdateStatus?.Invoke(Localization.Core.Initializing_reader);
|
||||
@@ -298,8 +295,8 @@ public partial class Dump
|
||||
|
||||
bool newTrim = false;
|
||||
|
||||
start = DateTime.UtcNow;
|
||||
DateTime timeSpeedStart = DateTime.UtcNow;
|
||||
_dumpStopwatch.Restart();
|
||||
_speedStopwatch.Restart();
|
||||
ulong sectorSpeedStart = 0;
|
||||
InitProgress?.Invoke();
|
||||
|
||||
@@ -331,13 +328,13 @@ public partial class Dump
|
||||
|
||||
bool error = ataReader.ReadBlocks(out cmdBuf, i, blocksToRead, out duration, out _, out _);
|
||||
|
||||
_writeStopwatch.Restart();
|
||||
if(!error)
|
||||
{
|
||||
mhddLog.Write(i, duration, blocksToRead);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
DateTime writeStart = DateTime.Now;
|
||||
outputFormat.WriteSectors(cmdBuf, i, blocksToRead);
|
||||
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
extents.Add(i, blocksToRead, true);
|
||||
_mediaGraph?.PaintSectorsGood(i, blocksToRead);
|
||||
}
|
||||
@@ -352,38 +349,41 @@ public partial class Dump
|
||||
mhddLog.Write(i, duration < 500 ? 65535 : duration, _skip);
|
||||
|
||||
ibgLog.Write(i, 0);
|
||||
DateTime writeStart = DateTime.Now;
|
||||
outputFormat.WriteSectors(new byte[blockSize * _skip], i, _skip);
|
||||
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
_dumpLog.WriteLine(Localization.Core.Skipping_0_blocks_from_errored_block_1, _skip, i);
|
||||
i += _skip - blocksToRead;
|
||||
newTrim = true;
|
||||
}
|
||||
|
||||
_writeStopwatch.Stop();
|
||||
|
||||
sectorSpeedStart += blocksToRead;
|
||||
_resume.NextBlock = i + blocksToRead;
|
||||
|
||||
double elapsed = (DateTime.UtcNow - timeSpeedStart).TotalSeconds;
|
||||
double elapsed = _speedStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
if(elapsed <= 0)
|
||||
continue;
|
||||
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed);
|
||||
sectorSpeedStart = 0;
|
||||
timeSpeedStart = DateTime.UtcNow;
|
||||
_speedStopwatch.Restart();
|
||||
}
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
_resume.BadBlocks = _resume.BadBlocks.Distinct().ToList();
|
||||
|
||||
end = DateTime.Now;
|
||||
_dumpStopwatch.Stop();
|
||||
EndProgress?.Invoke();
|
||||
mhddLog.Close();
|
||||
|
||||
ibgLog.Close(_dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
|
||||
ibgLog.Close(_dev, blocks, blockSize, _dumpStopwatch.Elapsed.TotalSeconds, currentSpeed * 1024,
|
||||
blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000), _devicePath);
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Dump_finished_in_0,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second)));
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
@@ -394,7 +394,7 @@ public partial class Dump
|
||||
Per(imageWriteDuration.Seconds())));
|
||||
|
||||
_dumpLog.WriteLine(string.Format(Localization.Core.Dump_finished_in_0,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second)));
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Average_dump_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).Per(totalDuration.Milliseconds()).
|
||||
@@ -410,7 +410,7 @@ public partial class Dump
|
||||
_trim &&
|
||||
newTrim)
|
||||
{
|
||||
start = DateTime.UtcNow;
|
||||
_trimStopwatch.Restart();
|
||||
UpdateStatus?.Invoke(Localization.Core.Trimming_skipped_sectors);
|
||||
_dumpLog.WriteLine(Localization.Core.Trimming_skipped_sectors);
|
||||
|
||||
@@ -445,13 +445,13 @@ public partial class Dump
|
||||
}
|
||||
|
||||
EndProgress?.Invoke();
|
||||
end = DateTime.UtcNow;
|
||||
_trimStopwatch.Stop();
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Trimming_finished_in_0,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second)));
|
||||
_trimStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
_dumpLog.WriteLine(string.Format(Localization.Core.Trimming_finished_in_0,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second)));
|
||||
_trimStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
}
|
||||
#endregion Trimming
|
||||
|
||||
@@ -563,8 +563,8 @@ public partial class Dump
|
||||
|
||||
ulong currentBlock = 0;
|
||||
blocks = (ulong)(cylinders * heads * sectors);
|
||||
start = DateTime.UtcNow;
|
||||
DateTime timeSpeedStart = DateTime.UtcNow;
|
||||
_dumpStopwatch.Restart();
|
||||
_speedStopwatch.Restart();
|
||||
ulong sectorSpeedStart = 0;
|
||||
InitProgress?.Invoke();
|
||||
|
||||
@@ -602,16 +602,17 @@ public partial class Dump
|
||||
|
||||
totalDuration += duration;
|
||||
|
||||
_writeStopwatch.Restart();
|
||||
|
||||
if(!error || recoveredError)
|
||||
{
|
||||
mhddLog.Write(currentBlock, duration);
|
||||
ibgLog.Write(currentBlock, currentSpeed * 1024);
|
||||
DateTime writeStart = DateTime.Now;
|
||||
|
||||
outputFormat.WriteSector(cmdBuf,
|
||||
(ulong)((((cy * heads) + hd) * sectors) + (sc - 1)));
|
||||
|
||||
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
extents.Add(currentBlock);
|
||||
_mediaGraph?.PaintSectorGood((ulong)((((cy * heads) + hd) * sectors) + (sc - 1)));
|
||||
|
||||
@@ -624,40 +625,42 @@ public partial class Dump
|
||||
mhddLog.Write(currentBlock, duration < 500 ? 65535 : duration);
|
||||
|
||||
ibgLog.Write(currentBlock, 0);
|
||||
DateTime writeStart = DateTime.Now;
|
||||
|
||||
outputFormat.WriteSector(new byte[blockSize],
|
||||
(ulong)((((cy * heads) + hd) * sectors) + (sc - 1)));
|
||||
|
||||
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
}
|
||||
|
||||
_writeStopwatch.Stop();
|
||||
|
||||
sectorSpeedStart++;
|
||||
currentBlock++;
|
||||
|
||||
double elapsed = (DateTime.UtcNow - timeSpeedStart).TotalSeconds;
|
||||
double elapsed = _speedStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
if(elapsed <= 0)
|
||||
continue;
|
||||
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed);
|
||||
sectorSpeedStart = 0;
|
||||
timeSpeedStart = DateTime.UtcNow;
|
||||
_speedStopwatch.Restart();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
_resume.BadBlocks = _resume.BadBlocks.Distinct().ToList();
|
||||
|
||||
end = DateTime.Now;
|
||||
_dumpStopwatch.Stop();
|
||||
EndProgress?.Invoke();
|
||||
mhddLog.Close();
|
||||
|
||||
ibgLog.Close(_dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
|
||||
ibgLog.Close(_dev, blocks, blockSize, _dumpStopwatch.Elapsed.TotalSeconds, currentSpeed * 1024,
|
||||
blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000), _devicePath);
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Dump_finished_in_0,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second)));
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
@@ -668,7 +671,7 @@ public partial class Dump
|
||||
Per(imageWriteDuration.Seconds())));
|
||||
|
||||
_dumpLog.WriteLine(string.Format(Localization.Core.Dump_finished_in_0,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second)));
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Average_dump_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).Per(totalDuration.Milliseconds()).
|
||||
@@ -700,15 +703,15 @@ public partial class Dump
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Closing_output_file);
|
||||
UpdateStatus?.Invoke(Localization.Core.Closing_output_file);
|
||||
DateTime closeStart = DateTime.Now;
|
||||
_imageCloseStopwatch.Restart();
|
||||
outputFormat.Close();
|
||||
DateTime closeEnd = DateTime.Now;
|
||||
_imageCloseStopwatch.Stop();
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Closed_in_0,
|
||||
(closeEnd - closeStart).Humanize(minUnit: TimeUnit.Second)));
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Closed_in_0,
|
||||
(closeEnd - closeStart).Humanize(minUnit: TimeUnit.Second));
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second));
|
||||
|
||||
if(_aborted)
|
||||
{
|
||||
@@ -747,7 +750,7 @@ public partial class Dump
|
||||
return;
|
||||
}
|
||||
|
||||
DateTime chkStart = DateTime.UtcNow;
|
||||
_sidecarStopwatch.Restart();
|
||||
|
||||
_sidecarClass = new Sidecar(inputPlugin, _outputPath, filter.Id, _encoding);
|
||||
|
||||
@@ -856,19 +859,20 @@ public partial class Dump
|
||||
}
|
||||
};
|
||||
|
||||
DateTime chkEnd = DateTime.UtcNow;
|
||||
_sidecarStopwatch.Stop();
|
||||
|
||||
totalChkDuration = (chkEnd - chkStart).TotalMilliseconds;
|
||||
totalChkDuration = _sidecarStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Sidecar_created_in_0,
|
||||
(chkEnd - chkStart).Humanize(minUnit: TimeUnit.Second)));
|
||||
_sidecarStopwatch.Elapsed.
|
||||
Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_checksum_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
Per(totalChkDuration.Milliseconds())));
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Sidecar_created_in_0,
|
||||
(chkEnd - chkStart).Humanize(minUnit: TimeUnit.Second));
|
||||
_sidecarStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second));
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Average_checksum_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
@@ -938,11 +942,11 @@ public partial class Dump
|
||||
|
||||
UpdateStatus?.
|
||||
Invoke(string.Format(Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second),
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second),
|
||||
totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second),
|
||||
(closeEnd - closeStart).Humanize(minUnit: TimeUnit.Second)));
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
|
||||
@@ -157,7 +157,6 @@ partial class Dump
|
||||
Dictionary<byte, int> smallestPregapLbaPerTrack)
|
||||
{
|
||||
ulong sectorSpeedStart = 0; // Used to calculate correct speed
|
||||
DateTime timeSpeedStart = DateTime.UtcNow; // Time of start for speed calculation
|
||||
bool sense; // Sense indicator
|
||||
byte[] cmdBuf; // Data buffer
|
||||
byte[] senseBuf; // Sense buffer
|
||||
@@ -247,7 +246,7 @@ partial class Dump
|
||||
mhddLog.Write(i + r, cmdDuration);
|
||||
ibgLog.Write(i + r, currentSpeed * 1024);
|
||||
extents.Add(i + r, 1, true);
|
||||
DateTime writeStart = DateTime.Now;
|
||||
_writeStopwatch.Restart();
|
||||
|
||||
if(cdiReadyReadAsAudio)
|
||||
FixOffsetData(offsetBytes, sectorSize, sectorsForOffset, supportedSubchannel,
|
||||
@@ -285,7 +284,7 @@ partial class Dump
|
||||
else
|
||||
outputOptical.WriteSectorsLong(cmdBuf, i + r, 1);
|
||||
|
||||
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
_mediaGraph?.PaintSectorGood(i + r);
|
||||
}
|
||||
@@ -305,20 +304,23 @@ partial class Dump
|
||||
break;
|
||||
}
|
||||
|
||||
_writeStopwatch.Stop();
|
||||
sectorSpeedStart += r;
|
||||
|
||||
_resume.NextBlock = i + r;
|
||||
|
||||
elapsed = (DateTime.UtcNow - timeSpeedStart).TotalSeconds;
|
||||
elapsed = _speedStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
if(elapsed <= 0)
|
||||
continue;
|
||||
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed);
|
||||
sectorSpeedStart = 0;
|
||||
timeSpeedStart = DateTime.UtcNow;
|
||||
_speedStopwatch.Restart();
|
||||
}
|
||||
|
||||
_speedStopwatch.Restart();
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
{
|
||||
@@ -329,7 +331,7 @@ partial class Dump
|
||||
mhddLog.Write(i, cmdDuration);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
extents.Add(i, blocksToRead, true);
|
||||
DateTime writeStart = DateTime.Now;
|
||||
_writeStopwatch.Restart();
|
||||
|
||||
if(supportedSubchannel != MmcSubchannel.None)
|
||||
{
|
||||
@@ -398,7 +400,7 @@ partial class Dump
|
||||
outputOptical.WriteSectorsLong(cmdBuf, i, blocksToRead);
|
||||
}
|
||||
|
||||
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
_mediaGraph?.PaintSectorsGood(i, blocksToRead);
|
||||
}
|
||||
@@ -411,20 +413,22 @@ partial class Dump
|
||||
break;
|
||||
}
|
||||
|
||||
_writeStopwatch.Stop();
|
||||
sectorSpeedStart += blocksToRead;
|
||||
|
||||
_resume.NextBlock = i + blocksToRead;
|
||||
|
||||
elapsed = (DateTime.UtcNow - timeSpeedStart).TotalSeconds;
|
||||
elapsed = _speedStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
if(elapsed <= 0)
|
||||
continue;
|
||||
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed);
|
||||
sectorSpeedStart = 0;
|
||||
timeSpeedStart = DateTime.UtcNow;
|
||||
_speedStopwatch.Restart();
|
||||
}
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
EndProgress?.Invoke();
|
||||
}
|
||||
}
|
||||
@@ -101,7 +101,6 @@ partial class Dump
|
||||
Dictionary<byte, int> smallestPregapLbaPerTrack)
|
||||
{
|
||||
ulong sectorSpeedStart = 0; // Used to calculate correct speed
|
||||
DateTime timeSpeedStart = DateTime.UtcNow; // Time of start for speed calculation
|
||||
uint blocksToRead; // How many sectors to read at once
|
||||
bool sense = true; // Sense indicator
|
||||
byte[] cmdBuf = null; // Data buffer
|
||||
@@ -129,6 +128,8 @@ partial class Dump
|
||||
|
||||
for(ulong i = _resume.NextBlock; (long)i <= lastSector; i += blocksToRead)
|
||||
{
|
||||
_speedStopwatch.Restart();
|
||||
|
||||
if(_aborted)
|
||||
{
|
||||
currentTry.Extents = ExtentsConverter.ToMetadata(extents);
|
||||
@@ -422,6 +423,8 @@ partial class Dump
|
||||
!nextData &&
|
||||
sense)
|
||||
{
|
||||
_speedStopwatch.Restart();
|
||||
|
||||
for(uint r = 0; r < blocksToRead; r++)
|
||||
{
|
||||
UpdateProgress?.
|
||||
@@ -481,7 +484,7 @@ partial class Dump
|
||||
mhddLog.Write(i + r, cmdDuration);
|
||||
ibgLog.Write(i + r, currentSpeed * 1024);
|
||||
extents.Add(i + r, 1, true);
|
||||
DateTime writeStart = DateTime.Now;
|
||||
_writeStopwatch.Restart();
|
||||
|
||||
if(supportedSubchannel != MmcSubchannel.None)
|
||||
{
|
||||
@@ -559,14 +562,14 @@ partial class Dump
|
||||
|
||||
_mediaGraph?.PaintSectorGood(i + r);
|
||||
|
||||
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
}
|
||||
else
|
||||
{
|
||||
_errorLog?.WriteLine(i + r, _dev.Error, _dev.LastError, senseBuf);
|
||||
|
||||
// Write empty data
|
||||
DateTime writeStart = DateTime.Now;
|
||||
_writeStopwatch.Restart();
|
||||
|
||||
if(supportedSubchannel != MmcSubchannel.None)
|
||||
{
|
||||
@@ -589,7 +592,7 @@ partial class Dump
|
||||
}
|
||||
}
|
||||
|
||||
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
_mediaGraph?.PaintSectorBad(i + r);
|
||||
|
||||
@@ -605,18 +608,20 @@ partial class Dump
|
||||
newTrim = true;
|
||||
}
|
||||
|
||||
_writeStopwatch.Stop();
|
||||
|
||||
sectorSpeedStart += r;
|
||||
|
||||
_resume.NextBlock = i + r;
|
||||
|
||||
elapsed = (DateTime.UtcNow - timeSpeedStart).TotalSeconds;
|
||||
elapsed = _speedStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
if(elapsed <= 0)
|
||||
continue;
|
||||
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed);
|
||||
sectorSpeedStart = 0;
|
||||
timeSpeedStart = DateTime.UtcNow;
|
||||
_speedStopwatch.Restart();
|
||||
}
|
||||
|
||||
continue;
|
||||
@@ -641,7 +646,7 @@ partial class Dump
|
||||
mhddLog.Write(i, cmdDuration, blocksToRead);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
extents.Add(i, blocksToRead, true);
|
||||
DateTime writeStart = DateTime.Now;
|
||||
_writeStopwatch.Restart();
|
||||
|
||||
if(supportedSubchannel != MmcSubchannel.None)
|
||||
{
|
||||
@@ -722,7 +727,7 @@ partial class Dump
|
||||
|
||||
_mediaGraph?.PaintSectorsGood(i, blocksToRead);
|
||||
|
||||
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -747,7 +752,7 @@ partial class Dump
|
||||
_skip = (uint)(blocks - i);
|
||||
|
||||
// Write empty data
|
||||
DateTime writeStart = DateTime.Now;
|
||||
_writeStopwatch.Restart();
|
||||
|
||||
if(supportedSubchannel != MmcSubchannel.None)
|
||||
{
|
||||
@@ -770,7 +775,7 @@ partial class Dump
|
||||
}
|
||||
}
|
||||
|
||||
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
for(ulong b = i; b < i + _skip; b++)
|
||||
_resume.BadBlocks.Add(b);
|
||||
@@ -784,20 +789,23 @@ partial class Dump
|
||||
newTrim = true;
|
||||
}
|
||||
|
||||
_writeStopwatch.Stop();
|
||||
|
||||
sectorSpeedStart += blocksToRead;
|
||||
|
||||
_resume.NextBlock = i + blocksToRead;
|
||||
|
||||
elapsed = (DateTime.UtcNow - timeSpeedStart).TotalSeconds;
|
||||
elapsed = _speedStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
if(elapsed <= 0)
|
||||
continue;
|
||||
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed);
|
||||
sectorSpeedStart = 0;
|
||||
timeSpeedStart = DateTime.UtcNow;
|
||||
_speedStopwatch.Restart();
|
||||
}
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
EndProgress?.Invoke();
|
||||
|
||||
_resume.BadBlocks = _resume.BadBlocks.Distinct().ToList();
|
||||
|
||||
@@ -75,8 +75,6 @@ sealed partial class Dump
|
||||
DumpHardware currentTry = null; // Current dump hardware try
|
||||
double currentSpeed = 0; // Current read speed
|
||||
int? discOffset = null; // Disc write offset
|
||||
DateTime dumpStart = DateTime.UtcNow; // Time of dump start
|
||||
DateTime end; // Time of operation end
|
||||
ExtentsULong extents = null; // Extents
|
||||
bool hiddenData; // Hidden track is data
|
||||
IbgLog ibgLog; // IMGBurn log
|
||||
@@ -99,7 +97,6 @@ sealed partial class Dump
|
||||
int sectorsForOffset = 0; // Sectors needed to fix offset
|
||||
bool sense = true; // Sense indicator
|
||||
int sessions; // Number of sessions in disc
|
||||
DateTime start; // Start of operation
|
||||
SubchannelLog subLog = null; // Subchannel log
|
||||
uint subSize = 0; // Subchannel size in bytes
|
||||
TrackSubchannelType subType = TrackSubchannelType.None; // Track subchannel type
|
||||
@@ -1167,7 +1164,7 @@ sealed partial class Dump
|
||||
}
|
||||
|
||||
// Start reading
|
||||
start = DateTime.UtcNow;
|
||||
_dumpStopwatch.Restart();
|
||||
|
||||
if(dskType == MediaType.CDIREADY || cdiWithHiddenTrack1)
|
||||
{
|
||||
@@ -1289,14 +1286,14 @@ sealed partial class Dump
|
||||
smallestPregapLbaPerTrack);
|
||||
*/
|
||||
|
||||
end = DateTime.UtcNow;
|
||||
_dumpStopwatch.Stop();
|
||||
mhddLog.Close();
|
||||
|
||||
ibgLog.Close(_dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
|
||||
ibgLog.Close(_dev, blocks, blockSize, _dumpStopwatch.Elapsed.TotalSeconds, currentSpeed * 1024,
|
||||
blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000), _devicePath);
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Dump_finished_in_0,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second)));
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
@@ -1307,7 +1304,7 @@ sealed partial class Dump
|
||||
Per(imageWriteDuration.Seconds())));
|
||||
|
||||
_dumpLog.WriteLine(string.Format(Localization.Core.Dump_finished_in_0,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second)));
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
_dumpLog.WriteLine(string.Format(Localization.Core.Average_dump_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
@@ -1439,12 +1436,12 @@ sealed partial class Dump
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Closing_output_file);
|
||||
UpdateStatus?.Invoke(Localization.Core.Closing_output_file);
|
||||
DateTime closeStart = DateTime.Now;
|
||||
_imageCloseStopwatch.Restart();
|
||||
outputOptical.Close();
|
||||
DateTime closeEnd = DateTime.Now;
|
||||
_imageCloseStopwatch.Stop();
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Closed_in_0,
|
||||
(closeEnd - closeStart).Humanize(minUnit: TimeUnit.Second)));
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
subLog?.Close();
|
||||
|
||||
@@ -1461,16 +1458,16 @@ sealed partial class Dump
|
||||
WriteOpticalSidecar(blockSize, blocks, dskType, null, mediaTags, sessions, out totalChkDuration,
|
||||
discOffset);
|
||||
|
||||
end = DateTime.UtcNow;
|
||||
_dumpStopwatch.Stop();
|
||||
UpdateStatus?.Invoke("");
|
||||
|
||||
UpdateStatus?.
|
||||
Invoke(string.Format(Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second),
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second),
|
||||
totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second),
|
||||
(closeEnd - closeStart).Humanize(minUnit: TimeUnit.Second)));
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
|
||||
@@ -151,7 +151,7 @@ partial class Dump
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
extents.Add(i, _maximumReadable, true);
|
||||
leadOutExtents.Remove(i);
|
||||
DateTime writeStart = DateTime.Now;
|
||||
_writeStopwatch.Restart();
|
||||
|
||||
if(supportedSubchannel != MmcSubchannel.None)
|
||||
{
|
||||
@@ -184,7 +184,7 @@ partial class Dump
|
||||
else
|
||||
outputOptical.WriteSectors(cmdBuf, i, _maximumReadable);
|
||||
|
||||
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -195,7 +195,7 @@ partial class Dump
|
||||
return; // TODO: Return more cleanly
|
||||
|
||||
// Write empty data
|
||||
DateTime writeStart = DateTime.Now;
|
||||
_writeStopwatch.Restart();
|
||||
|
||||
if(supportedSubchannel != MmcSubchannel.None)
|
||||
{
|
||||
@@ -207,13 +207,14 @@ partial class Dump
|
||||
else
|
||||
outputOptical.WriteSectors(new byte[blockSize * _skip], i, 1);
|
||||
|
||||
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
mhddLog.Write(i, cmdDuration < 500 ? 65535 : cmdDuration, _skip);
|
||||
|
||||
ibgLog.Write(i, 0);
|
||||
}
|
||||
|
||||
_writeStopwatch.Stop();
|
||||
double newSpeed = (double)blockSize * _maximumReadable / 1048576 / (cmdDuration / 1000);
|
||||
|
||||
if(!double.IsInfinity(newSpeed))
|
||||
@@ -323,7 +324,7 @@ partial class Dump
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
extents.Add(i, _maximumReadable, true);
|
||||
leadOutExtents.Remove(i);
|
||||
DateTime writeStart = DateTime.Now;
|
||||
_writeStopwatch.Restart();
|
||||
|
||||
if(supportedSubchannel != MmcSubchannel.None)
|
||||
{
|
||||
@@ -356,7 +357,7 @@ partial class Dump
|
||||
else
|
||||
outputOptical.WriteSectors(cmdBuf, i, _maximumReadable);
|
||||
|
||||
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -367,7 +368,7 @@ partial class Dump
|
||||
return; // TODO: Return more cleanly
|
||||
|
||||
// Write empty data
|
||||
DateTime writeStart = DateTime.Now;
|
||||
_writeStopwatch.Restart();
|
||||
|
||||
if(supportedSubchannel != MmcSubchannel.None)
|
||||
{
|
||||
@@ -380,13 +381,14 @@ partial class Dump
|
||||
else
|
||||
outputOptical.WriteSectors(new byte[blockSize * _skip], i, 1);
|
||||
|
||||
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
mhddLog.Write(i, cmdDuration < 500 ? 65535 : cmdDuration);
|
||||
|
||||
ibgLog.Write(i, 0);
|
||||
}
|
||||
|
||||
_writeStopwatch.Stop();
|
||||
double newSpeed = (double)blockSize * _maximumReadable / 1048576 / (cmdDuration / 1000);
|
||||
|
||||
if(!double.IsInfinity(newSpeed))
|
||||
|
||||
@@ -65,7 +65,6 @@ partial class Dump
|
||||
bool sense; // Sense indicator
|
||||
byte[] cmdBuf; // Data buffer
|
||||
double cmdDuration; // Command execution time
|
||||
DateTime timeSpeedStart; // Time of start for speed calculation
|
||||
ulong sectorSpeedStart = 0; // Used to calculate correct speed
|
||||
bool gotFirstTrackPregap = false;
|
||||
int firstTrackPregapSectorsGood = 0;
|
||||
@@ -74,7 +73,7 @@ partial class Dump
|
||||
_dumpLog.WriteLine(Localization.Core.Reading_first_track_pregap);
|
||||
UpdateStatus?.Invoke(Localization.Core.Reading_first_track_pregap);
|
||||
InitProgress?.Invoke();
|
||||
timeSpeedStart = DateTime.UtcNow;
|
||||
_speedStopwatch.Restart();
|
||||
|
||||
for(int firstTrackPregapBlock = -150; firstTrackPregapBlock < 0 && _resume.NextBlock == 0;
|
||||
firstTrackPregapBlock++)
|
||||
@@ -115,16 +114,18 @@ partial class Dump
|
||||
|
||||
sectorSpeedStart++;
|
||||
|
||||
double elapsed = (DateTime.UtcNow - timeSpeedStart).TotalSeconds;
|
||||
double elapsed = _speedStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
if(elapsed <= 0)
|
||||
continue;
|
||||
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed);
|
||||
sectorSpeedStart = 0;
|
||||
timeSpeedStart = DateTime.UtcNow;
|
||||
_speedStopwatch.Restart();
|
||||
}
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
if(firstTrackPregapSectorsGood > 0)
|
||||
mediaTags.Add(MediaTagType.CD_FirstTrackPregap, firstTrackPregapMs.ToArray());
|
||||
|
||||
|
||||
@@ -83,8 +83,6 @@ partial class Dump
|
||||
Dictionary<byte, string> isrcs, ref string mcn, HashSet<int> subchannelExtents,
|
||||
Dictionary<byte, int> smallestPregapLbaPerTrack)
|
||||
{
|
||||
DateTime start;
|
||||
DateTime end;
|
||||
bool sense = true; // Sense indicator
|
||||
byte[] cmdBuf = null; // Data buffer
|
||||
double cmdDuration = 0; // Command execution time
|
||||
@@ -107,10 +105,10 @@ partial class Dump
|
||||
!newTrim)
|
||||
return;
|
||||
|
||||
start = DateTime.UtcNow;
|
||||
UpdateStatus?.Invoke(Localization.Core.Trimming_skipped_sectors);
|
||||
_dumpLog.WriteLine(Localization.Core.Trimming_skipped_sectors);
|
||||
InitProgress?.Invoke();
|
||||
_trimStopwatch.Restart();
|
||||
|
||||
trimStart:
|
||||
ulong[] tmpArray = _resume.BadBlocks.ToArray();
|
||||
@@ -292,13 +290,13 @@ partial class Dump
|
||||
outputOptical.WriteSector(Sector.GetUserData(cmdBuf), badSector);
|
||||
}
|
||||
|
||||
_trimStopwatch.Stop();
|
||||
EndProgress?.Invoke();
|
||||
end = DateTime.UtcNow;
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Trimming_finished_in_0,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second)));
|
||||
_trimStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
_dumpLog.WriteLine(string.Format(Localization.Core.Trimming_finished_in_0,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second)));
|
||||
_trimStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -115,6 +115,12 @@ public partial class Dump
|
||||
bool _supportsPlextorD8;
|
||||
bool _useBufferedReads;
|
||||
static readonly TimeSpan _oneSecond = 1.Seconds();
|
||||
readonly Stopwatch _dumpStopwatch;
|
||||
readonly Stopwatch _sidecarStopwatch;
|
||||
readonly Stopwatch _speedStopwatch;
|
||||
readonly Stopwatch _trimStopwatch;
|
||||
readonly Stopwatch _writeStopwatch;
|
||||
readonly Stopwatch _imageCloseStopwatch;
|
||||
|
||||
/// <summary>Initializes dumpers</summary>
|
||||
/// <param name="doResume">Should resume?</param>
|
||||
@@ -207,6 +213,12 @@ public partial class Dump
|
||||
_ignoreCdrRunOuts = ignoreCdrRunOuts;
|
||||
_createGraph = createGraph;
|
||||
_dimensions = dimensions;
|
||||
_dumpStopwatch = new Stopwatch();
|
||||
_sidecarStopwatch = new Stopwatch();
|
||||
_speedStopwatch = new Stopwatch();
|
||||
_trimStopwatch = new Stopwatch();
|
||||
_writeStopwatch = new Stopwatch();
|
||||
_imageCloseStopwatch = new Stopwatch();
|
||||
}
|
||||
|
||||
/// <summary>Starts dumping with the established fields and autodetecting the device type</summary>
|
||||
|
||||
@@ -292,10 +292,10 @@ public partial class Dump
|
||||
if(_createGraph)
|
||||
_mediaGraph = new BlockMap((int)_dimensions, (int)_dimensions, romSectors);
|
||||
|
||||
DateTime start = DateTime.UtcNow;
|
||||
_dumpStopwatch.Restart();
|
||||
double imageWriteDuration = 0;
|
||||
|
||||
DateTime timeSpeedStart = DateTime.UtcNow;
|
||||
_speedStopwatch.Restart();
|
||||
ulong sectorSpeedStart = 0;
|
||||
InitProgress?.Invoke();
|
||||
|
||||
@@ -329,12 +329,13 @@ public partial class Dump
|
||||
|
||||
totalDuration += cmdDuration;
|
||||
|
||||
_writeStopwatch.Restart();
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
{
|
||||
DateTime writeStart = DateTime.Now;
|
||||
outputBai.WriteBytes(readBuffer, 0, readBuffer.Length, out _);
|
||||
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
_mediaGraph.PaintSectorsGood(i, blocksToRead);
|
||||
}
|
||||
else
|
||||
@@ -349,18 +350,22 @@ public partial class Dump
|
||||
i += _skip - blocksToRead;
|
||||
}
|
||||
|
||||
_writeStopwatch.Stop();
|
||||
|
||||
sectorSpeedStart += blocksToRead;
|
||||
|
||||
double elapsed = (DateTime.UtcNow - timeSpeedStart).TotalSeconds;
|
||||
double elapsed = _speedStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
if(elapsed <= 0)
|
||||
continue;
|
||||
|
||||
currentSpeed = sectorSpeedStart * 512 / (1048576 * elapsed);
|
||||
sectorSpeedStart = 0;
|
||||
timeSpeedStart = DateTime.UtcNow;
|
||||
_speedStopwatch.Restart();
|
||||
}
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
if(romRemaining > 0 &&
|
||||
!_aborted)
|
||||
{
|
||||
@@ -384,9 +389,10 @@ public partial class Dump
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
{
|
||||
DateTime writeStart = DateTime.Now;
|
||||
_writeStopwatch.Restart();
|
||||
outputBai.WriteBytes(readBuffer, 0, (int)romRemaining, out _);
|
||||
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
_writeStopwatch.Stop();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -401,10 +407,10 @@ public partial class Dump
|
||||
}
|
||||
}
|
||||
|
||||
DateTime end = DateTime.UtcNow;
|
||||
EndProgress?.Invoke();
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Dump_finished_in_0, (end - start).Humanize(minUnit: TimeUnit.Second)));
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Dump_finished_in_0,
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0,
|
||||
ByteSize.FromBytes(512 * (romSectors + 1)).
|
||||
@@ -414,7 +420,8 @@ public partial class Dump
|
||||
ByteSize.FromBytes(512 * (romSectors + 1)).
|
||||
Per(imageWriteDuration.Seconds())));
|
||||
|
||||
_dumpLog.WriteLine(string.Format(Localization.Core.Dump_finished_in_0, (end - start).Humanize(minUnit: TimeUnit.Second)));
|
||||
_dumpLog.WriteLine(string.Format(Localization.Core.Dump_finished_in_0,
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
_dumpLog.WriteLine(string.Format(Localization.Core.Average_dump_speed_0,
|
||||
ByteSize.FromBytes(512 * (romSectors + 1)).Per(totalDuration.Milliseconds()).
|
||||
@@ -442,10 +449,12 @@ public partial class Dump
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Closing_output_file);
|
||||
UpdateStatus?.Invoke(Localization.Core.Closing_output_file);
|
||||
DateTime closeStart = DateTime.Now;
|
||||
_imageCloseStopwatch.Restart();
|
||||
outputBai.Close();
|
||||
DateTime closeEnd = DateTime.Now;
|
||||
_dumpLog.WriteLine(Localization.Core.Closed_in_0, (closeEnd - closeStart).Humanize(minUnit: TimeUnit.Second));
|
||||
_imageCloseStopwatch.Stop();
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Closed_in_0,
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second));
|
||||
|
||||
if(_aborted)
|
||||
{
|
||||
@@ -465,11 +474,11 @@ public partial class Dump
|
||||
|
||||
UpdateStatus?.
|
||||
Invoke(string.Format(Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second),
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second),
|
||||
totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second),
|
||||
(closeEnd - closeStart).Humanize(minUnit: TimeUnit.Second)));
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0,
|
||||
ByteSize.FromBytes(512 * (romSectors + 1)).Per(totalDuration.Milliseconds()).
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
// Copyright © 2011-2023 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -81,7 +80,7 @@ partial class Dump
|
||||
return;
|
||||
}
|
||||
|
||||
DateTime chkStart = DateTime.UtcNow;
|
||||
_sidecarStopwatch.Restart();
|
||||
|
||||
// ReSharper disable once UseObjectOrCollectionInitializer
|
||||
_sidecarClass = new Sidecar(inputPlugin, _outputPath, filter.Id, _encoding);
|
||||
@@ -93,13 +92,15 @@ partial class Dump
|
||||
_sidecarClass.EndProgressEvent2 += EndProgress2;
|
||||
_sidecarClass.UpdateStatusEvent += UpdateStatus;
|
||||
Metadata sidecar = _sidecarClass.Create();
|
||||
DateTime end = DateTime.UtcNow;
|
||||
_sidecarStopwatch.Stop();
|
||||
|
||||
if(_aborted)
|
||||
return;
|
||||
|
||||
totalChkDuration = (end - chkStart).TotalMilliseconds;
|
||||
_dumpLog.WriteLine(Localization.Core.Sidecar_created_in_0, (end - chkStart).Humanize(minUnit: TimeUnit.Second));
|
||||
totalChkDuration = _sidecarStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Sidecar_created_in_0,
|
||||
_sidecarStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second));
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Average_checksum_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).Per(totalChkDuration.Milliseconds()).
|
||||
|
||||
@@ -63,8 +63,6 @@ partial class Dump
|
||||
bool sense;
|
||||
byte scsiMediumType = 0;
|
||||
const ushort sbcProfile = 0x0001;
|
||||
DateTime start;
|
||||
DateTime end;
|
||||
double totalDuration = 0;
|
||||
double currentSpeed = 0;
|
||||
double maxSpeed = double.MinValue;
|
||||
@@ -250,7 +248,7 @@ partial class Dump
|
||||
return;
|
||||
}
|
||||
|
||||
start = DateTime.UtcNow;
|
||||
_dumpStopwatch.Restart();
|
||||
double imageWriteDuration = 0;
|
||||
|
||||
if(decMode?.Pages != null)
|
||||
@@ -351,7 +349,7 @@ partial class Dump
|
||||
}
|
||||
|
||||
bool newTrim = false;
|
||||
DateTime timeSpeedStart = DateTime.UtcNow;
|
||||
_speedStopwatch.Restart();
|
||||
ulong sectorSpeedStart = 0;
|
||||
InitProgress?.Invoke();
|
||||
|
||||
@@ -391,9 +389,9 @@ partial class Dump
|
||||
{
|
||||
mhddLog.Write(i, cmdDuration, blocksToRead);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
DateTime writeStart = DateTime.Now;
|
||||
_writeStopwatch.Restart();
|
||||
outputFormat.WriteSectors(readBuffer, i, blocksToRead);
|
||||
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
extents.Add(i, blocksToRead, true);
|
||||
_mediaGraph?.PaintSectorsGood(i, blocksToRead);
|
||||
}
|
||||
@@ -407,9 +405,9 @@ partial class Dump
|
||||
_skip = (uint)(blocks - i);
|
||||
|
||||
// Write empty data
|
||||
DateTime writeStart = DateTime.Now;
|
||||
_writeStopwatch.Restart();
|
||||
outputFormat.WriteSectors(new byte[blockSize * _skip], i, _skip);
|
||||
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
for(ulong b = i; b < i + _skip; b++)
|
||||
_resume.BadBlocks.Add(b);
|
||||
@@ -422,30 +420,32 @@ partial class Dump
|
||||
newTrim = true;
|
||||
}
|
||||
|
||||
_writeStopwatch.Stop();
|
||||
sectorSpeedStart += blocksToRead;
|
||||
_resume.NextBlock = i + blocksToRead;
|
||||
|
||||
double elapsed = (DateTime.UtcNow - timeSpeedStart).TotalSeconds;
|
||||
double elapsed = _speedStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
if(elapsed <= 0)
|
||||
continue;
|
||||
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed);
|
||||
sectorSpeedStart = 0;
|
||||
timeSpeedStart = DateTime.UtcNow;
|
||||
_speedStopwatch.Restart();
|
||||
}
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
_resume.BadBlocks = _resume.BadBlocks.Distinct().ToList();
|
||||
|
||||
end = DateTime.UtcNow;
|
||||
_dumpStopwatch.Stop();
|
||||
EndProgress?.Invoke();
|
||||
mhddLog.Close();
|
||||
|
||||
ibgLog.Close(_dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
|
||||
ibgLog.Close(_dev, blocks, blockSize, _dumpStopwatch.Elapsed.TotalSeconds, currentSpeed * 1024,
|
||||
blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000), _devicePath);
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Dump_finished_in_0,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second)));
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
@@ -456,7 +456,7 @@ partial class Dump
|
||||
Per(imageWriteDuration.Seconds())));
|
||||
|
||||
_dumpLog.WriteLine(string.Format(Localization.Core.Dump_finished_in_0,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second)));
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
_dumpLog.WriteLine(string.Format(Localization.Core.Average_dump_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
@@ -472,7 +472,7 @@ partial class Dump
|
||||
_trim &&
|
||||
newTrim)
|
||||
{
|
||||
start = DateTime.UtcNow;
|
||||
_trimStopwatch.Restart();
|
||||
UpdateStatus?.Invoke(Localization.Core.Trimming_skipped_sectors);
|
||||
_dumpLog.WriteLine(Localization.Core.Trimming_skipped_sectors);
|
||||
|
||||
@@ -504,13 +504,13 @@ partial class Dump
|
||||
}
|
||||
|
||||
EndProgress?.Invoke();
|
||||
end = DateTime.UtcNow;
|
||||
_trimStopwatch.Stop();
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Trimming_finished_in_0,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second)));
|
||||
_trimStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
_dumpLog.WriteLine(string.Format(Localization.Core.Trimming_finished_in_0,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second)));
|
||||
_trimStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
}
|
||||
#endregion Trimming
|
||||
|
||||
@@ -727,14 +727,15 @@ partial class Dump
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Closing_output_file);
|
||||
UpdateStatus?.Invoke(Localization.Core.Closing_output_file);
|
||||
DateTime closeStart = DateTime.Now;
|
||||
_imageCloseStopwatch.Restart();
|
||||
outputFormat.Close();
|
||||
DateTime closeEnd = DateTime.Now;
|
||||
_imageCloseStopwatch.Stop();
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Closed_in_0,
|
||||
(closeEnd - closeStart).Humanize(minUnit: TimeUnit.Second)));
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Closed_in_0, (closeEnd - closeStart).Humanize(minUnit: TimeUnit.Second));
|
||||
_dumpLog.WriteLine(Localization.Core.Closed_in_0,
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second));
|
||||
|
||||
if(_aborted)
|
||||
{
|
||||
@@ -762,7 +763,7 @@ partial class Dump
|
||||
return;
|
||||
}
|
||||
|
||||
DateTime chkStart = DateTime.UtcNow;
|
||||
_sidecarStopwatch.Restart();
|
||||
_sidecarClass = new Sidecar(inputPlugin, _outputPath, filter.Id, _encoding);
|
||||
_sidecarClass.InitProgressEvent += InitProgress;
|
||||
_sidecarClass.UpdateProgressEvent += UpdateProgress;
|
||||
@@ -772,21 +773,21 @@ partial class Dump
|
||||
_sidecarClass.EndProgressEvent2 += EndProgress2;
|
||||
_sidecarClass.UpdateStatusEvent += UpdateStatus;
|
||||
Metadata sidecar = _sidecarClass.Create();
|
||||
end = DateTime.UtcNow;
|
||||
_sidecarStopwatch.Stop();
|
||||
|
||||
if(!_aborted)
|
||||
{
|
||||
totalChkDuration = (end - chkStart).TotalMilliseconds;
|
||||
totalChkDuration = _sidecarStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Sidecar_created_in_0,
|
||||
(end - chkStart).Humanize(minUnit: TimeUnit.Second)));
|
||||
_sidecarStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_checksum_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
Per(totalChkDuration.Milliseconds())));
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Sidecar_created_in_0,
|
||||
(end - chkStart).Humanize(minUnit: TimeUnit.Second));
|
||||
_sidecarStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second));
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Average_checksum_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).Per(totalChkDuration.Milliseconds()).
|
||||
@@ -866,11 +867,11 @@ partial class Dump
|
||||
|
||||
UpdateStatus?.
|
||||
Invoke(string.Format(Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second),
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second),
|
||||
totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second),
|
||||
(closeEnd - closeStart).Humanize(minUnit: TimeUnit.Second)));
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
|
||||
@@ -66,8 +66,6 @@ public partial class Dump
|
||||
double maxSpeed = double.MinValue;
|
||||
double minSpeed = double.MaxValue;
|
||||
uint blocksToRead = 64;
|
||||
DateTime start;
|
||||
DateTime end;
|
||||
MediaType dskType;
|
||||
bool sense;
|
||||
byte[] senseBuf;
|
||||
@@ -145,7 +143,7 @@ public partial class Dump
|
||||
return;
|
||||
}
|
||||
|
||||
start = DateTime.UtcNow;
|
||||
_dumpStopwatch.Restart();
|
||||
double imageWriteDuration = 0;
|
||||
|
||||
DumpHardware currentTry = null;
|
||||
@@ -184,7 +182,7 @@ public partial class Dump
|
||||
|
||||
bool newTrim = false;
|
||||
|
||||
DateTime timeSpeedStart = DateTime.UtcNow;
|
||||
_speedStopwatch.Restart();
|
||||
ulong sectorSpeedStart = 0;
|
||||
InitProgress?.Invoke();
|
||||
|
||||
@@ -224,9 +222,9 @@ public partial class Dump
|
||||
{
|
||||
mhddLog.Write(i, cmdDuration, blocksToRead);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
DateTime writeStart = DateTime.Now;
|
||||
_writeStopwatch.Restart();
|
||||
outputFormat.WriteSectors(readBuffer, i, blocksToRead);
|
||||
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
extents.Add(i, blocksToRead, true);
|
||||
_mediaGraph?.PaintSectorsGood(i, blocksToRead);
|
||||
}
|
||||
@@ -242,9 +240,9 @@ public partial class Dump
|
||||
_skip = (uint)(blocks - i);
|
||||
|
||||
// Write empty data
|
||||
DateTime writeStart = DateTime.Now;
|
||||
_writeStopwatch.Restart();
|
||||
outputFormat.WriteSectors(new byte[blockSize * _skip], i, _skip);
|
||||
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
for(ulong b = i; b < i + _skip; b++)
|
||||
_resume.BadBlocks.Add(b);
|
||||
@@ -257,30 +255,32 @@ public partial class Dump
|
||||
newTrim = true;
|
||||
}
|
||||
|
||||
_writeStopwatch.Stop();
|
||||
sectorSpeedStart += blocksToRead;
|
||||
_resume.NextBlock = i + blocksToRead;
|
||||
|
||||
double elapsed = (DateTime.UtcNow - timeSpeedStart).TotalSeconds;
|
||||
double elapsed = _speedStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
if(elapsed <= 0)
|
||||
continue;
|
||||
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed);
|
||||
sectorSpeedStart = 0;
|
||||
timeSpeedStart = DateTime.UtcNow;
|
||||
_speedStopwatch.Restart();
|
||||
}
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
_resume.BadBlocks = _resume.BadBlocks.Distinct().ToList();
|
||||
|
||||
end = DateTime.UtcNow;
|
||||
_dumpStopwatch.Stop();
|
||||
EndProgress?.Invoke();
|
||||
mhddLog.Close();
|
||||
|
||||
ibgLog.Close(_dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
|
||||
ibgLog.Close(_dev, blocks, blockSize, _dumpStopwatch.Elapsed.TotalSeconds, currentSpeed * 1024,
|
||||
blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000), _devicePath);
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Dump_finished_in_0,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second)));
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
@@ -291,7 +291,7 @@ public partial class Dump
|
||||
Per(imageWriteDuration.Seconds())));
|
||||
|
||||
_dumpLog.WriteLine(string.Format(Localization.Core.Dump_finished_in_0,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second)));
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
_dumpLog.WriteLine(string.Format(Localization.Core.Average_dump_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
@@ -307,7 +307,7 @@ public partial class Dump
|
||||
_trim &&
|
||||
newTrim)
|
||||
{
|
||||
start = DateTime.UtcNow;
|
||||
_trimStopwatch.Restart();
|
||||
UpdateStatus?.Invoke(Localization.Core.Trimming_skipped_sectors);
|
||||
_dumpLog.WriteLine(Localization.Core.Trimming_skipped_sectors);
|
||||
|
||||
@@ -344,10 +344,10 @@ public partial class Dump
|
||||
}
|
||||
|
||||
EndProgress?.Invoke();
|
||||
end = DateTime.UtcNow;
|
||||
_trimStopwatch.Stop();
|
||||
|
||||
_dumpLog.WriteLine(string.Format(Localization.Core.Trimming_finished_in_0,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second)));
|
||||
_trimStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
}
|
||||
#endregion Trimming
|
||||
|
||||
@@ -581,14 +581,15 @@ public partial class Dump
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Closing_output_file);
|
||||
UpdateStatus?.Invoke(Localization.Core.Closing_output_file);
|
||||
DateTime closeStart = DateTime.Now;
|
||||
_imageCloseStopwatch.Restart();
|
||||
outputFormat.Close();
|
||||
DateTime closeEnd = DateTime.Now;
|
||||
_imageCloseStopwatch.Stop();
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Closed_in_0,
|
||||
(closeEnd - closeStart).Humanize(minUnit: TimeUnit.Second)));
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Closed_in_0, (closeEnd - closeStart).Humanize(minUnit: TimeUnit.Second));
|
||||
_dumpLog.WriteLine(Localization.Core.Closed_in_0,
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second));
|
||||
|
||||
if(_aborted)
|
||||
{
|
||||
@@ -616,7 +617,7 @@ public partial class Dump
|
||||
return;
|
||||
}
|
||||
|
||||
DateTime chkStart = DateTime.UtcNow;
|
||||
_sidecarStopwatch.Restart();
|
||||
_sidecarClass = new Sidecar(inputPlugin, _outputPath, filter.Id, _encoding);
|
||||
_sidecarClass.InitProgressEvent += InitProgress;
|
||||
_sidecarClass.UpdateProgressEvent += UpdateProgress;
|
||||
@@ -626,21 +627,21 @@ public partial class Dump
|
||||
_sidecarClass.EndProgressEvent2 += EndProgress2;
|
||||
_sidecarClass.UpdateStatusEvent += UpdateStatus;
|
||||
Metadata sidecar = _sidecarClass.Create();
|
||||
end = DateTime.UtcNow;
|
||||
_sidecarStopwatch.Stop();
|
||||
|
||||
if(!_aborted)
|
||||
{
|
||||
totalChkDuration = (end - chkStart).TotalMilliseconds;
|
||||
totalChkDuration = _sidecarStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Sidecar_created_in_0,
|
||||
(end - chkStart).Humanize(minUnit: TimeUnit.Second)));
|
||||
_sidecarStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_checksum_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
Per(totalChkDuration.Milliseconds())));
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Sidecar_created_in_0,
|
||||
(end - chkStart).Humanize(minUnit: TimeUnit.Second));
|
||||
_sidecarStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second));
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Average_checksum_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).Per(totalChkDuration.Milliseconds()).
|
||||
@@ -709,11 +710,11 @@ public partial class Dump
|
||||
|
||||
UpdateStatus?.
|
||||
Invoke(string.Format(Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second),
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second),
|
||||
totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second),
|
||||
(closeEnd - closeStart).Humanize(minUnit: TimeUnit.Second)));
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
|
||||
@@ -66,8 +66,6 @@ public partial class Dump
|
||||
double currentSpeed = 0;
|
||||
double maxSpeed = double.MinValue;
|
||||
double minSpeed = double.MaxValue;
|
||||
DateTime start;
|
||||
DateTime end;
|
||||
byte[] senseBuf;
|
||||
|
||||
if(_outputPlugin is not IWritableOpticalImage outputOptical)
|
||||
@@ -153,7 +151,7 @@ public partial class Dump
|
||||
return;
|
||||
}
|
||||
|
||||
start = DateTime.UtcNow;
|
||||
_dumpStopwatch.Restart();
|
||||
double imageWriteDuration = 0;
|
||||
|
||||
outputOptical.SetTracks(new List<Track>
|
||||
@@ -206,7 +204,7 @@ public partial class Dump
|
||||
|
||||
bool newTrim = false;
|
||||
|
||||
DateTime timeSpeedStart = DateTime.UtcNow;
|
||||
_speedStopwatch.Restart();
|
||||
ulong sectorSpeedStart = 0;
|
||||
InitProgress?.Invoke();
|
||||
|
||||
@@ -241,14 +239,15 @@ public partial class Dump
|
||||
|
||||
totalDuration += cmdDuration;
|
||||
|
||||
_writeStopwatch.Restart();
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
{
|
||||
mhddLog.Write(i, cmdDuration, blocksToRead);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
DateTime writeStart = DateTime.Now;
|
||||
outputOptical.WriteSectors(readBuffer, i, blocksToRead);
|
||||
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
extents.Add(i, blocksToRead, true);
|
||||
_mediaGraph?.PaintSectorsGood(i, blocksToRead);
|
||||
}
|
||||
@@ -264,9 +263,8 @@ public partial class Dump
|
||||
_skip = (uint)(blocks - i);
|
||||
|
||||
// Write empty data
|
||||
DateTime writeStart = DateTime.Now;
|
||||
outputOptical.WriteSectors(new byte[blockSize * _skip], i, _skip);
|
||||
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
for(ulong b = i; b < i + _skip; b++)
|
||||
_resume.BadBlocks.Add(b);
|
||||
@@ -279,30 +277,31 @@ public partial class Dump
|
||||
newTrim = true;
|
||||
}
|
||||
|
||||
_writeStopwatch.Stop();
|
||||
sectorSpeedStart += blocksToRead;
|
||||
_resume.NextBlock = i + blocksToRead;
|
||||
|
||||
double elapsed = (DateTime.UtcNow - timeSpeedStart).TotalSeconds;
|
||||
double elapsed = _speedStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
if(elapsed <= 0)
|
||||
continue;
|
||||
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed);
|
||||
sectorSpeedStart = 0;
|
||||
timeSpeedStart = DateTime.UtcNow;
|
||||
_speedStopwatch.Restart();
|
||||
}
|
||||
|
||||
_resume.BadBlocks = _resume.BadBlocks.Distinct().ToList();
|
||||
|
||||
end = DateTime.UtcNow;
|
||||
_dumpStopwatch.Stop();
|
||||
EndProgress?.Invoke();
|
||||
mhddLog.Close();
|
||||
|
||||
ibgLog.Close(_dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
|
||||
ibgLog.Close(_dev, blocks, blockSize, _dumpStopwatch.Elapsed.TotalSeconds, currentSpeed * 1024,
|
||||
blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000), _devicePath);
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Dump_finished_in_0,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second)));
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
@@ -313,7 +312,7 @@ public partial class Dump
|
||||
Per(imageWriteDuration.Seconds())));
|
||||
|
||||
_dumpLog.WriteLine(string.Format(Localization.Core.Dump_finished_in_0,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second)));
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
_dumpLog.WriteLine(string.Format(Localization.Core.Average_dump_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
@@ -329,7 +328,7 @@ public partial class Dump
|
||||
_trim &&
|
||||
newTrim)
|
||||
{
|
||||
start = DateTime.UtcNow;
|
||||
_trimStopwatch.Restart();
|
||||
_dumpLog.WriteLine(Localization.Core.Trimming_skipped_sectors);
|
||||
|
||||
ulong[] tmpArray = _resume.BadBlocks.ToArray();
|
||||
@@ -364,10 +363,10 @@ public partial class Dump
|
||||
}
|
||||
|
||||
EndProgress?.Invoke();
|
||||
end = DateTime.UtcNow;
|
||||
_trimStopwatch.Stop();
|
||||
|
||||
_dumpLog.WriteLine(string.Format(Localization.Core.Trimming_finished_in_0,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second)));
|
||||
_trimStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
}
|
||||
#endregion Trimming
|
||||
|
||||
@@ -587,10 +586,12 @@ public partial class Dump
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Closing_output_file);
|
||||
UpdateStatus?.Invoke(Localization.Core.Closing_output_file);
|
||||
DateTime closeStart = DateTime.Now;
|
||||
_imageCloseStopwatch.Restart();
|
||||
outputOptical.Close();
|
||||
DateTime closeEnd = DateTime.Now;
|
||||
_dumpLog.WriteLine(Localization.Core.Closed_in_0, (closeEnd - closeStart).Humanize(minUnit: TimeUnit.Second));
|
||||
_imageCloseStopwatch.Stop();
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Closed_in_0,
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second));
|
||||
|
||||
if(_aborted)
|
||||
{
|
||||
@@ -609,11 +610,11 @@ public partial class Dump
|
||||
|
||||
UpdateStatus?.
|
||||
Invoke(string.Format(Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second),
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second),
|
||||
totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second),
|
||||
(closeEnd - closeStart).Humanize(minUnit: TimeUnit.Second)));
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
|
||||
@@ -67,8 +67,6 @@ partial class Dump
|
||||
uint blockSize;
|
||||
ulong blocks = 0;
|
||||
MediaType dskType;
|
||||
DateTime start;
|
||||
DateTime end;
|
||||
double totalDuration = 0;
|
||||
double currentSpeed = 0;
|
||||
double maxSpeed = double.MinValue;
|
||||
@@ -796,7 +794,7 @@ partial class Dump
|
||||
return;
|
||||
}
|
||||
|
||||
start = DateTime.UtcNow;
|
||||
_dumpStopwatch.Restart();
|
||||
var mhddLog = new MhddLog(_outputPrefix + ".mhddlog.bin", _dev, blocks, blockSize, 1, _private);
|
||||
var ibgLog = new IbgLog(_outputPrefix + ".ibg", 0x0008);
|
||||
|
||||
@@ -832,12 +830,13 @@ partial class Dump
|
||||
if(mode10Data != null)
|
||||
outputTape.WriteMediaTag(mode10Data, MediaTagType.SCSI_MODESENSE_10);
|
||||
|
||||
DateTime timeSpeedStart = DateTime.UtcNow;
|
||||
ulong currentSpeedSize = 0;
|
||||
double imageWriteDuration = 0;
|
||||
|
||||
InitProgress?.Invoke();
|
||||
|
||||
_speedStopwatch.Restart();
|
||||
|
||||
while(currentPartition < totalPartitions)
|
||||
{
|
||||
if(_aborted)
|
||||
@@ -1053,9 +1052,9 @@ partial class Dump
|
||||
return; // TODO: Return more cleanly
|
||||
|
||||
// Write empty data
|
||||
DateTime writeStart = DateTime.Now;
|
||||
_writeStopwatch.Restart();
|
||||
outputTape.WriteSector(new byte[blockSize], currentBlock);
|
||||
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
mhddLog.Write(currentBlock, duration < 500 ? 65535 : duration);
|
||||
ibgLog.Write(currentBlock, 0);
|
||||
@@ -1065,29 +1064,31 @@ partial class Dump
|
||||
{
|
||||
mhddLog.Write(currentBlock, duration);
|
||||
ibgLog.Write(currentBlock, currentSpeed * 1024);
|
||||
DateTime writeStart = DateTime.Now;
|
||||
_writeStopwatch.Restart();
|
||||
outputTape.WriteSector(cmdBuf, currentBlock);
|
||||
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
extents.Add(currentBlock, 1, true);
|
||||
}
|
||||
|
||||
_writeStopwatch.Stop();
|
||||
currentBlock++;
|
||||
_resume.NextBlock++;
|
||||
currentSpeedSize += blockSize;
|
||||
|
||||
double elapsed = (DateTime.UtcNow - timeSpeedStart).TotalSeconds;
|
||||
double elapsed = _speedStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
if(elapsed <= 0)
|
||||
continue;
|
||||
|
||||
currentSpeed = currentSpeedSize / (1048576 * elapsed);
|
||||
currentSpeedSize = 0;
|
||||
timeSpeedStart = DateTime.UtcNow;
|
||||
_speedStopwatch.Restart();
|
||||
}
|
||||
|
||||
_resume.BadBlocks = _resume.BadBlocks.Distinct().ToList();
|
||||
blocks = currentBlock + 1;
|
||||
end = DateTime.UtcNow;
|
||||
_speedStopwatch.Stop();
|
||||
_dumpStopwatch.Stop();
|
||||
|
||||
// If not aborted this is added at the end of medium
|
||||
if(_aborted)
|
||||
@@ -1102,11 +1103,11 @@ partial class Dump
|
||||
EndProgress?.Invoke();
|
||||
mhddLog.Close();
|
||||
|
||||
ibgLog.Close(_dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
|
||||
ibgLog.Close(_dev, blocks, blockSize, _dumpStopwatch.Elapsed.TotalSeconds, currentSpeed * 1024,
|
||||
blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000), _devicePath);
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Dump_finished_in_0,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second)));
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
@@ -1117,7 +1118,7 @@ partial class Dump
|
||||
Per(imageWriteDuration.Seconds())));
|
||||
|
||||
_dumpLog.WriteLine(string.Format(Localization.Core.Dump_finished_in_0,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second)));
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
_dumpLog.WriteLine(string.Format(Localization.Core.Average_dump_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
@@ -1323,14 +1324,15 @@ partial class Dump
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Closing_output_file);
|
||||
UpdateStatus?.Invoke(Localization.Core.Closing_output_file);
|
||||
DateTime closeStart = DateTime.Now;
|
||||
_imageCloseStopwatch.Restart();
|
||||
outputTape.Close();
|
||||
DateTime closeEnd = DateTime.Now;
|
||||
_imageCloseStopwatch.Stop();
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Closed_in_0,
|
||||
(closeEnd - closeStart).Humanize(minUnit: TimeUnit.Second)));
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Closed_in_0, (closeEnd - closeStart).Humanize(minUnit: TimeUnit.Second));
|
||||
_dumpLog.WriteLine(Localization.Core.Closed_in_0,
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second));
|
||||
|
||||
if(_aborted)
|
||||
{
|
||||
@@ -1366,7 +1368,7 @@ partial class Dump
|
||||
return;
|
||||
}
|
||||
|
||||
DateTime chkStart = DateTime.UtcNow;
|
||||
_sidecarStopwatch.Restart();
|
||||
_sidecarClass = new Sidecar(inputPlugin, _outputPath, filter.Id, _encoding);
|
||||
_sidecarClass.InitProgressEvent += InitProgress;
|
||||
_sidecarClass.UpdateProgressEvent += UpdateProgress;
|
||||
@@ -1376,21 +1378,21 @@ partial class Dump
|
||||
_sidecarClass.EndProgressEvent2 += EndProgress2;
|
||||
_sidecarClass.UpdateStatusEvent += UpdateStatus;
|
||||
Metadata sidecar = _sidecarClass.Create();
|
||||
end = DateTime.UtcNow;
|
||||
_sidecarStopwatch.Stop();
|
||||
|
||||
if(!_aborted)
|
||||
{
|
||||
totalChkDuration = (end - chkStart).TotalMilliseconds;
|
||||
totalChkDuration = _sidecarStopwatch.ElapsedMilliseconds;
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Sidecar_created_in_0,
|
||||
(end - chkStart).Humanize(minUnit: TimeUnit.Second)));
|
||||
_sidecarStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_checksum_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
Per(totalChkDuration.Milliseconds())));
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Sidecar_created_in_0,
|
||||
(end - chkStart).Humanize(minUnit: TimeUnit.Second));
|
||||
_sidecarStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second));
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Average_checksum_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).Per(totalChkDuration.Milliseconds()).
|
||||
@@ -1471,11 +1473,11 @@ partial class Dump
|
||||
|
||||
UpdateStatus?.
|
||||
Invoke(string.Format(Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second),
|
||||
_sidecarStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second),
|
||||
totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second),
|
||||
(closeEnd - closeStart).Humanize(minUnit: TimeUnit.Second)));
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
// Copyright © 2020-2023 Rebecca Wallander
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
@@ -71,7 +70,6 @@ partial class Dump
|
||||
{
|
||||
ulong sectorSpeedStart = 0;
|
||||
bool sense;
|
||||
DateTime timeSpeedStart = DateTime.UtcNow;
|
||||
byte[] buffer;
|
||||
uint blocksToRead = maxBlocksToRead;
|
||||
var outputFormat = _outputPlugin as IWritableImage;
|
||||
@@ -212,9 +210,9 @@ partial class Dump
|
||||
|
||||
mhddLog.Write(i, cmdDuration, blocksToRead);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
DateTime writeStart = DateTime.Now;
|
||||
_writeStopwatch.Restart();
|
||||
outputFormat.WriteSectors(buffer, i, blocksToRead);
|
||||
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
extents.Add(i, blocksToRead, true);
|
||||
_mediaGraph?.PaintSectorsGood(i, blocksToRead);
|
||||
}
|
||||
@@ -244,9 +242,9 @@ partial class Dump
|
||||
_skip = (uint)(blocks - i);
|
||||
|
||||
// Write empty data
|
||||
DateTime writeStart = DateTime.Now;
|
||||
_writeStopwatch.Restart();
|
||||
outputFormat.WriteSectors(new byte[blockSize * _skip], i, _skip);
|
||||
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
for(ulong b = i; b < i + _skip; b++)
|
||||
_resume.BadBlocks.Add(b);
|
||||
@@ -259,19 +257,21 @@ partial class Dump
|
||||
newTrim = true;
|
||||
}
|
||||
|
||||
_writeStopwatch.Stop();
|
||||
sectorSpeedStart += blocksToRead;
|
||||
_resume.NextBlock = i + blocksToRead;
|
||||
|
||||
double elapsed = (DateTime.UtcNow - timeSpeedStart).TotalSeconds;
|
||||
double elapsed = _speedStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
if(elapsed <= 0)
|
||||
continue;
|
||||
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed);
|
||||
sectorSpeedStart = 0;
|
||||
timeSpeedStart = DateTime.UtcNow;
|
||||
_speedStopwatch.Restart();
|
||||
}
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
_resume.BadBlocks = _resume.BadBlocks.Distinct().ToList();
|
||||
|
||||
EndProgress?.Invoke();
|
||||
|
||||
@@ -80,8 +80,6 @@ partial class Dump
|
||||
byte scsiDensityCode = 0;
|
||||
bool containsFloppyPage = false;
|
||||
const ushort sbcProfile = 0x0001;
|
||||
DateTime start;
|
||||
DateTime end;
|
||||
double totalDuration = 0;
|
||||
double currentSpeed = 0;
|
||||
double maxSpeed = double.MinValue;
|
||||
@@ -363,7 +361,7 @@ partial class Dump
|
||||
imageCreated = true;
|
||||
}
|
||||
|
||||
start = DateTime.UtcNow;
|
||||
_dumpStopwatch.Restart();
|
||||
double imageWriteDuration = 0;
|
||||
bool writeSingleOpticalTrack = true;
|
||||
|
||||
@@ -759,14 +757,14 @@ partial class Dump
|
||||
mediaTags.ContainsKey(MediaTagType.DVD_DiscKey_Decrypted)
|
||||
? mediaTags[MediaTagType.DVD_DiscKey_Decrypted] : null);
|
||||
|
||||
end = DateTime.UtcNow;
|
||||
_dumpStopwatch.Stop();
|
||||
mhddLog.Close();
|
||||
|
||||
ibgLog.Close(_dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
|
||||
ibgLog.Close(_dev, blocks, blockSize, _dumpStopwatch.Elapsed.TotalSeconds, currentSpeed * 1024,
|
||||
blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000), _devicePath);
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Dump_finished_in_0,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second)));
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
@@ -777,7 +775,7 @@ partial class Dump
|
||||
Per(imageWriteDuration.Seconds())));
|
||||
|
||||
_dumpLog.WriteLine(string.Format(Localization.Core.Dump_finished_in_0,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second)));
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
_dumpLog.WriteLine(string.Format(Localization.Core.Average_dump_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
@@ -793,7 +791,7 @@ partial class Dump
|
||||
_trim &&
|
||||
newTrim)
|
||||
{
|
||||
start = DateTime.UtcNow;
|
||||
_trimStopwatch.Restart();
|
||||
UpdateStatus?.Invoke(Localization.Core.Trimming_skipped_sectors);
|
||||
_dumpLog.WriteLine(Localization.Core.Trimming_skipped_sectors);
|
||||
|
||||
@@ -802,13 +800,15 @@ partial class Dump
|
||||
TrimSbcData(scsiReader, extents, currentTry, blankExtents);
|
||||
|
||||
EndProgress?.Invoke();
|
||||
end = DateTime.UtcNow;
|
||||
_trimStopwatch.Stop();
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Trimming_finished_in_0,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second)));
|
||||
_trimStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
_dumpLog.WriteLine(string.Format(Localization.Core.Trimming_finished_in_0,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second)));
|
||||
_trimStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
_trimStopwatch.Stop();
|
||||
}
|
||||
#endregion Trimming
|
||||
|
||||
@@ -1010,14 +1010,15 @@ partial class Dump
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Closing_output_file);
|
||||
UpdateStatus?.Invoke(Localization.Core.Closing_output_file);
|
||||
DateTime closeStart = DateTime.Now;
|
||||
_imageCloseStopwatch.Restart();
|
||||
outputFormat.Close();
|
||||
DateTime closeEnd = DateTime.Now;
|
||||
_imageCloseStopwatch.Stop();
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Closed_in_0,
|
||||
(closeEnd - closeStart).Humanize(minUnit: TimeUnit.Second)));
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Closed_in_0, (closeEnd - closeStart).Humanize(minUnit: TimeUnit.Second));
|
||||
_dumpLog.WriteLine(Localization.Core.Closed_in_0,
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second));
|
||||
|
||||
if(_aborted)
|
||||
{
|
||||
@@ -1051,7 +1052,7 @@ partial class Dump
|
||||
return;
|
||||
}
|
||||
|
||||
DateTime chkStart = DateTime.UtcNow;
|
||||
_sidecarStopwatch.Restart();
|
||||
_sidecarClass = new Sidecar(inputPlugin, _outputPath, filter.Id, _encoding);
|
||||
_sidecarClass.InitProgressEvent += InitProgress;
|
||||
_sidecarClass.UpdateProgressEvent += UpdateProgress;
|
||||
@@ -1061,21 +1062,21 @@ partial class Dump
|
||||
_sidecarClass.EndProgressEvent2 += EndProgress2;
|
||||
_sidecarClass.UpdateStatusEvent += UpdateStatus;
|
||||
Metadata sidecar = _sidecarClass.Create();
|
||||
end = DateTime.UtcNow;
|
||||
_sidecarStopwatch.Stop();
|
||||
|
||||
if(!_aborted)
|
||||
{
|
||||
totalChkDuration = (end - chkStart).TotalMilliseconds;
|
||||
totalChkDuration = _sidecarStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Sidecar_created_in_0,
|
||||
(end - chkStart).Humanize(minUnit: TimeUnit.Second)));
|
||||
_sidecarStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_checksum_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
Per(totalChkDuration.Milliseconds())));
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Sidecar_created_in_0,
|
||||
(end - chkStart).Humanize(minUnit: TimeUnit.Second));
|
||||
_sidecarStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second));
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Average_checksum_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
@@ -1295,11 +1296,11 @@ partial class Dump
|
||||
|
||||
UpdateStatus?.
|
||||
Invoke(string.Format(Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second),
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second),
|
||||
totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second),
|
||||
(closeEnd - closeStart).Humanize(minUnit: TimeUnit.Second)));
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
|
||||
@@ -53,7 +53,6 @@ partial class Dump
|
||||
bool sense;
|
||||
byte[] buffer;
|
||||
ulong sectorSpeedStart = 0;
|
||||
DateTime timeSpeedStart = DateTime.UtcNow;
|
||||
bool canMediumScan = true;
|
||||
var outputFormat = _outputPlugin as IWritableImage;
|
||||
|
||||
@@ -185,6 +184,8 @@ partial class Dump
|
||||
if(extent.Item1 < _resume.NextBlock)
|
||||
nextBlock = (uint)_resume.NextBlock;
|
||||
|
||||
_speedStopwatch.Restart();
|
||||
|
||||
for(ulong i = nextBlock; i <= extent.Item2; i += blocksToRead)
|
||||
{
|
||||
if(_aborted)
|
||||
@@ -219,9 +220,9 @@ partial class Dump
|
||||
{
|
||||
mhddLog.Write(i, cmdDuration, blocksToRead);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
DateTime writeStart = DateTime.Now;
|
||||
_writeStopwatch.Restart();
|
||||
outputFormat.WriteSectors(buffer, i, blocksToRead);
|
||||
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
extents.Add(i, blocksToRead, true);
|
||||
}
|
||||
else
|
||||
@@ -234,9 +235,9 @@ partial class Dump
|
||||
_skip = (uint)(extent.Item2 + 1 - i);
|
||||
|
||||
// Write empty data
|
||||
DateTime writeStart = DateTime.Now;
|
||||
_writeStopwatch.Restart();
|
||||
outputFormat.WriteSectors(new byte[blockSize * _skip], i, _skip);
|
||||
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
for(ulong b = i; b < i + _skip; b++)
|
||||
_resume.BadBlocks.Add(b);
|
||||
@@ -249,20 +250,22 @@ partial class Dump
|
||||
newTrim = true;
|
||||
}
|
||||
|
||||
_writeStopwatch.Stop();
|
||||
sectorSpeedStart += blocksToRead;
|
||||
_resume.NextBlock = i + blocksToRead;
|
||||
|
||||
double elapsed = (DateTime.UtcNow - timeSpeedStart).TotalSeconds;
|
||||
double elapsed = _speedStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
if(elapsed <= 0)
|
||||
continue;
|
||||
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed);
|
||||
sectorSpeedStart = 0;
|
||||
timeSpeedStart = DateTime.UtcNow;
|
||||
_speedStopwatch.Restart();
|
||||
}
|
||||
}
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
_resume.BadBlocks = _resume.BadBlocks.Distinct().ToList();
|
||||
|
||||
EndProgress?.Invoke();
|
||||
|
||||
@@ -248,8 +248,6 @@ public partial class Dump
|
||||
else
|
||||
mediaTags.Add(_dev.Type == DeviceType.SecureDigital ? MediaTagType.SD_CID : MediaTagType.MMC_CID, null);
|
||||
|
||||
DateTime start;
|
||||
DateTime end;
|
||||
double totalDuration = 0;
|
||||
double currentSpeed = 0;
|
||||
double maxSpeed = double.MinValue;
|
||||
@@ -620,10 +618,10 @@ public partial class Dump
|
||||
_mediaGraph?.PaintSectorsBad(_resume.BadBlocks);
|
||||
}
|
||||
|
||||
start = DateTime.UtcNow;
|
||||
_dumpStopwatch.Restart();
|
||||
_speedStopwatch.Restart();
|
||||
double imageWriteDuration = 0;
|
||||
bool newTrim = false;
|
||||
DateTime timeSpeedStart = DateTime.UtcNow;
|
||||
ulong sectorSpeedStart = 0;
|
||||
|
||||
InitProgress?.Invoke();
|
||||
@@ -670,9 +668,9 @@ public partial class Dump
|
||||
{
|
||||
mhddLog.Write(i, duration, blocksToRead);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
DateTime writeStart = DateTime.Now;
|
||||
_writeStopwatch.Restart();
|
||||
outputFormat.WriteSectors(cmdBuf, i, blocksToRead);
|
||||
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
extents.Add(i, blocksToRead, true);
|
||||
_mediaGraph?.PaintSectorsGood(i, blocksToRead);
|
||||
}
|
||||
@@ -689,38 +687,40 @@ public partial class Dump
|
||||
mhddLog.Write(i, duration < 500 ? 65535 : duration, _skip);
|
||||
|
||||
ibgLog.Write(i, 0);
|
||||
DateTime writeStart = DateTime.Now;
|
||||
_writeStopwatch.Restart();
|
||||
outputFormat.WriteSectors(new byte[blockSize * _skip], i, _skip);
|
||||
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
_dumpLog.WriteLine(Localization.Core.Skipping_0_blocks_from_errored_block_1, _skip, i);
|
||||
i += _skip - blocksToRead;
|
||||
newTrim = true;
|
||||
}
|
||||
|
||||
_writeStopwatch.Stop();
|
||||
sectorSpeedStart += blocksToRead;
|
||||
_resume.NextBlock = i + blocksToRead;
|
||||
|
||||
double elapsed = (DateTime.UtcNow - timeSpeedStart).TotalSeconds;
|
||||
double elapsed = _speedStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
if(elapsed <= 0)
|
||||
continue;
|
||||
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed);
|
||||
sectorSpeedStart = 0;
|
||||
timeSpeedStart = DateTime.UtcNow;
|
||||
_speedStopwatch.Restart();
|
||||
}
|
||||
|
||||
_resume.BadBlocks = _resume.BadBlocks.Distinct().ToList();
|
||||
|
||||
end = DateTime.Now;
|
||||
_speedStopwatch.Stop();
|
||||
_dumpStopwatch.Stop();
|
||||
EndProgress?.Invoke();
|
||||
mhddLog.Close();
|
||||
|
||||
ibgLog.Close(_dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
|
||||
ibgLog.Close(_dev, blocks, blockSize, _dumpStopwatch.Elapsed.TotalSeconds, currentSpeed * 1024,
|
||||
blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000), _devicePath);
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Dump_finished_in_0,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second)));
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
@@ -731,7 +731,7 @@ public partial class Dump
|
||||
Per(imageWriteDuration.Seconds())));
|
||||
|
||||
_dumpLog.WriteLine(string.Format(Localization.Core.Dump_finished_in_0,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second)));
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
_dumpLog.WriteLine(string.Format(Localization.Core.Average_dump_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
@@ -747,7 +747,7 @@ public partial class Dump
|
||||
_trim &&
|
||||
newTrim)
|
||||
{
|
||||
start = DateTime.UtcNow;
|
||||
_trimStopwatch.Restart();
|
||||
UpdateStatus?.Invoke(Localization.Core.Trimming_skipped_sectors);
|
||||
_dumpLog.WriteLine(Localization.Core.Trimming_skipped_sectors);
|
||||
|
||||
@@ -786,13 +786,13 @@ public partial class Dump
|
||||
}
|
||||
|
||||
EndProgress?.Invoke();
|
||||
end = DateTime.UtcNow;
|
||||
_trimStopwatch.Stop();
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Trimming_finished_in_0,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second)));
|
||||
_trimStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
_dumpLog.WriteLine(string.Format(Localization.Core.Trimming_finished_in_0,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second)));
|
||||
_trimStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
}
|
||||
#endregion Trimming
|
||||
|
||||
@@ -886,14 +886,15 @@ public partial class Dump
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Closing_output_file);
|
||||
UpdateStatus?.Invoke(Localization.Core.Closing_output_file);
|
||||
DateTime closeStart = DateTime.Now;
|
||||
_imageCloseStopwatch.Restart();
|
||||
outputFormat.Close();
|
||||
DateTime closeEnd = DateTime.Now;
|
||||
_imageCloseStopwatch.Stop();
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Closed_in_0,
|
||||
(closeEnd - closeStart).Humanize(minUnit: TimeUnit.Second)));
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Closed_in_0, (closeEnd - closeStart).Humanize(minUnit: TimeUnit.Second));
|
||||
_dumpLog.WriteLine(Localization.Core.Closed_in_0,
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second));
|
||||
|
||||
if(_aborted)
|
||||
{
|
||||
@@ -917,7 +918,7 @@ public partial class Dump
|
||||
if(opened != ErrorNumber.NoError)
|
||||
StoppingErrorMessage?.Invoke(string.Format(Localization.Core.Error_0_opening_created_image, opened));
|
||||
|
||||
DateTime chkStart = DateTime.UtcNow;
|
||||
_sidecarStopwatch.Restart();
|
||||
_sidecarClass = new Sidecar(inputPlugin, _outputPath, filter.Id, _encoding);
|
||||
_sidecarClass.InitProgressEvent += InitProgress;
|
||||
_sidecarClass.UpdateProgressEvent += UpdateProgress;
|
||||
@@ -927,6 +928,7 @@ public partial class Dump
|
||||
_sidecarClass.EndProgressEvent2 += EndProgress2;
|
||||
_sidecarClass.UpdateStatusEvent += UpdateStatus;
|
||||
Metadata sidecar = _sidecarClass.Create();
|
||||
_sidecarStopwatch.Stop();
|
||||
|
||||
if(!_aborted)
|
||||
{
|
||||
@@ -936,19 +938,17 @@ public partial class Dump
|
||||
sidecar = _preSidecar;
|
||||
}
|
||||
|
||||
end = DateTime.UtcNow;
|
||||
|
||||
totalChkDuration = (end - chkStart).TotalMilliseconds;
|
||||
totalChkDuration = _sidecarStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Sidecar_created_in_0,
|
||||
(end - chkStart).Humanize(minUnit: TimeUnit.Second)));
|
||||
_sidecarStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_checksum_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
Per(totalChkDuration.Milliseconds())));
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Sidecar_created_in_0,
|
||||
(end - chkStart).Humanize(minUnit: TimeUnit.Second));
|
||||
_sidecarStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second));
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Average_checksum_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).Per(totalChkDuration.Milliseconds()).
|
||||
@@ -1004,11 +1004,11 @@ public partial class Dump
|
||||
|
||||
UpdateStatus?.
|
||||
Invoke(string.Format(Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second),
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second),
|
||||
totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second),
|
||||
(closeEnd - closeStart).Humanize(minUnit: TimeUnit.Second)));
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
|
||||
@@ -72,8 +72,6 @@ partial class Dump
|
||||
bool sense;
|
||||
const uint blockSize = 2048;
|
||||
uint blocksToRead = 64;
|
||||
DateTime start;
|
||||
DateTime end;
|
||||
double totalDuration = 0;
|
||||
double currentSpeed = 0;
|
||||
double maxSpeed = double.MinValue;
|
||||
@@ -520,7 +518,7 @@ partial class Dump
|
||||
return;
|
||||
}
|
||||
|
||||
start = DateTime.UtcNow;
|
||||
_dumpStopwatch.Restart();
|
||||
double imageWriteDuration = 0;
|
||||
|
||||
double cmdDuration = 0;
|
||||
@@ -577,7 +575,7 @@ partial class Dump
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Reading_game_partition);
|
||||
UpdateStatus?.Invoke(Localization.Core.Reading_game_partition);
|
||||
DateTime timeSpeedStart = DateTime.UtcNow;
|
||||
_speedStopwatch.Restart();
|
||||
ulong sectorSpeedStart = 0;
|
||||
InitProgress?.Invoke();
|
||||
|
||||
@@ -662,9 +660,9 @@ partial class Dump
|
||||
{
|
||||
mhddLog.Write(i, cmdDuration, blocksToRead);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
DateTime writeStart = DateTime.Now;
|
||||
_writeStopwatch.Restart();
|
||||
outputFormat.WriteSectors(readBuffer, i, blocksToRead);
|
||||
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
extents.Add(i, blocksToRead, true);
|
||||
_mediaGraph?.PaintSectorsGood(i, blocksToRead);
|
||||
}
|
||||
@@ -680,9 +678,9 @@ partial class Dump
|
||||
_skip = (uint)(blocks - i);
|
||||
|
||||
// Write empty data
|
||||
DateTime writeStart = DateTime.Now;
|
||||
_writeStopwatch.Restart();
|
||||
outputFormat.WriteSectors(new byte[blockSize * _skip], i, _skip);
|
||||
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
for(ulong b = i; b < i + _skip; b++)
|
||||
_resume.BadBlocks.Add(b);
|
||||
@@ -708,21 +706,24 @@ partial class Dump
|
||||
newTrim = true;
|
||||
}
|
||||
|
||||
_writeStopwatch.Stop();
|
||||
blocksToRead = saveBlocksToRead;
|
||||
currentSector = i + 1;
|
||||
_resume.NextBlock = currentSector;
|
||||
sectorSpeedStart += blocksToRead;
|
||||
|
||||
double elapsed = (DateTime.UtcNow - timeSpeedStart).TotalSeconds;
|
||||
double elapsed = _speedStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
if(elapsed <= 0)
|
||||
continue;
|
||||
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed);
|
||||
sectorSpeedStart = 0;
|
||||
timeSpeedStart = DateTime.UtcNow;
|
||||
_speedStopwatch.Restart();
|
||||
}
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
for(ulong i = extentStart; i <= extentEnd; i += blocksToRead)
|
||||
{
|
||||
saveBlocksToRead = blocksToRead;
|
||||
@@ -743,9 +744,9 @@ partial class Dump
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
|
||||
// Write empty data
|
||||
DateTime writeStart = DateTime.Now;
|
||||
_writeStopwatch.Restart();
|
||||
outputFormat.WriteSectors(new byte[blockSize * blocksToRead], i, blocksToRead);
|
||||
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
blocksToRead = saveBlocksToRead;
|
||||
extents.Add(i, blocksToRead, true);
|
||||
currentSector = i + 1;
|
||||
@@ -757,6 +758,7 @@ partial class Dump
|
||||
currentSector = extentEnd + 1;
|
||||
}
|
||||
|
||||
_writeStopwatch.Stop();
|
||||
_resume.BadBlocks = _resume.BadBlocks.Distinct().ToList();
|
||||
|
||||
EndProgress?.Invoke();
|
||||
@@ -788,10 +790,11 @@ partial class Dump
|
||||
ibgLog.Write(middle + currentSector, currentSpeed * 1024);
|
||||
|
||||
// Write empty data
|
||||
DateTime writeStart = DateTime.Now;
|
||||
_writeStopwatch.Restart();
|
||||
outputFormat.WriteSectors(new byte[blockSize * blocksToRead], middle + currentSector, blocksToRead);
|
||||
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
extents.Add(currentSector, blocksToRead, true);
|
||||
_writeStopwatch.Stop();
|
||||
|
||||
currentSector += blocksToRead;
|
||||
_resume.NextBlock = currentSector;
|
||||
@@ -863,9 +866,9 @@ partial class Dump
|
||||
{
|
||||
mhddLog.Write(currentSector, cmdDuration, blocksToRead);
|
||||
ibgLog.Write(currentSector, currentSpeed * 1024);
|
||||
DateTime writeStart = DateTime.Now;
|
||||
_writeStopwatch.Restart();
|
||||
outputFormat.WriteSectors(readBuffer, currentSector, blocksToRead);
|
||||
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
extents.Add(currentSector, blocksToRead, true);
|
||||
_mediaGraph?.PaintSectorsGood(currentSector, blocksToRead);
|
||||
}
|
||||
@@ -878,9 +881,9 @@ partial class Dump
|
||||
return; // TODO: Return more cleanly
|
||||
|
||||
// Write empty data
|
||||
DateTime writeStart = DateTime.Now;
|
||||
_writeStopwatch.Restart();
|
||||
outputFormat.WriteSectors(new byte[blockSize * _skip], currentSector, _skip);
|
||||
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
// TODO: Handle errors in video partition
|
||||
//errored += blocksToRead;
|
||||
@@ -901,18 +904,20 @@ partial class Dump
|
||||
_dumpLog.WriteLine(senseLine);
|
||||
}
|
||||
|
||||
_writeStopwatch.Stop();
|
||||
|
||||
currentSector += blocksToRead;
|
||||
_resume.NextBlock = currentSector;
|
||||
sectorSpeedStart += blocksToRead;
|
||||
|
||||
double elapsed = (DateTime.UtcNow - timeSpeedStart).TotalSeconds;
|
||||
double elapsed = _speedStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
if(elapsed <= 0)
|
||||
continue;
|
||||
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed);
|
||||
sectorSpeedStart = 0;
|
||||
timeSpeedStart = DateTime.UtcNow;
|
||||
_speedStopwatch.Restart();
|
||||
}
|
||||
|
||||
EndProgress?.Invoke();
|
||||
@@ -939,15 +944,15 @@ partial class Dump
|
||||
return;
|
||||
}
|
||||
|
||||
end = DateTime.UtcNow;
|
||||
_dumpStopwatch.Stop();
|
||||
AaruConsole.WriteLine();
|
||||
mhddLog.Close();
|
||||
|
||||
ibgLog.Close(_dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
|
||||
ibgLog.Close(_dev, blocks, blockSize, _dumpStopwatch.Elapsed.TotalSeconds, currentSpeed * 1024,
|
||||
blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000), _devicePath);
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Dump_finished_in_0,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second)));
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_dump_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
@@ -958,7 +963,7 @@ partial class Dump
|
||||
Per(imageWriteDuration.Seconds())));
|
||||
|
||||
_dumpLog.WriteLine(string.Format(Localization.Core.Dump_finished_in_0,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second)));
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
_dumpLog.WriteLine(string.Format(Localization.Core.Average_dump_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
@@ -974,7 +979,7 @@ partial class Dump
|
||||
_trim &&
|
||||
newTrim)
|
||||
{
|
||||
start = DateTime.UtcNow;
|
||||
_trimStopwatch.Restart();
|
||||
UpdateStatus?.Invoke(Localization.Core.Trimming_skipped_sectors);
|
||||
_dumpLog.WriteLine(Localization.Core.Trimming_skipped_sectors);
|
||||
|
||||
@@ -1012,13 +1017,13 @@ partial class Dump
|
||||
}
|
||||
|
||||
EndProgress?.Invoke();
|
||||
end = DateTime.UtcNow;
|
||||
_trimStopwatch.Stop();
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Trimming_finished_in_0,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second)));
|
||||
_trimStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
_dumpLog.WriteLine(string.Format(Localization.Core.Trimming_finished_in_0,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second)));
|
||||
_trimStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
}
|
||||
#endregion Trimming
|
||||
|
||||
@@ -1284,14 +1289,15 @@ partial class Dump
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Closing_output_file);
|
||||
UpdateStatus?.Invoke(Localization.Core.Closing_output_file);
|
||||
DateTime closeStart = DateTime.Now;
|
||||
_imageCloseStopwatch.Restart();
|
||||
outputFormat.Close();
|
||||
DateTime closeEnd = DateTime.Now;
|
||||
_imageCloseStopwatch.Stop();
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Closed_in_0,
|
||||
(closeEnd - closeStart).Humanize(minUnit: TimeUnit.Second)));
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Closed_in_0, (closeEnd - closeStart).Humanize(minUnit: TimeUnit.Second));
|
||||
_dumpLog.WriteLine(Localization.Core.Closed_in_0,
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second));
|
||||
|
||||
if(_aborted)
|
||||
{
|
||||
@@ -1324,11 +1330,11 @@ partial class Dump
|
||||
|
||||
UpdateStatus?.
|
||||
Invoke(string.Format(Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing,
|
||||
(end - start).Humanize(minUnit: TimeUnit.Second),
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second),
|
||||
totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second),
|
||||
(closeEnd - closeStart).Humanize(minUnit: TimeUnit.Second)));
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
|
||||
@@ -102,8 +102,6 @@ public sealed partial class MediaScan
|
||||
results.E = 0; // >=150ms, <500ms
|
||||
results.F = 0; // >=500ms
|
||||
results.Errored = 0;
|
||||
DateTime start;
|
||||
DateTime end;
|
||||
results.ProcessingTime = 0;
|
||||
double currentSpeed = 0;
|
||||
results.MaxSpeed = double.MinValue;
|
||||
@@ -130,8 +128,8 @@ public sealed partial class MediaScan
|
||||
mhddLog = new MhddLog(_mhddLogPath, _dev, results.Blocks, blockSize, blocksToRead, false);
|
||||
ibgLog = new IbgLog(_ibgLogPath, ataProfile);
|
||||
|
||||
start = DateTime.UtcNow;
|
||||
DateTime timeSpeedStart = DateTime.UtcNow;
|
||||
_scanStopwatch.Restart();
|
||||
_speedStopwatch.Restart();
|
||||
ulong sectorSpeedStart = 0;
|
||||
InitProgress?.Invoke();
|
||||
|
||||
@@ -206,7 +204,7 @@ public sealed partial class MediaScan
|
||||
|
||||
sectorSpeedStart += blocksToRead;
|
||||
|
||||
double elapsed = (DateTime.UtcNow - timeSpeedStart).TotalSeconds;
|
||||
double elapsed = _speedStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
if(elapsed <= 0)
|
||||
continue;
|
||||
@@ -214,14 +212,15 @@ public sealed partial class MediaScan
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed);
|
||||
ScanSpeed?.Invoke(i, currentSpeed * 1024);
|
||||
sectorSpeedStart = 0;
|
||||
timeSpeedStart = DateTime.UtcNow;
|
||||
_speedStopwatch.Restart();
|
||||
}
|
||||
|
||||
end = DateTime.UtcNow;
|
||||
_speedStopwatch.Stop();
|
||||
_scanStopwatch.Stop();
|
||||
EndProgress?.Invoke();
|
||||
mhddLog.Close();
|
||||
|
||||
ibgLog.Close(_dev, results.Blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
|
||||
ibgLog.Close(_dev, results.Blocks, blockSize, _scanStopwatch.Elapsed.TotalSeconds, currentSpeed * 1024,
|
||||
blockSize * (double)(results.Blocks + 1) / 1024 / (results.ProcessingTime / 1000),
|
||||
_devicePath);
|
||||
|
||||
@@ -261,8 +260,8 @@ public sealed partial class MediaScan
|
||||
|
||||
ulong currentBlock = 0;
|
||||
results.Blocks = (ulong)(cylinders * heads * sectors);
|
||||
start = DateTime.UtcNow;
|
||||
DateTime timeSpeedStart = DateTime.UtcNow;
|
||||
_scanStopwatch.Restart();
|
||||
_speedStopwatch.Restart();
|
||||
ulong sectorSpeedStart = 0;
|
||||
InitProgress?.Invoke();
|
||||
|
||||
@@ -337,7 +336,7 @@ public sealed partial class MediaScan
|
||||
sectorSpeedStart++;
|
||||
currentBlock++;
|
||||
|
||||
double elapsed = (DateTime.UtcNow - timeSpeedStart).TotalSeconds;
|
||||
double elapsed = _speedStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
if(elapsed <= 0)
|
||||
continue;
|
||||
@@ -345,16 +344,17 @@ public sealed partial class MediaScan
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed);
|
||||
ScanSpeed?.Invoke(currentBlock, currentSpeed * 1024);
|
||||
sectorSpeedStart = 0;
|
||||
timeSpeedStart = DateTime.UtcNow;
|
||||
_speedStopwatch.Restart();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end = DateTime.UtcNow;
|
||||
_speedStopwatch.Stop();
|
||||
_scanStopwatch.Stop();
|
||||
EndProgress?.Invoke();
|
||||
mhddLog.Close();
|
||||
|
||||
ibgLog.Close(_dev, results.Blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
|
||||
ibgLog.Close(_dev, results.Blocks, blockSize, _scanStopwatch.Elapsed.TotalSeconds, currentSpeed * 1024,
|
||||
blockSize * (double)(results.Blocks + 1) / 1024 / (results.ProcessingTime / 1000),
|
||||
_devicePath);
|
||||
|
||||
@@ -391,7 +391,7 @@ public sealed partial class MediaScan
|
||||
}
|
||||
|
||||
results.ProcessingTime /= 1000;
|
||||
results.TotalTime = (end - start).TotalSeconds;
|
||||
results.TotalTime = _scanStopwatch.Elapsed.TotalSeconds;
|
||||
results.AvgSpeed = blockSize * (double)(results.Blocks + 1) / 1048576 / results.ProcessingTime;
|
||||
results.SeekTimes = seekTimes;
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.Devices;
|
||||
@@ -48,6 +49,8 @@ public sealed partial class MediaScan
|
||||
readonly bool _useBufferedReads;
|
||||
bool _aborted;
|
||||
static readonly TimeSpan _oneSecond = 1.Seconds();
|
||||
readonly Stopwatch _scanStopwatch;
|
||||
readonly Stopwatch _speedStopwatch;
|
||||
|
||||
/// <param name="mhddLogPath">Path to a MHDD log file</param>
|
||||
/// <param name="ibgLogPath">Path to a IMGBurn log file</param>
|
||||
@@ -68,6 +71,8 @@ public sealed partial class MediaScan
|
||||
_aborted = false;
|
||||
_seekTest = seekTest;
|
||||
_useBufferedReads = useBufferedReads;
|
||||
_scanStopwatch = new Stopwatch();
|
||||
_speedStopwatch = new Stopwatch();
|
||||
}
|
||||
|
||||
/// <summary>Starts a media scan</summary>
|
||||
|
||||
@@ -276,8 +276,6 @@ public sealed partial class MediaScan
|
||||
results.E = 0; // >=150ms, <500ms
|
||||
results.F = 0; // >=500ms
|
||||
results.Errored = 0;
|
||||
DateTime start;
|
||||
DateTime end;
|
||||
results.ProcessingTime = 0;
|
||||
results.TotalTime = 0;
|
||||
double currentSpeed = 0;
|
||||
@@ -309,7 +307,7 @@ public sealed partial class MediaScan
|
||||
return results;
|
||||
}
|
||||
|
||||
start = DateTime.UtcNow;
|
||||
_scanStopwatch.Restart();
|
||||
|
||||
if(readcd)
|
||||
while(true)
|
||||
@@ -340,7 +338,7 @@ public sealed partial class MediaScan
|
||||
InitBlockMap?.Invoke(results.Blocks, blockSize, blocksToRead, currentProfile);
|
||||
mhddLog = new MhddLog(_mhddLogPath, _dev, results.Blocks, blockSize, blocksToRead, false);
|
||||
ibgLog = new IbgLog(_ibgLogPath, currentProfile);
|
||||
DateTime timeSpeedStart = DateTime.UtcNow;
|
||||
_speedStopwatch.Restart();
|
||||
ulong sectorSpeedStart = 0;
|
||||
|
||||
InitProgress?.Invoke();
|
||||
@@ -459,7 +457,7 @@ public sealed partial class MediaScan
|
||||
|
||||
sectorSpeedStart += blocksToRead;
|
||||
|
||||
double elapsed = (DateTime.UtcNow - timeSpeedStart).TotalSeconds;
|
||||
double elapsed = _speedStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
if(elapsed <= 0)
|
||||
continue;
|
||||
@@ -467,14 +465,15 @@ public sealed partial class MediaScan
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed);
|
||||
ScanSpeed?.Invoke(i, currentSpeed * 1024);
|
||||
sectorSpeedStart = 0;
|
||||
timeSpeedStart = DateTime.UtcNow;
|
||||
_speedStopwatch.Restart();
|
||||
}
|
||||
|
||||
end = DateTime.UtcNow;
|
||||
_speedStopwatch.Stop();
|
||||
_scanStopwatch.Stop();
|
||||
EndProgress?.Invoke();
|
||||
mhddLog.Close();
|
||||
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * (end - timeSpeedStart).TotalSeconds);
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * _speedStopwatch.Elapsed.TotalSeconds);
|
||||
|
||||
// ReSharper disable once CompareOfFloatsByEqualityOperator
|
||||
if(results.MaxSpeed == double.MinValue)
|
||||
@@ -484,20 +483,20 @@ public sealed partial class MediaScan
|
||||
if(results.MinSpeed == double.MaxValue)
|
||||
results.MinSpeed = currentSpeed;
|
||||
|
||||
ibgLog.Close(_dev, results.Blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
|
||||
ibgLog.Close(_dev, results.Blocks, blockSize, _scanStopwatch.Elapsed.TotalSeconds, currentSpeed * 1024,
|
||||
blockSize * (double)(results.Blocks + 1) / 1024 / (results.ProcessingTime / 1000),
|
||||
_devicePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
start = DateTime.UtcNow;
|
||||
_scanStopwatch.Restart();
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Reading_0_sectors_at_a_time, scsiReader.BlocksToRead));
|
||||
|
||||
InitBlockMap?.Invoke(results.Blocks, blockSize, scsiReader.BlocksToRead, currentProfile);
|
||||
mhddLog = new MhddLog(_mhddLogPath, _dev, results.Blocks, blockSize, scsiReader.BlocksToRead, false);
|
||||
ibgLog = new IbgLog(_ibgLogPath, currentProfile);
|
||||
DateTime timeSpeedStart = DateTime.UtcNow;
|
||||
_speedStopwatch.Restart();
|
||||
ulong sectorSpeedStart = 0;
|
||||
|
||||
InitProgress?.Invoke();
|
||||
@@ -578,7 +577,7 @@ public sealed partial class MediaScan
|
||||
|
||||
sectorSpeedStart += blocksToRead;
|
||||
|
||||
double elapsed = (DateTime.UtcNow - timeSpeedStart).TotalSeconds;
|
||||
double elapsed = _speedStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
if(elapsed <= 0)
|
||||
continue;
|
||||
@@ -586,14 +585,15 @@ public sealed partial class MediaScan
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed);
|
||||
ScanSpeed?.Invoke(i, currentSpeed * 1024);
|
||||
sectorSpeedStart = 0;
|
||||
timeSpeedStart = DateTime.UtcNow;
|
||||
_speedStopwatch.Restart();
|
||||
}
|
||||
|
||||
end = DateTime.UtcNow;
|
||||
_speedStopwatch.Stop();
|
||||
_scanStopwatch.Stop();
|
||||
EndProgress?.Invoke();
|
||||
mhddLog.Close();
|
||||
|
||||
ibgLog.Close(_dev, results.Blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
|
||||
ibgLog.Close(_dev, results.Blocks, blockSize, _scanStopwatch.Elapsed.TotalSeconds, currentSpeed * 1024,
|
||||
blockSize * (double)(results.Blocks + 1) / 1024 / (results.ProcessingTime / 1000),
|
||||
_devicePath);
|
||||
}
|
||||
@@ -642,7 +642,7 @@ public sealed partial class MediaScan
|
||||
EndProgress?.Invoke();
|
||||
|
||||
results.ProcessingTime /= 1000;
|
||||
results.TotalTime = (end - start).TotalSeconds;
|
||||
results.TotalTime = _scanStopwatch.Elapsed.TotalSeconds;
|
||||
results.AvgSpeed = blockSize * (double)(results.Blocks + 1) / 1048576 / results.ProcessingTime;
|
||||
results.SeekTimes = seekTimes;
|
||||
|
||||
|
||||
@@ -196,8 +196,6 @@ public sealed partial class MediaScan
|
||||
results.E = 0; // >=150ms, <500ms
|
||||
results.F = 0; // >=500ms
|
||||
results.Errored = 0;
|
||||
DateTime start;
|
||||
DateTime end;
|
||||
results.ProcessingTime = 0;
|
||||
double currentSpeed = 0;
|
||||
results.MaxSpeed = double.MinValue;
|
||||
@@ -223,8 +221,8 @@ public sealed partial class MediaScan
|
||||
var mhddLog = new MhddLog(_mhddLogPath, _dev, results.Blocks, blockSize, blocksToRead, false);
|
||||
var ibgLog = new IbgLog(_ibgLogPath, sdProfile);
|
||||
|
||||
start = DateTime.UtcNow;
|
||||
DateTime timeSpeedStart = DateTime.UtcNow;
|
||||
_scanStopwatch.Restart();
|
||||
_speedStopwatch.Restart();
|
||||
ulong sectorSpeedStart = 0;
|
||||
InitProgress?.Invoke();
|
||||
|
||||
@@ -311,7 +309,7 @@ public sealed partial class MediaScan
|
||||
|
||||
sectorSpeedStart += blocksToRead;
|
||||
|
||||
double elapsed = (DateTime.UtcNow - timeSpeedStart).TotalSeconds;
|
||||
double elapsed = _speedStopwatch.Elapsed.TotalSeconds;
|
||||
|
||||
if(elapsed <= 0)
|
||||
continue;
|
||||
@@ -319,14 +317,15 @@ public sealed partial class MediaScan
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed);
|
||||
ScanSpeed?.Invoke(i, currentSpeed * 1024);
|
||||
sectorSpeedStart = 0;
|
||||
timeSpeedStart = DateTime.UtcNow;
|
||||
_speedStopwatch.Restart();
|
||||
}
|
||||
|
||||
end = DateTime.UtcNow;
|
||||
_speedStopwatch.Stop();
|
||||
_scanStopwatch.Stop();
|
||||
EndProgress?.Invoke();
|
||||
mhddLog.Close();
|
||||
|
||||
ibgLog.Close(_dev, results.Blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
|
||||
ibgLog.Close(_dev, results.Blocks, blockSize, _scanStopwatch.Elapsed.TotalSeconds, currentSpeed * 1024,
|
||||
blockSize * (double)(results.Blocks + 1) / 1024 / (results.ProcessingTime / 1000), _devicePath);
|
||||
|
||||
InitProgress?.Invoke();
|
||||
@@ -357,7 +356,7 @@ public sealed partial class MediaScan
|
||||
EndProgress?.Invoke();
|
||||
|
||||
results.ProcessingTime /= 1000;
|
||||
results.TotalTime = (end - start).TotalSeconds;
|
||||
results.TotalTime = _scanStopwatch.Elapsed.TotalSeconds;
|
||||
results.AvgSpeed = blockSize * (double)(results.Blocks + 1) / 1048576 / results.ProcessingTime;
|
||||
results.SeekTimes = seekTimes;
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
@@ -46,7 +47,7 @@ sealed class IbgLog
|
||||
readonly string _ibgMediaType;
|
||||
readonly StringBuilder _ibgSb;
|
||||
readonly string _logFile;
|
||||
DateTime _ibgDatePoint;
|
||||
readonly Stopwatch _ibgStopwatch;
|
||||
ulong _ibgIntSector;
|
||||
double _ibgIntSpeed;
|
||||
double _ibgMaxSpeed;
|
||||
@@ -65,7 +66,7 @@ sealed class IbgLog
|
||||
|
||||
_logFile = outputFile;
|
||||
_ibgSb = new StringBuilder();
|
||||
_ibgDatePoint = DateTime.Now;
|
||||
_ibgStopwatch = new Stopwatch();
|
||||
_ibgCulture = new CultureInfo("en-US");
|
||||
_ibgStartSet = false;
|
||||
_ibgMaxSpeed = 0;
|
||||
@@ -73,6 +74,8 @@ sealed class IbgLog
|
||||
_ibgSnaps = 0;
|
||||
_ibgIntSector = 0;
|
||||
|
||||
_ibgStopwatch.Start();
|
||||
|
||||
switch(currentProfile)
|
||||
{
|
||||
case 0x0001:
|
||||
@@ -240,7 +243,7 @@ sealed class IbgLog
|
||||
return;
|
||||
|
||||
_ibgIntSpeed += currentSpeed;
|
||||
_ibgSampleRate += (int)Math.Floor((DateTime.Now - _ibgDatePoint).TotalMilliseconds);
|
||||
_ibgSampleRate += (int)Math.Floor(_ibgStopwatch.Elapsed.TotalMilliseconds);
|
||||
_ibgSnaps++;
|
||||
|
||||
if(_ibgSampleRate < 100)
|
||||
@@ -259,7 +262,7 @@ sealed class IbgLog
|
||||
if(_ibgIntSpeed / _ibgSnaps / _ibgDivider > _ibgMaxSpeed)
|
||||
_ibgMaxSpeed = _ibgIntSpeed / _ibgDivider;
|
||||
|
||||
_ibgDatePoint = DateTime.Now;
|
||||
_ibgStopwatch.Restart();
|
||||
_ibgIntSpeed = 0;
|
||||
_ibgSampleRate = 0;
|
||||
_ibgSnaps = 0;
|
||||
@@ -280,6 +283,8 @@ sealed class IbgLog
|
||||
if(_logFile == null)
|
||||
return;
|
||||
|
||||
_ibgStopwatch.Stop();
|
||||
|
||||
var ibgFs = new FileStream(_logFile, FileMode.Create);
|
||||
var ibgHeader = new StringBuilder();
|
||||
string ibgBusType;
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Interop;
|
||||
@@ -84,9 +85,10 @@ partial class Device
|
||||
Marshal.Copy(cdb, 0, ioHdr.cmdp, cdb.Length);
|
||||
Marshal.Copy(senseBuffer, 0, ioHdr.sbp, senseBuffer.Length);
|
||||
|
||||
DateTime start = DateTime.UtcNow;
|
||||
var cmdStopWatch = new Stopwatch();
|
||||
cmdStopWatch.Start();
|
||||
int error = Extern.ioctlSg(_fileDescriptor, LinuxIoctl.SgIo, ref ioHdr);
|
||||
DateTime end = DateTime.UtcNow;
|
||||
cmdStopWatch.Stop();
|
||||
|
||||
if(error < 0)
|
||||
error = Marshal.GetLastWin32Error();
|
||||
@@ -97,7 +99,7 @@ partial class Device
|
||||
|
||||
sense |= (ioHdr.info & SgInfo.OkMask) != SgInfo.Ok;
|
||||
|
||||
duration = ioHdr.duration > 0 ? ioHdr.duration : (end - start).TotalMilliseconds;
|
||||
duration = ioHdr.duration > 0 ? ioHdr.duration : cmdStopWatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
Marshal.FreeHGlobal(ioHdr.dxferp);
|
||||
Marshal.FreeHGlobal(ioHdr.cmdp);
|
||||
@@ -366,57 +368,56 @@ partial class Device
|
||||
if(timeout == 0)
|
||||
timeout = Timeout > 0 ? Timeout : 15;
|
||||
|
||||
DateTime start;
|
||||
DateTime end;
|
||||
var cmdStopwatch = new Stopwatch();
|
||||
|
||||
switch(command)
|
||||
{
|
||||
case MmcCommands.SendCid when _cachedCid != null:
|
||||
{
|
||||
start = DateTime.Now;
|
||||
cmdStopwatch.Restart();
|
||||
buffer = new byte[_cachedCid.Length];
|
||||
Array.Copy(_cachedCid, buffer, buffer.Length);
|
||||
response = new uint[4];
|
||||
sense = false;
|
||||
end = DateTime.Now;
|
||||
duration = (end - start).TotalMilliseconds;
|
||||
cmdStopwatch.Stop();
|
||||
duration = cmdStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
return 0;
|
||||
}
|
||||
case MmcCommands.SendCsd when _cachedCid != null:
|
||||
{
|
||||
start = DateTime.Now;
|
||||
cmdStopwatch.Restart();
|
||||
buffer = new byte[_cachedCsd.Length];
|
||||
Array.Copy(_cachedCsd, buffer, buffer.Length);
|
||||
response = new uint[4];
|
||||
sense = false;
|
||||
end = DateTime.Now;
|
||||
duration = (end - start).TotalMilliseconds;
|
||||
cmdStopwatch.Stop();
|
||||
duration = cmdStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
return 0;
|
||||
}
|
||||
case (MmcCommands)SecureDigitalCommands.SendScr when _cachedScr != null:
|
||||
{
|
||||
start = DateTime.Now;
|
||||
cmdStopwatch.Restart();
|
||||
buffer = new byte[_cachedScr.Length];
|
||||
Array.Copy(_cachedScr, buffer, buffer.Length);
|
||||
response = new uint[4];
|
||||
sense = false;
|
||||
end = DateTime.Now;
|
||||
duration = (end - start).TotalMilliseconds;
|
||||
cmdStopwatch.Stop();
|
||||
duration = cmdStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
return 0;
|
||||
}
|
||||
case (MmcCommands)SecureDigitalCommands.SendOperatingCondition when _cachedOcr != null:
|
||||
case MmcCommands.SendOpCond when _cachedOcr != null:
|
||||
{
|
||||
start = DateTime.Now;
|
||||
cmdStopwatch.Restart();
|
||||
buffer = new byte[_cachedOcr.Length];
|
||||
Array.Copy(_cachedOcr, buffer, buffer.Length);
|
||||
response = new uint[4];
|
||||
sense = false;
|
||||
end = DateTime.Now;
|
||||
duration = (end - start).TotalMilliseconds;
|
||||
cmdStopwatch.Stop();
|
||||
duration = cmdStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -451,9 +452,10 @@ partial class Device
|
||||
|
||||
Marshal.Copy(buffer, 0, bufPtr, buffer.Length);
|
||||
|
||||
start = DateTime.UtcNow;
|
||||
var stopWatch = new Stopwatch();
|
||||
stopWatch.Restart();
|
||||
int error = Extern.ioctlMmc(_fileDescriptor, LinuxIoctl.MmcIocCmd, ref ioCmd);
|
||||
end = DateTime.UtcNow;
|
||||
stopWatch.Stop();
|
||||
|
||||
sense |= error < 0;
|
||||
|
||||
@@ -463,7 +465,7 @@ partial class Device
|
||||
Marshal.Copy(bufPtr, buffer, 0, buffer.Length);
|
||||
|
||||
response = ioCmd.response;
|
||||
duration = (end - start).TotalMilliseconds;
|
||||
duration = stopWatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
Marshal.FreeHGlobal(bufPtr);
|
||||
|
||||
@@ -535,16 +537,17 @@ partial class Device
|
||||
Marshal.Copy(ioMultiCmd, 0, ioMultiCmdPtr, ioMultiCmd.Length);
|
||||
|
||||
// Send command
|
||||
DateTime start = DateTime.UtcNow;
|
||||
var cmdStopwatch = new Stopwatch();
|
||||
cmdStopwatch.Start();
|
||||
int error = Extern.ioctlMmcMulti(_fileDescriptor, LinuxIoctl.MmcIocMultiCmd, ioMultiCmdPtr);
|
||||
DateTime end = DateTime.UtcNow;
|
||||
cmdStopwatch.Stop();
|
||||
|
||||
sense |= error < 0;
|
||||
|
||||
if(error < 0)
|
||||
error = Marshal.GetLastWin32Error();
|
||||
|
||||
duration = (end - start).TotalMilliseconds;
|
||||
duration = cmdStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
off = sizeof(ulong);
|
||||
|
||||
@@ -670,15 +673,15 @@ partial class Device
|
||||
{
|
||||
buffer = new byte[length];
|
||||
|
||||
DateTime start = DateTime.Now;
|
||||
var cmdStopwatch = new Stopwatch();
|
||||
cmdStopwatch.Start();
|
||||
|
||||
long sense = Extern.lseek(_fileDescriptor, offset, SeekWhence.Begin);
|
||||
|
||||
DateTime end = DateTime.Now;
|
||||
|
||||
if(sense < 0)
|
||||
{
|
||||
duration = (end - start).TotalMilliseconds;
|
||||
cmdStopwatch.Stop();
|
||||
duration = cmdStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
Error = true;
|
||||
LastError = Marshal.GetLastWin32Error();
|
||||
@@ -689,8 +692,8 @@ partial class Device
|
||||
sense = DetectOS.Is64Bit ? Extern.read64(_fileDescriptor, buffer, length)
|
||||
: Extern.read(_fileDescriptor, buffer, (int)length);
|
||||
|
||||
end = DateTime.Now;
|
||||
duration = (end - start).TotalMilliseconds;
|
||||
cmdStopwatch.Stop();
|
||||
duration = cmdStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
int errno = Marshal.GetLastWin32Error();
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Aaru.Decoders.ATA;
|
||||
|
||||
@@ -98,54 +99,56 @@ public partial class Device
|
||||
if(timeout == 0)
|
||||
timeout = Timeout > 0 ? Timeout : 15;
|
||||
|
||||
var cmdStopwatch = new Stopwatch();
|
||||
|
||||
switch(command)
|
||||
{
|
||||
case MmcCommands.SendCid when _cachedCid != null:
|
||||
{
|
||||
DateTime start = DateTime.Now;
|
||||
cmdStopwatch.Restart();
|
||||
buffer = new byte[_cachedCid.Length];
|
||||
Array.Copy(_cachedCid, buffer, buffer.Length);
|
||||
response = new uint[4];
|
||||
sense = false;
|
||||
DateTime end = DateTime.Now;
|
||||
duration = (end - start).TotalMilliseconds;
|
||||
cmdStopwatch.Stop();
|
||||
duration = cmdStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
return 0;
|
||||
}
|
||||
case MmcCommands.SendCsd when _cachedCid != null:
|
||||
{
|
||||
DateTime start = DateTime.Now;
|
||||
cmdStopwatch.Restart();
|
||||
buffer = new byte[_cachedCsd.Length];
|
||||
Array.Copy(_cachedCsd, buffer, buffer.Length);
|
||||
response = new uint[4];
|
||||
sense = false;
|
||||
DateTime end = DateTime.Now;
|
||||
duration = (end - start).TotalMilliseconds;
|
||||
cmdStopwatch.Stop();
|
||||
duration = cmdStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
return 0;
|
||||
}
|
||||
case (MmcCommands)SecureDigitalCommands.SendScr when _cachedScr != null:
|
||||
{
|
||||
DateTime start = DateTime.Now;
|
||||
cmdStopwatch.Restart();
|
||||
buffer = new byte[_cachedScr.Length];
|
||||
Array.Copy(_cachedScr, buffer, buffer.Length);
|
||||
response = new uint[4];
|
||||
sense = false;
|
||||
DateTime end = DateTime.Now;
|
||||
duration = (end - start).TotalMilliseconds;
|
||||
cmdStopwatch.Stop();
|
||||
duration = cmdStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
return 0;
|
||||
}
|
||||
case (MmcCommands)SecureDigitalCommands.SendOperatingCondition when _cachedOcr != null:
|
||||
case MmcCommands.SendOpCond when _cachedOcr != null:
|
||||
{
|
||||
DateTime start = DateTime.Now;
|
||||
cmdStopwatch.Restart();
|
||||
buffer = new byte[_cachedOcr.Length];
|
||||
Array.Copy(_cachedOcr, buffer, buffer.Length);
|
||||
response = new uint[4];
|
||||
sense = false;
|
||||
DateTime end = DateTime.Now;
|
||||
duration = (end - start).TotalMilliseconds;
|
||||
cmdStopwatch.Stop();
|
||||
duration = cmdStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.InteropServices;
|
||||
using Aaru.Decoders.ATA;
|
||||
@@ -88,13 +89,14 @@ partial class Device
|
||||
|
||||
Marshal.Copy(buffer, 0, sptdSb.sptd.DataBuffer, buffer.Length);
|
||||
|
||||
DateTime start = DateTime.Now;
|
||||
var cmdStopwatch = new Stopwatch();
|
||||
cmdStopwatch.Start();
|
||||
|
||||
bool hasError = !Extern.DeviceIoControlScsi(_fileHandle, WindowsIoctl.IoctlScsiPassThroughDirect, ref sptdSb,
|
||||
(uint)Marshal.SizeOf(sptdSb), ref sptdSb,
|
||||
(uint)Marshal.SizeOf(sptdSb), ref k, IntPtr.Zero);
|
||||
|
||||
DateTime end = DateTime.Now;
|
||||
cmdStopwatch.Stop();
|
||||
|
||||
if(hasError)
|
||||
error = Marshal.GetLastWin32Error();
|
||||
@@ -106,7 +108,7 @@ partial class Device
|
||||
senseBuffer = new byte[64];
|
||||
Array.Copy(sptdSb.SenseBuf, senseBuffer, 32);
|
||||
|
||||
duration = (end - start).TotalMilliseconds;
|
||||
duration = cmdStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
Marshal.FreeHGlobal(sptdSb.sptd.DataBuffer);
|
||||
|
||||
@@ -183,20 +185,21 @@ partial class Device
|
||||
|
||||
Marshal.Copy(buffer, 0, aptd.DataBuffer, buffer.Length);
|
||||
|
||||
DateTime start = DateTime.Now;
|
||||
var cmdStopwatch = new Stopwatch();
|
||||
cmdStopwatch.Start();
|
||||
|
||||
sense = !Extern.DeviceIoControlAta(_fileHandle, WindowsIoctl.IoctlAtaPassThroughDirect, ref aptd,
|
||||
(uint)Marshal.SizeOf(aptd), ref aptd, (uint)Marshal.SizeOf(aptd), ref k,
|
||||
IntPtr.Zero);
|
||||
|
||||
DateTime end = DateTime.Now;
|
||||
cmdStopwatch.Stop();
|
||||
|
||||
if(sense)
|
||||
error = Marshal.GetLastWin32Error();
|
||||
|
||||
Marshal.Copy(aptd.DataBuffer, buffer, 0, buffer.Length);
|
||||
|
||||
duration = (end - start).TotalMilliseconds;
|
||||
duration = cmdStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
errorRegisters.CylinderHigh = aptd.CurrentTaskFile.CylinderHigh;
|
||||
errorRegisters.CylinderLow = aptd.CurrentTaskFile.CylinderLow;
|
||||
@@ -283,20 +286,21 @@ partial class Device
|
||||
|
||||
Marshal.Copy(buffer, 0, aptd.DataBuffer, buffer.Length);
|
||||
|
||||
DateTime start = DateTime.Now;
|
||||
var cmdStopwatch = new Stopwatch();
|
||||
cmdStopwatch.Start();
|
||||
|
||||
sense = !Extern.DeviceIoControlAta(_fileHandle, WindowsIoctl.IoctlAtaPassThroughDirect, ref aptd,
|
||||
(uint)Marshal.SizeOf(aptd), ref aptd, (uint)Marshal.SizeOf(aptd), ref k,
|
||||
IntPtr.Zero);
|
||||
|
||||
DateTime end = DateTime.Now;
|
||||
cmdStopwatch.Stop();
|
||||
|
||||
if(sense)
|
||||
error = Marshal.GetLastWin32Error();
|
||||
|
||||
Marshal.Copy(aptd.DataBuffer, buffer, 0, buffer.Length);
|
||||
|
||||
duration = (end - start).TotalMilliseconds;
|
||||
duration = cmdStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
errorRegisters.LbaHigh = aptd.CurrentTaskFile.CylinderHigh;
|
||||
errorRegisters.LbaMid = aptd.CurrentTaskFile.CylinderLow;
|
||||
@@ -392,20 +396,21 @@ partial class Device
|
||||
|
||||
Marshal.Copy(buffer, 0, aptd.DataBuffer, buffer.Length);
|
||||
|
||||
DateTime start = DateTime.Now;
|
||||
var cmdStopwatch = new Stopwatch();
|
||||
cmdStopwatch.Start();
|
||||
|
||||
sense = !Extern.DeviceIoControlAta(_fileHandle, WindowsIoctl.IoctlAtaPassThroughDirect, ref aptd,
|
||||
(uint)Marshal.SizeOf(aptd), ref aptd, (uint)Marshal.SizeOf(aptd), ref k,
|
||||
IntPtr.Zero);
|
||||
|
||||
DateTime end = DateTime.Now;
|
||||
cmdStopwatch.Stop();
|
||||
|
||||
if(sense)
|
||||
error = Marshal.GetLastWin32Error();
|
||||
|
||||
Marshal.Copy(aptd.DataBuffer, buffer, 0, buffer.Length);
|
||||
|
||||
duration = (end - start).TotalMilliseconds;
|
||||
duration = cmdStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
errorRegisters.SectorCount = (ushort)((aptd.PreviousTaskFile.SectorCount << 8) +
|
||||
aptd.CurrentTaskFile.SectorCount);
|
||||
@@ -447,57 +452,56 @@ partial class Device
|
||||
uint argument, uint blockSize, uint blocks, ref byte[] buffer,
|
||||
out uint[] response, out double duration, out bool sense, uint timeout = 15)
|
||||
{
|
||||
DateTime start;
|
||||
DateTime end;
|
||||
var cmdStopwatch = new Stopwatch();
|
||||
|
||||
switch(command)
|
||||
{
|
||||
case MmcCommands.SendCid when _cachedCid != null:
|
||||
{
|
||||
start = DateTime.Now;
|
||||
cmdStopwatch.Restart();
|
||||
buffer = new byte[_cachedCid.Length];
|
||||
Array.Copy(_cachedCid, buffer, buffer.Length);
|
||||
response = new uint[4];
|
||||
sense = false;
|
||||
end = DateTime.Now;
|
||||
duration = (end - start).TotalMilliseconds;
|
||||
cmdStopwatch.Stop();
|
||||
duration = cmdStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
return 0;
|
||||
}
|
||||
case MmcCommands.SendCsd when _cachedCid != null:
|
||||
{
|
||||
start = DateTime.Now;
|
||||
cmdStopwatch.Restart();
|
||||
buffer = new byte[_cachedCsd.Length];
|
||||
Array.Copy(_cachedCsd, buffer, buffer.Length);
|
||||
response = new uint[4];
|
||||
sense = false;
|
||||
end = DateTime.Now;
|
||||
duration = (end - start).TotalMilliseconds;
|
||||
cmdStopwatch.Stop();
|
||||
duration = cmdStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
return 0;
|
||||
}
|
||||
case (MmcCommands)SecureDigitalCommands.SendScr when _cachedScr != null:
|
||||
{
|
||||
start = DateTime.Now;
|
||||
cmdStopwatch.Restart();
|
||||
buffer = new byte[_cachedScr.Length];
|
||||
Array.Copy(_cachedScr, buffer, buffer.Length);
|
||||
response = new uint[4];
|
||||
sense = false;
|
||||
end = DateTime.Now;
|
||||
duration = (end - start).TotalMilliseconds;
|
||||
cmdStopwatch.Stop();
|
||||
duration = cmdStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
return 0;
|
||||
}
|
||||
case (MmcCommands)SecureDigitalCommands.SendOperatingCondition when _cachedOcr != null:
|
||||
case MmcCommands.SendOpCond when _cachedOcr != null:
|
||||
{
|
||||
start = DateTime.Now;
|
||||
cmdStopwatch.Restart();
|
||||
buffer = new byte[_cachedOcr.Length];
|
||||
Array.Copy(_cachedOcr, buffer, buffer.Length);
|
||||
response = new uint[4];
|
||||
sense = false;
|
||||
end = DateTime.Now;
|
||||
duration = (end - start).TotalMilliseconds;
|
||||
cmdStopwatch.Stop();
|
||||
duration = cmdStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -559,12 +563,12 @@ partial class Device
|
||||
Marshal.FreeHGlobal(hBuf);
|
||||
|
||||
int error = 0;
|
||||
start = DateTime.Now;
|
||||
cmdStopwatch.Restart();
|
||||
|
||||
sense = !Extern.DeviceIoControl(_fileHandle, WindowsIoctl.IoctlSffdiskDeviceCommand, commandB,
|
||||
(uint)commandB.Length, commandB, (uint)commandB.Length, out _, IntPtr.Zero);
|
||||
|
||||
end = DateTime.Now;
|
||||
cmdStopwatch.Stop();
|
||||
|
||||
if(sense)
|
||||
error = Marshal.GetLastWin32Error();
|
||||
@@ -573,7 +577,7 @@ partial class Device
|
||||
Buffer.BlockCopy(commandB, commandB.Length - buffer.Length, buffer, 0, buffer.Length);
|
||||
|
||||
response = new uint[4];
|
||||
duration = (end - start).TotalMilliseconds;
|
||||
duration = cmdStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
return error;
|
||||
}
|
||||
@@ -644,15 +648,17 @@ partial class Device
|
||||
{
|
||||
buffer = new byte[length];
|
||||
|
||||
DateTime start = DateTime.Now;
|
||||
var cmdStopwatch = new Stopwatch();
|
||||
cmdStopwatch.Start();
|
||||
|
||||
bool sense = !Extern.SetFilePointerEx(_fileHandle, offset, out _, MoveMethod.Begin);
|
||||
|
||||
DateTime end = DateTime.Now;
|
||||
cmdStopwatch.Stop();
|
||||
|
||||
if(sense)
|
||||
{
|
||||
duration = (end - start).TotalMilliseconds;
|
||||
cmdStopwatch.Stop();
|
||||
duration = cmdStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
LastError = Marshal.GetLastWin32Error();
|
||||
Error = true;
|
||||
@@ -662,8 +668,8 @@ partial class Device
|
||||
|
||||
sense = !Extern.ReadFile(_fileHandle, buffer, length, out _, IntPtr.Zero);
|
||||
|
||||
end = DateTime.Now;
|
||||
duration = (end - start).TotalMilliseconds;
|
||||
cmdStopwatch.Stop();
|
||||
duration = cmdStopwatch.Elapsed.TotalMilliseconds;
|
||||
|
||||
if(sense)
|
||||
{
|
||||
|
||||
@@ -30,9 +30,9 @@
|
||||
// Copyright © 2011-2023 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Reactive;
|
||||
using System.Threading;
|
||||
@@ -421,11 +421,10 @@ public sealed class ImageVerifyViewModel : ViewModelBase
|
||||
Progress2Indeterminate = true;
|
||||
});
|
||||
|
||||
DateTime startCheck = DateTime.UtcNow;
|
||||
var chkStopwatch = new Stopwatch();
|
||||
chkStopwatch.Start();
|
||||
bool? discCheckStatus = verifiableImage.VerifyMediaImage();
|
||||
DateTime endCheck = DateTime.UtcNow;
|
||||
|
||||
TimeSpan checkTime = endCheck - startCheck;
|
||||
chkStopwatch.Stop();
|
||||
|
||||
await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
{
|
||||
@@ -440,14 +439,13 @@ public sealed class ImageVerifyViewModel : ViewModelBase
|
||||
});
|
||||
|
||||
AaruConsole.VerboseWriteLine(UI.Checking_disc_image_checksums_took_0,
|
||||
checkTime.Humanize(minUnit: TimeUnit.Second));
|
||||
chkStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second));
|
||||
}
|
||||
}
|
||||
|
||||
if(VerifySectorsChecked)
|
||||
{
|
||||
DateTime startCheck = DateTime.Now;
|
||||
DateTime endCheck = startCheck;
|
||||
var chkStopwatch = new Stopwatch();
|
||||
List<ulong> failingLbas = new();
|
||||
List<ulong> unknownLbas = new();
|
||||
|
||||
@@ -463,7 +461,7 @@ public sealed class ImageVerifyViewModel : ViewModelBase
|
||||
{
|
||||
ulong currentSectorAll = 0;
|
||||
|
||||
startCheck = DateTime.UtcNow;
|
||||
chkStopwatch.Restart();
|
||||
|
||||
foreach(Track currentTrack in inputOptical.Tracks)
|
||||
{
|
||||
@@ -531,14 +529,14 @@ public sealed class ImageVerifyViewModel : ViewModelBase
|
||||
}
|
||||
}
|
||||
|
||||
endCheck = DateTime.UtcNow;
|
||||
chkStopwatch.Stop();
|
||||
}
|
||||
else if(verifiableSectorsImage is not null)
|
||||
{
|
||||
ulong remainingSectors = _inputFormat.Info.Sectors;
|
||||
ulong currentSector = 0;
|
||||
|
||||
startCheck = DateTime.UtcNow;
|
||||
chkStopwatch.Restart();
|
||||
|
||||
while(remainingSectors > 0)
|
||||
{
|
||||
@@ -588,13 +586,11 @@ public sealed class ImageVerifyViewModel : ViewModelBase
|
||||
}
|
||||
}
|
||||
|
||||
endCheck = DateTime.UtcNow;
|
||||
chkStopwatch.Stop();
|
||||
}
|
||||
|
||||
TimeSpan checkTime = endCheck - startCheck;
|
||||
|
||||
AaruConsole.VerboseWriteLine(UI.Checking_sector_checksums_took_0,
|
||||
checkTime.Humanize(minUnit: TimeUnit.Second));
|
||||
chkStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second));
|
||||
|
||||
await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
{
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Aaru.Console;
|
||||
|
||||
namespace Aaru.DiscImages;
|
||||
@@ -51,7 +52,8 @@ public sealed partial class AaruFormat
|
||||
int[] v = new int[interleaved.Length / 8];
|
||||
int[] w = new int[interleaved.Length / 8];
|
||||
|
||||
DateTime start = DateTime.UtcNow;
|
||||
var stopwatch = new Stopwatch();
|
||||
stopwatch.Start();
|
||||
|
||||
for(int i = 0; i < interleaved.Length; i += 8)
|
||||
{
|
||||
@@ -128,11 +130,11 @@ public sealed partial class AaruFormat
|
||||
w[i / 8] += interleaved[i + 7] & 0x01;
|
||||
}
|
||||
|
||||
DateTime end = DateTime.UtcNow;
|
||||
TimeSpan deinterleave = end - start;
|
||||
stopwatch.Stop();
|
||||
TimeSpan deinterleave = stopwatch.Elapsed;
|
||||
|
||||
byte[] sequential = new byte[interleaved.Length];
|
||||
start = DateTime.UtcNow;
|
||||
stopwatch.Restart();
|
||||
|
||||
int qStart = p.Length * 1;
|
||||
int rStart = p.Length * 2;
|
||||
@@ -154,8 +156,8 @@ public sealed partial class AaruFormat
|
||||
sequential[wStart + i] = (byte)w[i];
|
||||
}
|
||||
|
||||
end = DateTime.UtcNow;
|
||||
TimeSpan sequentialize = end - start;
|
||||
stopwatch.Stop();
|
||||
TimeSpan sequentialize = stopwatch.Elapsed;
|
||||
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin", Localization.Took_0_ms_to_deinterleave_subchannel,
|
||||
deinterleave.TotalMilliseconds);
|
||||
@@ -191,7 +193,8 @@ public sealed partial class AaruFormat
|
||||
int vStart = p.Length * 6;
|
||||
int wStart = p.Length * 7;
|
||||
|
||||
DateTime start = DateTime.UtcNow;
|
||||
var stopwatch = new Stopwatch();
|
||||
stopwatch.Start();
|
||||
|
||||
for(int i = 0; i < p.Length; i++)
|
||||
{
|
||||
@@ -205,11 +208,11 @@ public sealed partial class AaruFormat
|
||||
w[i] = sequential[wStart + i];
|
||||
}
|
||||
|
||||
DateTime end = DateTime.UtcNow;
|
||||
TimeSpan desequentialize = end - start;
|
||||
stopwatch.Stop();
|
||||
TimeSpan desequentialize = stopwatch.Elapsed;
|
||||
|
||||
byte[] interleaved = new byte[sequential.Length];
|
||||
start = DateTime.UtcNow;
|
||||
stopwatch.Restart();
|
||||
|
||||
for(int i = 0; i < interleaved.Length; i += 8)
|
||||
{
|
||||
@@ -286,8 +289,8 @@ public sealed partial class AaruFormat
|
||||
interleaved[i + 7] += (byte)((w[i / 8] & 0x01) == 0x01 ? 0x01 : 0);
|
||||
}
|
||||
|
||||
end = DateTime.UtcNow;
|
||||
TimeSpan interleave = end - start;
|
||||
stopwatch.Stop();
|
||||
TimeSpan interleave = stopwatch.Elapsed;
|
||||
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin", Localization.Took_0_ms_to_desequentialize_subchannel,
|
||||
desequentialize.TotalMilliseconds);
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
@@ -240,7 +241,8 @@ public sealed partial class AaruFormat
|
||||
break;
|
||||
}
|
||||
|
||||
DateTime startDecompress = DateTime.Now;
|
||||
var decompressStopwatch = new Stopwatch();
|
||||
decompressStopwatch.Start();
|
||||
byte[] compressedTag = new byte[blockHeader.cmpLength - LZMA_PROPERTIES_LENGTH];
|
||||
byte[] lzmaProperties = new byte[LZMA_PROPERTIES_LENGTH];
|
||||
_imageStream.EnsureRead(lzmaProperties, 0, LZMA_PROPERTIES_LENGTH);
|
||||
@@ -261,11 +263,11 @@ public sealed partial class AaruFormat
|
||||
if(blockHeader.compression == CompressionType.LzmaClauniaSubchannelTransform)
|
||||
data = ClauniaSubchannelUntransform(data);
|
||||
|
||||
DateTime endDecompress = DateTime.Now;
|
||||
decompressStopwatch.Stop();
|
||||
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin",
|
||||
Localization.Took_0_seconds_to_decompress_block,
|
||||
(endDecompress - startDecompress).TotalSeconds);
|
||||
decompressStopwatch.Elapsed.TotalSeconds);
|
||||
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin", Localization.Memory_snapshot_0_bytes,
|
||||
GC.GetTotalMemory(false));
|
||||
@@ -483,7 +485,8 @@ public sealed partial class AaruFormat
|
||||
{
|
||||
case CompressionType.Lzma:
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin", Localization.Decompressing_DDT);
|
||||
DateTime ddtStart = DateTime.UtcNow;
|
||||
var ddtStopwatch = new Stopwatch();
|
||||
ddtStopwatch.Start();
|
||||
byte[] compressedDdt = new byte[ddtHeader.cmpLength - LZMA_PROPERTIES_LENGTH];
|
||||
byte[] lzmaProperties = new byte[LZMA_PROPERTIES_LENGTH];
|
||||
_imageStream.EnsureRead(lzmaProperties, 0, LZMA_PROPERTIES_LENGTH);
|
||||
@@ -504,12 +507,12 @@ public sealed partial class AaruFormat
|
||||
}
|
||||
|
||||
_userDataDdt = MemoryMarshal.Cast<byte, ulong>(decompressedDdt).ToArray();
|
||||
DateTime ddtEnd = DateTime.UtcNow;
|
||||
ddtStopwatch.Stop();
|
||||
_inMemoryDdt = true;
|
||||
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin",
|
||||
Localization.Took_0_seconds_to_decompress_DDT,
|
||||
(ddtEnd - ddtStart).TotalSeconds);
|
||||
ddtStopwatch.Elapsed.TotalSeconds);
|
||||
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin",
|
||||
Localization.Memory_snapshot_0_bytes,
|
||||
@@ -550,7 +553,8 @@ public sealed partial class AaruFormat
|
||||
{
|
||||
case CompressionType.Lzma:
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin", Localization.Decompressing_DDT);
|
||||
DateTime ddtStart = DateTime.UtcNow;
|
||||
var ddtStopwatch = new Stopwatch();
|
||||
ddtStopwatch.Start();
|
||||
byte[] compressedDdt = new byte[ddtHeader.cmpLength - LZMA_PROPERTIES_LENGTH];
|
||||
byte[] lzmaProperties = new byte[LZMA_PROPERTIES_LENGTH];
|
||||
_imageStream.EnsureRead(lzmaProperties, 0, LZMA_PROPERTIES_LENGTH);
|
||||
@@ -559,7 +563,7 @@ public sealed partial class AaruFormat
|
||||
ulong decompressedLength =
|
||||
(ulong)LZMA.DecodeBuffer(compressedDdt, decompressedDdt, lzmaProperties);
|
||||
|
||||
DateTime ddtEnd = DateTime.UtcNow;
|
||||
ddtStopwatch.Stop();
|
||||
|
||||
if(decompressedLength != ddtHeader.length)
|
||||
{
|
||||
@@ -573,7 +577,7 @@ public sealed partial class AaruFormat
|
||||
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin",
|
||||
Localization.Took_0_seconds_to_decompress_DDT,
|
||||
(ddtEnd - ddtStart).TotalSeconds);
|
||||
ddtStopwatch.Elapsed.TotalSeconds);
|
||||
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin",
|
||||
Localization.Memory_snapshot_0_bytes,
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
@@ -412,7 +413,8 @@ public sealed partial class AaruFormat
|
||||
break;
|
||||
}
|
||||
|
||||
DateTime startDecompress = DateTime.Now;
|
||||
var decompressStopwatch = new Stopwatch();
|
||||
decompressStopwatch.Restart();
|
||||
byte[] compressedTag = new byte[blockHeader.cmpLength - LZMA_PROPERTIES_LENGTH];
|
||||
byte[] lzmaProperties = new byte[LZMA_PROPERTIES_LENGTH];
|
||||
_imageStream.EnsureRead(lzmaProperties, 0, LZMA_PROPERTIES_LENGTH);
|
||||
@@ -433,11 +435,11 @@ public sealed partial class AaruFormat
|
||||
if(blockHeader.compression == CompressionType.LzmaClauniaSubchannelTransform)
|
||||
data = ClauniaSubchannelUntransform(data);
|
||||
|
||||
DateTime endDecompress = DateTime.Now;
|
||||
decompressStopwatch.Stop();
|
||||
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin",
|
||||
Localization.Took_0_seconds_to_decompress_block,
|
||||
(endDecompress - startDecompress).TotalSeconds);
|
||||
decompressStopwatch.Elapsed.TotalSeconds);
|
||||
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin", Localization.Memory_snapshot_0_bytes,
|
||||
GC.GetTotalMemory(false));
|
||||
@@ -629,7 +631,8 @@ public sealed partial class AaruFormat
|
||||
case CompressionType.Lzma:
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin", Localization.Decompressing_DDT);
|
||||
|
||||
DateTime ddtStart = DateTime.UtcNow;
|
||||
var ddtStopwatch = new Stopwatch();
|
||||
ddtStopwatch.Start();
|
||||
|
||||
byte[] compressedDdt = new byte[ddtHeader.cmpLength - LZMA_PROPERTIES_LENGTH];
|
||||
|
||||
@@ -652,12 +655,12 @@ public sealed partial class AaruFormat
|
||||
}
|
||||
|
||||
_userDataDdt = MemoryMarshal.Cast<byte, ulong>(decompressedDdt).ToArray();
|
||||
DateTime ddtEnd = DateTime.UtcNow;
|
||||
ddtStopwatch.Stop();
|
||||
_inMemoryDdt = true;
|
||||
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin",
|
||||
Localization.Took_0_seconds_to_decompress_DDT,
|
||||
(ddtEnd - ddtStart).TotalSeconds);
|
||||
ddtStopwatch.Elapsed.TotalSeconds);
|
||||
|
||||
break;
|
||||
case CompressionType.None:
|
||||
@@ -711,7 +714,8 @@ public sealed partial class AaruFormat
|
||||
case CompressionType.Lzma:
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin", Localization.Decompressing_DDT);
|
||||
|
||||
DateTime ddtStart = DateTime.UtcNow;
|
||||
var ddtStopwatch = new Stopwatch();
|
||||
ddtStopwatch.Start();
|
||||
|
||||
byte[] compressedDdt = new byte[ddtHeader.cmpLength - LZMA_PROPERTIES_LENGTH];
|
||||
|
||||
@@ -732,11 +736,11 @@ public sealed partial class AaruFormat
|
||||
return false;
|
||||
}
|
||||
|
||||
DateTime ddtEnd = DateTime.UtcNow;
|
||||
ddtStopwatch.Stop();
|
||||
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin",
|
||||
Localization.Took_0_seconds_to_decompress_DDT,
|
||||
(ddtEnd - ddtStart).TotalSeconds);
|
||||
ddtStopwatch.Elapsed.TotalSeconds);
|
||||
|
||||
break;
|
||||
case CompressionType.None:
|
||||
@@ -3262,8 +3266,7 @@ public sealed partial class AaruFormat
|
||||
switch(_imageInfo.MetadataMediaType)
|
||||
{
|
||||
case MetadataMediaType.OpticalDisc when Tracks is { Count: > 0 }:
|
||||
DateTime startCompress;
|
||||
DateTime endCompress;
|
||||
var compressStopwatch = new Stopwatch();
|
||||
|
||||
// Old format
|
||||
if(_sectorPrefix != null &&
|
||||
@@ -3302,7 +3305,7 @@ public sealed partial class AaruFormat
|
||||
}
|
||||
else
|
||||
{
|
||||
startCompress = DateTime.Now;
|
||||
compressStopwatch.Restart();
|
||||
|
||||
byte[] cmpBuffer = new byte[_sectorPrefix.Length + 262144];
|
||||
|
||||
@@ -3340,10 +3343,10 @@ public sealed partial class AaruFormat
|
||||
prefixBlock.cmpCrc64 = BitConverter.ToUInt64(blockCrc, 0);
|
||||
prefixBlock.compression = _compressionAlgorithm;
|
||||
|
||||
endCompress = DateTime.Now;
|
||||
compressStopwatch.Stop();
|
||||
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin", Localization.Took_0_seconds_to_compress_prefix,
|
||||
(endCompress - startCompress).TotalSeconds);
|
||||
compressStopwatch.Elapsed.TotalSeconds);
|
||||
}
|
||||
|
||||
_structureBytes = new byte[Marshal.SizeOf<BlockHeader>()];
|
||||
@@ -3391,7 +3394,7 @@ public sealed partial class AaruFormat
|
||||
}
|
||||
else
|
||||
{
|
||||
startCompress = DateTime.Now;
|
||||
compressStopwatch.Restart();
|
||||
|
||||
byte[] cmpBuffer = new byte[_sectorSuffix.Length + 262144];
|
||||
|
||||
@@ -3429,10 +3432,10 @@ public sealed partial class AaruFormat
|
||||
prefixBlock.cmpCrc64 = BitConverter.ToUInt64(blockCrc, 0);
|
||||
prefixBlock.compression = CompressionType.Lzma;
|
||||
|
||||
endCompress = DateTime.Now;
|
||||
compressStopwatch.Stop();
|
||||
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin", Localization.Took_0_seconds_to_compress_suffix,
|
||||
(endCompress - startCompress).TotalSeconds);
|
||||
compressStopwatch.Elapsed.TotalSeconds);
|
||||
}
|
||||
|
||||
_structureBytes = new byte[Marshal.SizeOf<BlockHeader>()];
|
||||
@@ -3725,7 +3728,7 @@ public sealed partial class AaruFormat
|
||||
}
|
||||
else
|
||||
{
|
||||
startCompress = DateTime.Now;
|
||||
compressStopwatch.Restart();
|
||||
|
||||
byte[] sectorPrefixBuffer = _sectorPrefixMs.ToArray();
|
||||
cmpBuffer = new byte[sectorPrefixBuffer.Length + 262144];
|
||||
@@ -3762,10 +3765,10 @@ public sealed partial class AaruFormat
|
||||
prefixBlock.cmpCrc64 = BitConverter.ToUInt64(blockCrc, 0);
|
||||
prefixBlock.compression = _compressionAlgorithm;
|
||||
|
||||
endCompress = DateTime.Now;
|
||||
compressStopwatch.Stop();
|
||||
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin", Localization.Took_0_seconds_to_compress_prefix,
|
||||
(endCompress - startCompress).TotalSeconds);
|
||||
compressStopwatch.Elapsed.TotalSeconds);
|
||||
}
|
||||
|
||||
_structureBytes = new byte[Marshal.SizeOf<BlockHeader>()];
|
||||
@@ -3819,7 +3822,7 @@ public sealed partial class AaruFormat
|
||||
}
|
||||
else
|
||||
{
|
||||
startCompress = DateTime.Now;
|
||||
compressStopwatch.Restart();
|
||||
|
||||
byte[] sectorSuffixBuffer = _sectorPrefixMs.ToArray();
|
||||
cmpBuffer = new byte[sectorSuffixBuffer.Length + 262144];
|
||||
@@ -3856,10 +3859,10 @@ public sealed partial class AaruFormat
|
||||
suffixBlock.cmpCrc64 = BitConverter.ToUInt64(blockCrc, 0);
|
||||
suffixBlock.compression = _compressionAlgorithm;
|
||||
|
||||
endCompress = DateTime.Now;
|
||||
compressStopwatch.Stop();
|
||||
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin", Localization.Took_0_seconds_to_compress_suffix,
|
||||
(endCompress - startCompress).TotalSeconds);
|
||||
compressStopwatch.Elapsed.TotalSeconds);
|
||||
}
|
||||
|
||||
_structureBytes = new byte[Marshal.SizeOf<BlockHeader>()];
|
||||
@@ -3916,7 +3919,7 @@ public sealed partial class AaruFormat
|
||||
}
|
||||
else
|
||||
{
|
||||
startCompress = DateTime.Now;
|
||||
compressStopwatch.Restart();
|
||||
|
||||
byte[] cmpBuffer = new byte[_mode2Subheaders.Length + 262144];
|
||||
|
||||
@@ -3954,11 +3957,11 @@ public sealed partial class AaruFormat
|
||||
subheaderBlock.cmpCrc64 = BitConverter.ToUInt64(blockCrc, 0);
|
||||
subheaderBlock.compression = _compressionAlgorithm;
|
||||
|
||||
endCompress = DateTime.Now;
|
||||
compressStopwatch.Stop();
|
||||
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin",
|
||||
Localization.Took_0_seconds_to_compress_MODE2_subheaders,
|
||||
(endCompress - startCompress).TotalSeconds);
|
||||
compressStopwatch.Elapsed.TotalSeconds);
|
||||
}
|
||||
|
||||
_structureBytes = new byte[Marshal.SizeOf<BlockHeader>()];
|
||||
@@ -4014,7 +4017,7 @@ public sealed partial class AaruFormat
|
||||
}
|
||||
else
|
||||
{
|
||||
startCompress = DateTime.Now;
|
||||
compressStopwatch.Restart();
|
||||
byte[] transformedSubchannel = ClauniaSubchannelTransform(_sectorSubchannel);
|
||||
|
||||
byte[] cmpBuffer = new byte[transformedSubchannel.Length + 262144];
|
||||
@@ -4056,11 +4059,11 @@ public sealed partial class AaruFormat
|
||||
? CompressionType.LzmaClauniaSubchannelTransform
|
||||
: _compressionAlgorithm;
|
||||
|
||||
endCompress = DateTime.Now;
|
||||
compressStopwatch.Stop();
|
||||
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin",
|
||||
Localization.Took_0_seconds_to_compress_subchannel,
|
||||
(endCompress - startCompress).TotalSeconds);
|
||||
compressStopwatch.Elapsed.TotalSeconds);
|
||||
}
|
||||
|
||||
_structureBytes = new byte[Marshal.SizeOf<BlockHeader>()];
|
||||
@@ -4116,7 +4119,7 @@ public sealed partial class AaruFormat
|
||||
}
|
||||
else
|
||||
{
|
||||
startCompress = DateTime.Now;
|
||||
compressStopwatch.Restart();
|
||||
|
||||
byte[] cmpBuffer = new byte[_sectorCprMai.Length + 262144];
|
||||
|
||||
@@ -4154,11 +4157,11 @@ public sealed partial class AaruFormat
|
||||
cprMaiBlock.cmpCrc64 = BitConverter.ToUInt64(blockCrc, 0);
|
||||
cprMaiBlock.compression = _compressionAlgorithm;
|
||||
|
||||
endCompress = DateTime.Now;
|
||||
compressStopwatch.Stop();
|
||||
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin",
|
||||
Localization.Took_0_seconds_to_compress_CPR_MAI,
|
||||
(endCompress - startCompress).TotalSeconds);
|
||||
compressStopwatch.Elapsed.TotalSeconds);
|
||||
}
|
||||
|
||||
_structureBytes = new byte[Marshal.SizeOf<BlockHeader>()];
|
||||
@@ -4211,7 +4214,7 @@ public sealed partial class AaruFormat
|
||||
}
|
||||
else
|
||||
{
|
||||
startCompress = DateTime.Now;
|
||||
compressStopwatch.Restart();
|
||||
|
||||
byte[] cmpBuffer = new byte[_sectorId.Length + 262144];
|
||||
|
||||
@@ -4249,11 +4252,11 @@ public sealed partial class AaruFormat
|
||||
idBlock.cmpCrc64 = BitConverter.ToUInt64(blockCrc, 0);
|
||||
idBlock.compression = _compressionAlgorithm;
|
||||
|
||||
endCompress = DateTime.Now;
|
||||
compressStopwatch.Stop();
|
||||
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin",
|
||||
Localization.Took_0_seconds_to_compress_ID,
|
||||
(endCompress - startCompress).TotalSeconds);
|
||||
compressStopwatch.Elapsed.TotalSeconds);
|
||||
}
|
||||
|
||||
_structureBytes = new byte[Marshal.SizeOf<BlockHeader>()];
|
||||
@@ -4306,7 +4309,7 @@ public sealed partial class AaruFormat
|
||||
}
|
||||
else
|
||||
{
|
||||
startCompress = DateTime.Now;
|
||||
compressStopwatch.Restart();
|
||||
|
||||
byte[] cmpBuffer = new byte[_sectorIed.Length + 262144];
|
||||
|
||||
@@ -4344,11 +4347,11 @@ public sealed partial class AaruFormat
|
||||
iedBlock.cmpCrc64 = BitConverter.ToUInt64(blockCrc, 0);
|
||||
iedBlock.compression = _compressionAlgorithm;
|
||||
|
||||
endCompress = DateTime.Now;
|
||||
compressStopwatch.Stop();
|
||||
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin",
|
||||
Localization.Took_0_seconds_to_compress_IED,
|
||||
(endCompress - startCompress).TotalSeconds);
|
||||
compressStopwatch.Elapsed.TotalSeconds);
|
||||
}
|
||||
|
||||
_structureBytes = new byte[Marshal.SizeOf<BlockHeader>()];
|
||||
@@ -4401,7 +4404,7 @@ public sealed partial class AaruFormat
|
||||
}
|
||||
else
|
||||
{
|
||||
startCompress = DateTime.Now;
|
||||
compressStopwatch.Restart();
|
||||
|
||||
byte[] cmpBuffer = new byte[_sectorEdc.Length + 262144];
|
||||
|
||||
@@ -4439,11 +4442,11 @@ public sealed partial class AaruFormat
|
||||
edcBlock.cmpCrc64 = BitConverter.ToUInt64(blockCrc, 0);
|
||||
edcBlock.compression = _compressionAlgorithm;
|
||||
|
||||
endCompress = DateTime.Now;
|
||||
compressStopwatch.Stop();
|
||||
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin",
|
||||
Localization.Took_0_seconds_to_compress_EDC,
|
||||
(endCompress - startCompress).TotalSeconds);
|
||||
compressStopwatch.Elapsed.TotalSeconds);
|
||||
}
|
||||
|
||||
_structureBytes = new byte[Marshal.SizeOf<BlockHeader>()];
|
||||
@@ -4497,7 +4500,7 @@ public sealed partial class AaruFormat
|
||||
}
|
||||
else
|
||||
{
|
||||
startCompress = DateTime.Now;
|
||||
compressStopwatch.Restart();
|
||||
|
||||
byte[] cmpBuffer = new byte[_sectorDecryptedTitleKey.Length + 262144];
|
||||
|
||||
@@ -4535,11 +4538,11 @@ public sealed partial class AaruFormat
|
||||
titleKeyBlock.cmpCrc64 = BitConverter.ToUInt64(blockCrc, 0);
|
||||
titleKeyBlock.compression = _compressionAlgorithm;
|
||||
|
||||
endCompress = DateTime.Now;
|
||||
compressStopwatch.Stop();
|
||||
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin",
|
||||
Localization.Took_0_seconds_to_compress_decrypted_DVD_title_keys,
|
||||
(endCompress - startCompress).TotalSeconds);
|
||||
compressStopwatch.Elapsed.TotalSeconds);
|
||||
}
|
||||
|
||||
_structureBytes = new byte[Marshal.SizeOf<BlockHeader>()];
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -76,6 +77,7 @@ public sealed partial class Chd
|
||||
stream.EnsureRead(buffer, 0, (int)length);
|
||||
|
||||
ulong nextMetaOff = 0;
|
||||
var hunkMapStopwatch = new Stopwatch();
|
||||
|
||||
switch(version)
|
||||
{
|
||||
@@ -103,8 +105,8 @@ public sealed partial class Chd
|
||||
: ArrayHelpers.ByteArrayToHex(hdrV1.parentmd5));
|
||||
|
||||
AaruConsole.DebugWriteLine("CHD plugin", Localization.Reading_Hunk_map);
|
||||
DateTime start = DateTime.UtcNow;
|
||||
|
||||
hunkMapStopwatch.Restart();
|
||||
_hunkTable = new ulong[hdrV1.totalhunks];
|
||||
|
||||
uint hunkSectorCount = (uint)Math.Ceiling((double)hdrV1.totalhunks * 8 / 512);
|
||||
@@ -128,8 +130,10 @@ public sealed partial class Chd
|
||||
Array.Copy(hunkSector.hunkEntry, 0, _hunkTable, i * 512 / 8, _hunkTable.Length - (i * 512 / 8));
|
||||
}
|
||||
|
||||
DateTime end = DateTime.UtcNow;
|
||||
AaruConsole.DebugWriteLine("CHD plugin", Localization.Took_0_seconds, (end - start).TotalSeconds);
|
||||
hunkMapStopwatch.Stop();
|
||||
|
||||
AaruConsole.DebugWriteLine("CHD plugin", Localization.Took_0_seconds,
|
||||
hunkMapStopwatch.Elapsed.TotalSeconds);
|
||||
|
||||
_imageInfo.MediaType = MediaType.GENERIC_HDD;
|
||||
_imageInfo.Sectors = hdrV1.hunksize * hdrV1.totalhunks;
|
||||
@@ -177,7 +181,7 @@ public sealed partial class Chd
|
||||
AaruConsole.DebugWriteLine("CHD plugin", "hdrV2.seclen = {0}", hdrV2.seclen);
|
||||
|
||||
AaruConsole.DebugWriteLine("CHD plugin", Localization.Reading_Hunk_map);
|
||||
DateTime start = DateTime.UtcNow;
|
||||
hunkMapStopwatch.Restart();
|
||||
|
||||
_hunkTable = new ulong[hdrV2.totalhunks];
|
||||
|
||||
@@ -203,8 +207,10 @@ public sealed partial class Chd
|
||||
Array.Copy(hunkSector.hunkEntry, 0, _hunkTable, i * 512 / 8, _hunkTable.Length - (i * 512 / 8));
|
||||
}
|
||||
|
||||
DateTime end = DateTime.UtcNow;
|
||||
AaruConsole.DebugWriteLine("CHD plugin", Localization.Took_0_seconds, (end - start).TotalSeconds);
|
||||
hunkMapStopwatch.Stop();
|
||||
|
||||
AaruConsole.DebugWriteLine("CHD plugin", Localization.Took_0_seconds,
|
||||
hunkMapStopwatch.Elapsed.TotalSeconds);
|
||||
|
||||
_imageInfo.MediaType = MediaType.GENERIC_HDD;
|
||||
_imageInfo.Sectors = hdrV2.hunksize * hdrV2.totalhunks;
|
||||
@@ -256,13 +262,15 @@ public sealed partial class Chd
|
||||
: ArrayHelpers.ByteArrayToHex(hdrV3.parentsha1));
|
||||
|
||||
AaruConsole.DebugWriteLine("CHD plugin", Localization.Reading_Hunk_map);
|
||||
DateTime start = DateTime.UtcNow;
|
||||
hunkMapStopwatch.Restart();
|
||||
|
||||
_hunkMap = new byte[hdrV3.totalhunks * 16];
|
||||
stream.EnsureRead(_hunkMap, 0, _hunkMap.Length);
|
||||
|
||||
DateTime end = DateTime.UtcNow;
|
||||
AaruConsole.DebugWriteLine("CHD plugin", Localization.Took_0_seconds, (end - start).TotalSeconds);
|
||||
hunkMapStopwatch.Stop();
|
||||
|
||||
AaruConsole.DebugWriteLine("CHD plugin", Localization.Took_0_seconds,
|
||||
hunkMapStopwatch.Elapsed.TotalSeconds);
|
||||
|
||||
nextMetaOff = hdrV3.metaoffset;
|
||||
|
||||
@@ -304,13 +312,15 @@ public sealed partial class Chd
|
||||
ArrayHelpers.ByteArrayToHex(hdrV4.rawsha1));
|
||||
|
||||
AaruConsole.DebugWriteLine("CHD plugin", Localization.Reading_Hunk_map);
|
||||
DateTime start = DateTime.UtcNow;
|
||||
hunkMapStopwatch.Restart();
|
||||
|
||||
_hunkMap = new byte[hdrV4.totalhunks * 16];
|
||||
stream.EnsureRead(_hunkMap, 0, _hunkMap.Length);
|
||||
|
||||
DateTime end = DateTime.UtcNow;
|
||||
AaruConsole.DebugWriteLine("CHD plugin", Localization.Took_0_seconds, (end - start).TotalSeconds);
|
||||
hunkMapStopwatch.Stop();
|
||||
|
||||
AaruConsole.DebugWriteLine("CHD plugin", Localization.Took_0_seconds,
|
||||
hunkMapStopwatch.Elapsed.TotalSeconds);
|
||||
|
||||
nextMetaOff = hdrV4.metaoffset;
|
||||
|
||||
@@ -370,7 +380,7 @@ public sealed partial class Chd
|
||||
if(hdrV5.compressor0 == 0)
|
||||
{
|
||||
AaruConsole.DebugWriteLine("CHD plugin", Localization.Reading_Hunk_map);
|
||||
DateTime start = DateTime.UtcNow;
|
||||
hunkMapStopwatch.Restart();
|
||||
|
||||
_hunkTableSmall = new uint[hdrV5.logicalbytes / hdrV5.hunkbytes];
|
||||
|
||||
@@ -400,8 +410,10 @@ public sealed partial class Chd
|
||||
_hunkTableSmall.Length - (i * 512 / 4));
|
||||
}
|
||||
|
||||
DateTime end = DateTime.UtcNow;
|
||||
AaruConsole.DebugWriteLine("CHD plugin", Localization.Took_0_seconds, (end - start).TotalSeconds);
|
||||
hunkMapStopwatch.Stop();
|
||||
|
||||
AaruConsole.DebugWriteLine("CHD plugin", Localization.Took_0_seconds,
|
||||
hunkMapStopwatch.Elapsed.TotalSeconds);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
// Copyright © 2011-2023 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Aaru.CommonTypes;
|
||||
@@ -90,7 +90,8 @@ public sealed partial class PartClone
|
||||
AaruConsole.DebugWriteLine("PartClone plugin", "pHdr.dataOff = {0}", _dataOff);
|
||||
|
||||
AaruConsole.DebugWriteLine("PartClone plugin", Localization.Filling_extents);
|
||||
DateTime start = DateTime.Now;
|
||||
var extentFillStopwatch = new Stopwatch();
|
||||
extentFillStopwatch.Start();
|
||||
_extents = new ExtentsULong();
|
||||
_extentsOff = new Dictionary<ulong, ulong>();
|
||||
bool current = _byteMap[0] > 0;
|
||||
@@ -120,10 +121,10 @@ public sealed partial class PartClone
|
||||
current = next;
|
||||
}
|
||||
|
||||
DateTime end = DateTime.Now;
|
||||
extentFillStopwatch.Stop();
|
||||
|
||||
AaruConsole.DebugWriteLine("PartClone plugin", Localization.Took_0_seconds_to_fill_extents,
|
||||
(end - start).TotalSeconds);
|
||||
extentFillStopwatch.Elapsed.TotalSeconds);
|
||||
|
||||
_sectorCache = new Dictionary<ulong, byte[]>();
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
@@ -325,7 +326,8 @@ public sealed partial class Partimage
|
||||
}
|
||||
|
||||
AaruConsole.DebugWriteLine("Partimage plugin", Localization.Filling_extents);
|
||||
DateTime start = DateTime.Now;
|
||||
var extentsFillStopwatch = new Stopwatch();
|
||||
extentsFillStopwatch.Start();
|
||||
_extents = new ExtentsULong();
|
||||
_extentsOff = new Dictionary<ulong, ulong>();
|
||||
bool current = (_bitmap[0] & (1 << (0 % 8))) != 0;
|
||||
@@ -355,10 +357,10 @@ public sealed partial class Partimage
|
||||
current = next;
|
||||
}
|
||||
|
||||
DateTime end = DateTime.Now;
|
||||
extentsFillStopwatch.Stop();
|
||||
|
||||
AaruConsole.DebugWriteLine("Partimage plugin", Localization.Took_0_seconds_to_fill_extents,
|
||||
(end - start).TotalSeconds);
|
||||
extentsFillStopwatch.Elapsed.TotalSeconds);
|
||||
|
||||
_sectorCache = new Dictionary<ulong, byte[]>();
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using Aaru.CommonTypes;
|
||||
@@ -96,16 +97,17 @@ public sealed partial class Vdi
|
||||
return ErrorNumber.InvalidArgument;
|
||||
}
|
||||
|
||||
DateTime start = DateTime.UtcNow;
|
||||
var blockMapStopwatch = new Stopwatch();
|
||||
blockMapStopwatch.Start();
|
||||
AaruConsole.DebugWriteLine("VirtualBox plugin", Localization.Reading_Image_Block_Map);
|
||||
stream.Seek(_vHdr.offsetBlocks, SeekOrigin.Begin);
|
||||
byte[] ibmB = new byte[_vHdr.blocks * 4];
|
||||
stream.EnsureRead(ibmB, 0, ibmB.Length);
|
||||
_ibm = MemoryMarshal.Cast<byte, uint>(ibmB).ToArray();
|
||||
DateTime end = DateTime.UtcNow;
|
||||
blockMapStopwatch.Stop();
|
||||
|
||||
AaruConsole.DebugWriteLine("VirtualBox plugin", Localization.Reading_Image_Block_Map_took_0_ms,
|
||||
(end - start).TotalMilliseconds);
|
||||
blockMapStopwatch.Elapsed.TotalMilliseconds);
|
||||
|
||||
_sectorCache = new Dictionary<ulong, byte[]>();
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
@@ -475,7 +476,8 @@ public sealed partial class Vhd
|
||||
return ErrorNumber.InvalidArgument;
|
||||
}
|
||||
|
||||
DateTime startTime = DateTime.UtcNow;
|
||||
var batStopwatch = new Stopwatch();
|
||||
batStopwatch.Start();
|
||||
|
||||
_blockAllocationTable = new uint[_thisDynamic.MaxTableEntries];
|
||||
|
||||
@@ -490,10 +492,10 @@ public sealed partial class Vhd
|
||||
for(int i = 0; i < _blockAllocationTable.Length; i++)
|
||||
_blockAllocationTable[i] = Swapping.Swap(_blockAllocationTable[i]);
|
||||
|
||||
DateTime endTime = DateTime.UtcNow;
|
||||
batStopwatch.Stop();
|
||||
|
||||
AaruConsole.DebugWriteLine("VirtualPC plugin", Localization.Filling_the_BAT_took_0_seconds,
|
||||
(endTime - startTime).TotalSeconds);
|
||||
batStopwatch.Elapsed.TotalSeconds);
|
||||
|
||||
_bitmapSize = (uint)Math.Ceiling((double)_thisDynamic.BlockSize / 512
|
||||
|
||||
|
||||
@@ -30,10 +30,10 @@
|
||||
// Copyright © 2011-2023 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.CommandLine;
|
||||
using System.CommandLine.NamingConventionBinder;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
@@ -188,21 +188,19 @@ sealed class VerifyCommand : Command
|
||||
return (int)ErrorNumber.NotVerifiable;
|
||||
}
|
||||
|
||||
TimeSpan checkTime;
|
||||
var chkWatch = new Stopwatch();
|
||||
|
||||
if(verifyDisc && verifiableImage != null)
|
||||
{
|
||||
bool? discCheckStatus = null;
|
||||
checkTime = new TimeSpan();
|
||||
|
||||
Core.Spectre.ProgressSingleSpinner(ctx =>
|
||||
{
|
||||
ctx.AddTask(UI.Verifying_image_checksums).IsIndeterminate();
|
||||
|
||||
DateTime startCheck = DateTime.UtcNow;
|
||||
chkWatch.Start();
|
||||
discCheckStatus = verifiableImage.VerifyMediaImage();
|
||||
DateTime endCheck = DateTime.UtcNow;
|
||||
checkTime = endCheck - startCheck;
|
||||
chkWatch.Stop();
|
||||
});
|
||||
|
||||
switch(discCheckStatus)
|
||||
@@ -222,7 +220,9 @@ sealed class VerifyCommand : Command
|
||||
}
|
||||
|
||||
correctImage = discCheckStatus;
|
||||
AaruConsole.VerboseWriteLine(UI.Checking_disc_image_checksums_took_0, checkTime.Humanize(minUnit: TimeUnit.Second));
|
||||
|
||||
AaruConsole.VerboseWriteLine(UI.Checking_disc_image_checksums_took_0,
|
||||
chkWatch.Elapsed.Humanize(minUnit: TimeUnit.Second));
|
||||
}
|
||||
|
||||
if(!verifySectors)
|
||||
@@ -233,8 +233,7 @@ sealed class VerifyCommand : Command
|
||||
true => (int)ErrorNumber.CorrectImageSectorsNotVerified
|
||||
};
|
||||
|
||||
DateTime startCheck = DateTime.Now;
|
||||
DateTime endCheck = startCheck;
|
||||
var stopwatch = new Stopwatch();
|
||||
List<ulong> failingLbas = new();
|
||||
List<ulong> unknownLbas = new();
|
||||
IMediaGraph mediaGraph = null;
|
||||
@@ -255,7 +254,7 @@ sealed class VerifyCommand : Command
|
||||
List<Track> inputTracks = opticalMediaImage.Tracks;
|
||||
ulong currentSectorAll = 0;
|
||||
|
||||
startCheck = DateTime.UtcNow;
|
||||
stopwatch.Start();
|
||||
|
||||
AnsiConsole.Progress().AutoClear(true).HideCompleted(true).
|
||||
Columns(new TaskDescriptionColumn(), new ProgressBarColumn(), new PercentageColumn()).
|
||||
@@ -340,7 +339,7 @@ sealed class VerifyCommand : Command
|
||||
discTask.Increment(1);
|
||||
}
|
||||
|
||||
endCheck = DateTime.UtcNow;
|
||||
stopwatch.Stop();
|
||||
});
|
||||
}
|
||||
else if(verifiableSectorsImage != null)
|
||||
@@ -355,7 +354,7 @@ sealed class VerifyCommand : Command
|
||||
ProgressTask diskTask = ctx.AddTask(UI.Checking_sectors);
|
||||
diskTask.MaxValue = inputFormat.Info.Sectors;
|
||||
|
||||
startCheck = DateTime.UtcNow;
|
||||
stopwatch.Restart();
|
||||
|
||||
while(remainingSectors > 0)
|
||||
{
|
||||
@@ -408,12 +407,10 @@ sealed class VerifyCommand : Command
|
||||
}
|
||||
}
|
||||
|
||||
endCheck = DateTime.UtcNow;
|
||||
stopwatch.Stop();
|
||||
});
|
||||
}
|
||||
|
||||
checkTime = endCheck - startCheck;
|
||||
|
||||
if(unknownLbas.Count > 0)
|
||||
AaruConsole.WriteLine(UI.There_is_at_least_one_sector_that_does_not_contain_a_checksum);
|
||||
|
||||
@@ -424,7 +421,8 @@ sealed class VerifyCommand : Command
|
||||
failingLbas.Count == 0)
|
||||
AaruConsole.WriteLine(UI.All_sector_checksums_are_correct);
|
||||
|
||||
AaruConsole.VerboseWriteLine(UI.Checking_sector_checksums_took_0, checkTime.Humanize(minUnit: TimeUnit.Second));
|
||||
AaruConsole.VerboseWriteLine(UI.Checking_sector_checksums_took_0,
|
||||
stopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second));
|
||||
|
||||
if(verbose)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user