mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Refactor: Return result from core to CLI, show in CLI.
This commit is contained in:
@@ -69,26 +69,54 @@ namespace DiscImageChef.Commands
|
||||
|
||||
Core.Statistics.AddDevice(dev);
|
||||
|
||||
ScanResults results = new ScanResults();
|
||||
|
||||
switch(dev.Type)
|
||||
{
|
||||
case DeviceType.ATA:
|
||||
ATA.Scan(options.MHDDLogPath, options.IBGLogPath, options.DevicePath, dev);
|
||||
results = ATA.Scan(options.MHDDLogPath, options.IBGLogPath, options.DevicePath, dev);
|
||||
break;
|
||||
case DeviceType.MMC:
|
||||
case DeviceType.SecureDigital:
|
||||
SecureDigital.Scan(options.MHDDLogPath, options.IBGLogPath, options.DevicePath, dev);
|
||||
results = SecureDigital.Scan(options.MHDDLogPath, options.IBGLogPath, options.DevicePath, dev);
|
||||
break;
|
||||
case DeviceType.NVMe:
|
||||
NVMe.Scan(options.MHDDLogPath, options.IBGLogPath, options.DevicePath, dev);
|
||||
results = NVMe.Scan(options.MHDDLogPath, options.IBGLogPath, options.DevicePath, dev);
|
||||
break;
|
||||
case DeviceType.ATAPI:
|
||||
case DeviceType.SCSI:
|
||||
SCSI.Scan(options.MHDDLogPath, options.IBGLogPath, options.DevicePath, dev);
|
||||
results = SCSI.Scan(options.MHDDLogPath, options.IBGLogPath, options.DevicePath, dev);
|
||||
break;
|
||||
default:
|
||||
throw new NotSupportedException("Unknown device type.");
|
||||
}
|
||||
|
||||
DicConsole.WriteLine("Took a total of {0} seconds ({1} processing commands).", results.totalTime, results.processingTime);
|
||||
DicConsole.WriteLine("Avegare speed: {0:F3} MiB/sec.", results.avgSpeed);
|
||||
DicConsole.WriteLine("Fastest speed burst: {0:F3} MiB/sec.", results.maxSpeed);
|
||||
DicConsole.WriteLine("Slowest speed burst: {0:F3} MiB/sec.", results.minSpeed);
|
||||
DicConsole.WriteLine("Summary:");
|
||||
DicConsole.WriteLine("{0} sectors took less than 3 ms.", results.A);
|
||||
DicConsole.WriteLine("{0} sectors took less than 10 ms but more than 3 ms.", results.B);
|
||||
DicConsole.WriteLine("{0} sectors took less than 50 ms but more than 10 ms.", results.C);
|
||||
DicConsole.WriteLine("{0} sectors took less than 150 ms but more than 50 ms.", results.D);
|
||||
DicConsole.WriteLine("{0} sectors took less than 500 ms but more than 150 ms.", results.E);
|
||||
DicConsole.WriteLine("{0} sectors took more than 500 ms.", results.F);
|
||||
DicConsole.WriteLine("{0} sectors could not be read.", results.unreadableSectors.Count);
|
||||
if(results.unreadableSectors.Count > 0)
|
||||
{
|
||||
foreach(ulong bad in results.unreadableSectors)
|
||||
DicConsole.WriteLine("Sector {0} could not be read", bad);
|
||||
}
|
||||
DicConsole.WriteLine();
|
||||
|
||||
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
|
||||
if(results.seekTotal != 0 || results.seekMin != double.MaxValue || results.seekMax != double.MinValue)
|
||||
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
|
||||
DicConsole.WriteLine("Testing {0} seeks, longest seek took {1:F3} ms, fastest one took {2:F3} ms. ({3:F3} ms average)",
|
||||
results.seekTimes, results.seekMax, results.seekMin, results.seekTotal / 1000);
|
||||
|
||||
Core.Statistics.AddMediaScan((long)results.A, (long)results.B, (long)results.C, (long)results.D, (long)results.E, (long)results.F, (long)results.blocks, (long)results.errored, (long)(results.blocks - results.errored));
|
||||
Core.Statistics.AddCommand("media-scan");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user