diff --git a/DiscImageChef.Core/Statistics.cs b/DiscImageChef.Core/Statistics.cs index a8bfa9636..9e62eb0d9 100644 --- a/DiscImageChef.Core/Statistics.cs +++ b/DiscImageChef.Core/Statistics.cs @@ -401,141 +401,5 @@ namespace DiscImageChef.Core ctx.Medias.Add(new Database.Models.Media {Real = real, Synchronized = false, Type = type.ToString()}); } - - /// - /// Adds benchmark results to statistics - /// - /// Checksum times - /// Entropy times - /// Time for all running togheter - /// Time for sequential running - /// Maximum used memory - /// Minimum used memory - public static void AddBenchmark(Dictionary 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()}; - AllStats.Benchmark = new BenchmarkStats {Checksum = new List()}; - - 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; - } - - /// - /// Adds a new media image verification to statistics - /// - /// Set if media was correctly verified - /// How many sectors where verified correctly - /// How many sectors failed verification - /// How many sectors could not be verified - /// Total sectors verified - 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; - } - - /// - /// Adds a new media scan to statistics - /// - /// Sectors <3ms - /// Sectors >3ms and <10ms - /// Sectors >10ms and <50ms - /// Sectors >50ms and <150ms - /// Sectors >150ms and <500ms - /// Sectors >500ms - /// Total sectors - /// Errored sectors - /// Correct sectors - 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; - } } } \ No newline at end of file diff --git a/DiscImageChef.Gui/Dialogs/dlgBenchmark.xeto.cs b/DiscImageChef.Gui/Dialogs/dlgBenchmark.xeto.cs index c916abc7c..21776cdfb 100644 --- a/DiscImageChef.Gui/Dialogs/dlgBenchmark.xeto.cs +++ b/DiscImageChef.Gui/Dialogs/dlgBenchmark.xeto.cs @@ -121,8 +121,6 @@ namespace DiscImageChef.Gui.Dialogs stkCalculationResults.Items.Add(new Label {Text = $"Min memory used is {results.MinMemory} bytes"}); Statistics.AddCommand("benchmark"); - Statistics.AddBenchmark(checksumTimes, results.EntropyTime, results.TotalTime, results.SeparateTime, - results.MaxMemory, results.MinMemory); stkCalculationResults.Items.Add(new StackLayoutItem(stkButtons, HorizontalAlignment.Right, true)); stkCalculationResults.Visible = true; diff --git a/DiscImageChef.Gui/Dialogs/dlgStatistics.xeto b/DiscImageChef.Gui/Dialogs/dlgStatistics.xeto index bf970f9e5..c340cbb80 100644 --- a/DiscImageChef.Gui/Dialogs/dlgStatistics.xeto +++ b/DiscImageChef.Gui/Dialogs/dlgStatistics.xeto @@ -56,7 +56,6 @@