mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Remove benchmark, media scan, and verify statistics.
This commit is contained in:
@@ -401,141 +401,5 @@ namespace DiscImageChef.Core
|
||||
|
||||
ctx.Medias.Add(new Database.Models.Media {Real = real, Synchronized = false, Type = type.ToString()});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds benchmark results to statistics
|
||||
/// </summary>
|
||||
/// <param name="checksums">Checksum times</param>
|
||||
/// <param name="entropy">Entropy times</param>
|
||||
/// <param name="all">Time for all running togheter</param>
|
||||
/// <param name="sequential">Time for sequential running</param>
|
||||
/// <param name="maxMemory">Maximum used memory</param>
|
||||
/// <param name="minMemory">Minimum used memory</param>
|
||||
public static void AddBenchmark(Dictionary<string, double> checksums, double entropy, double all,
|
||||
double sequential, long maxMemory, long minMemory)
|
||||
{
|
||||
if(Settings.Settings.Current.Stats == null || !Settings.Settings.Current.Stats.BenchmarkStats) return;
|
||||
|
||||
CurrentStats.Benchmark = new BenchmarkStats {Checksum = new List<ChecksumStats>()};
|
||||
AllStats.Benchmark = new BenchmarkStats {Checksum = new List<ChecksumStats>()};
|
||||
|
||||
foreach(ChecksumStats st in checksums.Select(kvp => new ChecksumStats
|
||||
{
|
||||
algorithm = kvp.Key, Value = kvp.Value
|
||||
}))
|
||||
{
|
||||
CurrentStats.Benchmark.Checksum.Add(st);
|
||||
AllStats.Benchmark.Checksum.Add(st);
|
||||
}
|
||||
|
||||
CurrentStats.Benchmark.All = all;
|
||||
CurrentStats.Benchmark.Entropy = entropy;
|
||||
CurrentStats.Benchmark.MaxMemory = maxMemory;
|
||||
CurrentStats.Benchmark.MinMemory = minMemory;
|
||||
CurrentStats.Benchmark.Sequential = sequential;
|
||||
|
||||
AllStats.Benchmark.All = all;
|
||||
AllStats.Benchmark.Entropy = entropy;
|
||||
AllStats.Benchmark.MaxMemory = maxMemory;
|
||||
AllStats.Benchmark.MinMemory = minMemory;
|
||||
AllStats.Benchmark.Sequential = sequential;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new media image verification to statistics
|
||||
/// </summary>
|
||||
/// <param name="mediaVerified">Set if media was correctly verified</param>
|
||||
/// <param name="correct">How many sectors where verified correctly</param>
|
||||
/// <param name="failed">How many sectors failed verification</param>
|
||||
/// <param name="unknown">How many sectors could not be verified</param>
|
||||
/// <param name="total">Total sectors verified</param>
|
||||
public static void AddVerify(bool? mediaVerified, long correct, long failed, long unknown, long total)
|
||||
{
|
||||
if(Settings.Settings.Current.Stats == null || !Settings.Settings.Current.Stats.VerifyStats) return;
|
||||
|
||||
if(CurrentStats.Verify == null)
|
||||
CurrentStats.Verify =
|
||||
new VerifyStats {MediaImages = new VerifiedItems(), Sectors = new ScannedSectors()};
|
||||
|
||||
if(AllStats.Verify == null)
|
||||
AllStats.Verify = new VerifyStats {MediaImages = new VerifiedItems(), Sectors = new ScannedSectors()};
|
||||
|
||||
if(mediaVerified.HasValue)
|
||||
if(mediaVerified.Value)
|
||||
{
|
||||
CurrentStats.Verify.MediaImages.Correct++;
|
||||
AllStats.Verify.MediaImages.Correct++;
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentStats.Verify.MediaImages.Failed++;
|
||||
AllStats.Verify.MediaImages.Failed++;
|
||||
}
|
||||
|
||||
CurrentStats.Verify.Sectors.Correct += correct;
|
||||
CurrentStats.Verify.Sectors.Error += failed;
|
||||
CurrentStats.Verify.Sectors.Unverifiable += unknown;
|
||||
CurrentStats.Verify.Sectors.Total += total;
|
||||
|
||||
AllStats.Verify.Sectors.Correct += correct;
|
||||
AllStats.Verify.Sectors.Error += failed;
|
||||
AllStats.Verify.Sectors.Unverifiable += unknown;
|
||||
AllStats.Verify.Sectors.Total += total;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new media scan to statistics
|
||||
/// </summary>
|
||||
/// <param name="lessThan3Ms">Sectors <3ms</param>
|
||||
/// <param name="lessThan10Ms">Sectors >3ms and <10ms</param>
|
||||
/// <param name="lessThan50Ms">Sectors >10ms and <50ms</param>
|
||||
/// <param name="lessThan150Ms">Sectors >50ms and <150ms</param>
|
||||
/// <param name="lessThan500Ms">Sectors >150ms and <500ms</param>
|
||||
/// <param name="moreThan500Ms">Sectors >500ms</param>
|
||||
/// <param name="total">Total sectors</param>
|
||||
/// <param name="error">Errored sectors</param>
|
||||
/// <param name="correct">Correct sectors</param>
|
||||
public static void AddMediaScan(long lessThan3Ms, long lessThan10Ms, long lessThan50Ms, long lessThan150Ms,
|
||||
long lessThan500Ms, long moreThan500Ms, long total, long error,
|
||||
long correct)
|
||||
{
|
||||
if(lessThan3Ms < 0) throw new ArgumentOutOfRangeException(nameof(lessThan3Ms));
|
||||
if(lessThan10Ms < 0) throw new ArgumentOutOfRangeException(nameof(lessThan10Ms));
|
||||
if(lessThan50Ms < 0) throw new ArgumentOutOfRangeException(nameof(lessThan50Ms));
|
||||
if(lessThan150Ms < 0) throw new ArgumentOutOfRangeException(nameof(lessThan150Ms));
|
||||
if(lessThan500Ms < 0) throw new ArgumentOutOfRangeException(nameof(lessThan500Ms));
|
||||
if(moreThan500Ms < 0) throw new ArgumentOutOfRangeException(nameof(moreThan500Ms));
|
||||
if(total < 0) throw new ArgumentOutOfRangeException(nameof(total));
|
||||
if(error < 0) throw new ArgumentOutOfRangeException(nameof(error));
|
||||
if(correct < 0) throw new ArgumentOutOfRangeException(nameof(correct));
|
||||
|
||||
if(Settings.Settings.Current.Stats == null || !Settings.Settings.Current.Stats.MediaScanStats) return;
|
||||
|
||||
if(CurrentStats.MediaScan == null)
|
||||
CurrentStats.MediaScan = new MediaScanStats {Sectors = new ScannedSectors(), Times = new TimeStats()};
|
||||
|
||||
if(AllStats.MediaScan == null)
|
||||
AllStats.MediaScan = new MediaScanStats {Sectors = new ScannedSectors(), Times = new TimeStats()};
|
||||
|
||||
CurrentStats.MediaScan.Sectors.Correct += correct;
|
||||
CurrentStats.MediaScan.Sectors.Error += error;
|
||||
CurrentStats.MediaScan.Sectors.Total += total;
|
||||
CurrentStats.MediaScan.Times.LessThan3ms += lessThan3Ms;
|
||||
CurrentStats.MediaScan.Times.LessThan10ms += lessThan10Ms;
|
||||
CurrentStats.MediaScan.Times.LessThan50ms += lessThan50Ms;
|
||||
CurrentStats.MediaScan.Times.LessThan150ms += lessThan150Ms;
|
||||
CurrentStats.MediaScan.Times.LessThan500ms += lessThan500Ms;
|
||||
CurrentStats.MediaScan.Times.MoreThan500ms += moreThan500Ms;
|
||||
|
||||
AllStats.MediaScan.Sectors.Correct += correct;
|
||||
AllStats.MediaScan.Sectors.Error += error;
|
||||
AllStats.MediaScan.Sectors.Total += total;
|
||||
AllStats.MediaScan.Times.LessThan3ms += lessThan3Ms;
|
||||
AllStats.MediaScan.Times.LessThan10ms += lessThan10Ms;
|
||||
AllStats.MediaScan.Times.LessThan50ms += lessThan50Ms;
|
||||
AllStats.MediaScan.Times.LessThan150ms += lessThan150Ms;
|
||||
AllStats.MediaScan.Times.LessThan500ms += lessThan500Ms;
|
||||
AllStats.MediaScan.Times.MoreThan500ms += moreThan500Ms;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user