Remove benchmark, media scan, and verify statistics.

This commit is contained in:
2018-12-21 04:23:56 +00:00
parent 94b60395ec
commit 8fb7ccffd6
11 changed files with 11 additions and 393 deletions

View File

@@ -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 &lt;3ms</param>
/// <param name="lessThan10Ms">Sectors &gt;3ms and &lt;10ms</param>
/// <param name="lessThan50Ms">Sectors &gt;10ms and &lt;50ms</param>
/// <param name="lessThan150Ms">Sectors &gt;50ms and &lt;150ms</param>
/// <param name="lessThan500Ms">Sectors &gt;150ms and &lt;500ms</param>
/// <param name="moreThan500Ms">Sectors &gt;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;
}
}
}

View File

@@ -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;

View File

@@ -56,7 +56,6 @@
<Label ID="lblVerify" Visible="False"/>
</StackLayout>
</TabPage>
<TabPage ID="tabBenchmark" Text="Benchmark" Visible="False"/>
<TabPage ID="tabFilters" Text="Filters" Visible="False">
<TreeGridView ID="treeFilters"/>
</TabPage>
@@ -75,29 +74,6 @@
<TabPage ID="tabMedias" Text="Medias" Visible="False">
<TreeGridView ID="treeMedias"/>
</TabPage>
<TabPage ID="tabMediaScan" Text="Media scan" Visible="False">
<StackLayout Orientation="Vertical">
<Label ID="lblSectorsTotal"/>
<Label ID="lblSectorsCorrect"/>
<Label ID="lblSectorsError"/>
<Label ID="lblLessThan3ms"/>
<Label ID="lblLessThan10ms"/>
<Label ID="lblLessThan50ms"/>
<Label ID="lblLessThan150ms"/>
<Label ID="lblLessThan500ms"/>
<Label ID="lblMoreThan500ms"/>
</StackLayout>
</TabPage>
<TabPage ID="tabVerify" Text="Verification" Visible="False">
<StackLayout Orientation="Vertical">
<Label ID="lblCorrectImages"/>
<Label ID="lblFailedImages"/>
<Label ID="lblVerifiedSectors"/>
<Label ID="lblCorrectSectors"/>
<Label ID="lblFailedSectors"/>
<Label ID="lblUnknownSectors"/>
</StackLayout>
</TabPage>
</TabControl>
<StackLayoutItem HorizontalAlignment="Right">
<Button ID="btnClose" Click="OnBtnClose" Text="Close"/>

View File

@@ -174,47 +174,6 @@ namespace DiscImageChef.Gui.Dialogs
lblPrintHex.Visible || lblVerify.Visible;
}
if(Statistics.AllStats.Benchmark != null)
{
StackLayout stkBenchmarks = new StackLayout();
foreach(ChecksumStats chk in Statistics.AllStats.Benchmark.Checksum)
stkBenchmarks.Items.Add(new Label
{
Text =
$"Took {chk.Value} seconds to calculate {chk.algorithm} algorithm"
});
stkBenchmarks.Items.Add(new Label
{
Text =
$"Took {Statistics.AllStats.Benchmark.Sequential} seconds to calculate all algorithms sequentially"
});
stkBenchmarks.Items.Add(new Label
{
Text =
$"Took {Statistics.AllStats.Benchmark.All} seconds to calculate all algorithms at the same time"
});
stkBenchmarks.Items.Add(new Label
{
Text =
$"Took {Statistics.AllStats.Benchmark.Entropy} seconds to calculate entropy"
});
stkBenchmarks.Items.Add(new Label
{
Text =
$"Used a maximum of {Statistics.AllStats.Benchmark.MaxMemory} bytes of memory"
});
stkBenchmarks.Items.Add(new Label
{
Text =
$"Used a minimum of {Statistics.AllStats.Benchmark.MinMemory} bytes of memory"
});
tabBenchmark.Content = stkBenchmarks;
tabBenchmark.Visible = true;
}
if(Statistics.AllStats.Filters != null && Statistics.AllStats.Filters.Count > 0)
{
tabFilters.Visible = true;
@@ -307,8 +266,8 @@ namespace DiscImageChef.Gui.Dialogs
});
}
if(Statistics.AllStats.Medias != null && Statistics.AllStats.Medias.Count > 0)
{
if(Statistics.AllStats.Medias == null || Statistics.AllStats.Medias.Count <= 0) return;
tabMedias.Visible = true;
TreeGridItemCollection mediaList = new TreeGridItemCollection();
@@ -322,46 +281,7 @@ namespace DiscImageChef.Gui.Dialogs
treeMedias.DataStore = mediaList;
foreach(MediaStats ms in Statistics.AllStats.Medias.OrderBy(m => m.type).ThenBy(m => m.real))
mediaList.Add(new TreeGridItem
{
Values = new object[] {ms.type, ms.Value, ms.real ? "real" : "image"}
});
}
if(Statistics.AllStats.MediaScan != null)
{
tabMediaScan.Visible = true;
lblSectorsTotal.Text = $"Scanned a total of {Statistics.AllStats.MediaScan.Sectors.Total} sectors";
lblSectorsCorrect.Text = $"{Statistics.AllStats.MediaScan.Sectors.Correct} of them correctly";
lblSectorsError.Text = $"{Statistics.AllStats.MediaScan.Sectors.Error} of them had errors";
lblLessThan3ms.Text =
$"{Statistics.AllStats.MediaScan.Times.LessThan3ms} of them took less than 3 ms";
lblLessThan10ms.Text =
$"{Statistics.AllStats.MediaScan.Times.LessThan10ms} of them took less than 10 ms but more than 3 ms";
lblLessThan50ms.Text =
$"{Statistics.AllStats.MediaScan.Times.LessThan50ms} of them took less than 50 ms but more than 10 ms";
lblLessThan150ms.Text =
$"{Statistics.AllStats.MediaScan.Times.LessThan150ms} of them took less than 150 ms but more than 50 ms";
lblLessThan500ms.Text =
$"{Statistics.AllStats.MediaScan.Times.LessThan500ms} of them took less than 500 ms but more than 150 ms";
lblMoreThan500ms.Text =
$"{Statistics.AllStats.MediaScan.Times.MoreThan500ms} of them took less than more than 500 ms";
}
if(Statistics.AllStats.Verify == null) return;
tabVerify.Visible = true;
lblCorrectImages.Text =
$"{Statistics.AllStats.Verify.MediaImages.Correct} media images has been correctly verified";
lblFailedImages.Text =
$"{Statistics.AllStats.Verify.MediaImages.Failed} media images has been determined as containing errors";
lblVerifiedSectors.Text = $"{Statistics.AllStats.Verify.Sectors.Total} sectors has been verified";
lblCorrectSectors.Text =
$"{Statistics.AllStats.Verify.Sectors.Correct} sectors has been determined correct";
lblFailedSectors.Text =
$"{Statistics.AllStats.Verify.Sectors.Error} sectors has been determined to contain errors";
lblUnknownSectors.Text =
$"{Statistics.AllStats.Verify.Sectors.Unverifiable} sectors could not be determined as correct or not";
mediaList.Add(new TreeGridItem {Values = new object[] {ms.type, ms.Value, ms.real ? "real" : "image"}});
}
protected void OnBtnClose(object sender, EventArgs e)
@@ -388,7 +308,6 @@ namespace DiscImageChef.Gui.Dialogs
Label lblMediaScan;
Label lblPrintHex;
Label lblVerify;
TabPage tabBenchmark;
TabPage tabFilters;
TreeGridView treeFilters;
TabPage tabFormats;
@@ -401,23 +320,6 @@ namespace DiscImageChef.Gui.Dialogs
TreeGridView treeDevices;
TabPage tabMedias;
TreeGridView treeMedias;
TabPage tabMediaScan;
Label lblSectorsTotal;
Label lblSectorsCorrect;
Label lblSectorsError;
Label lblLessThan3ms;
Label lblLessThan10ms;
Label lblLessThan50ms;
Label lblLessThan150ms;
Label lblLessThan500ms;
Label lblMoreThan500ms;
TabPage tabVerify;
Label lblCorrectImages;
Label lblFailedImages;
Label lblVerifiedSectors;
Label lblCorrectSectors;
Label lblFailedSectors;
Label lblUnknownSectors;
#endregion
}
}

View File

@@ -359,7 +359,6 @@ namespace DiscImageChef.Gui.Forms
}
Statistics.AddCommand("verify");
Statistics.AddVerify(correctDisc, correctSectors, errorSectors, unknownSectors, totalSectors);
Application.Instance.Invoke(() =>
{

View File

@@ -140,9 +140,6 @@ namespace DiscImageChef.Gui.Forms
results.SeekTimes, results.SeekMax, results.SeekMin, results.SeekTotal / 1000);
*/
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));
Statistics.AddCommand("media-scan");
dev.Close();

View File

@@ -386,55 +386,6 @@ namespace DiscImageChef.Server.Controllers
else oldStats.Medias.Add(newMstat);
}
if(newStats.MediaScan != null)
if(oldStats.MediaScan == null)
oldStats.MediaScan = newStats.MediaScan;
else
{
if(oldStats.MediaScan.Sectors == null) oldStats.MediaScan.Sectors = newStats.MediaScan.Sectors;
else
{
oldStats.MediaScan.Sectors.Correct = newStats.MediaScan.Sectors.Correct;
oldStats.MediaScan.Sectors.Error = newStats.MediaScan.Sectors.Error;
oldStats.MediaScan.Sectors.Total = newStats.MediaScan.Sectors.Total;
oldStats.MediaScan.Sectors.Unverifiable = newStats.MediaScan.Sectors.Unverifiable;
}
if(oldStats.MediaScan.Times == null) oldStats.MediaScan.Times = newStats.MediaScan.Times;
else
{
oldStats.MediaScan.Times.LessThan10ms = newStats.MediaScan.Times.LessThan10ms;
oldStats.MediaScan.Times.LessThan150ms = newStats.MediaScan.Times.LessThan150ms;
oldStats.MediaScan.Times.LessThan3ms = newStats.MediaScan.Times.LessThan3ms;
oldStats.MediaScan.Times.LessThan500ms = newStats.MediaScan.Times.LessThan500ms;
oldStats.MediaScan.Times.LessThan50ms = newStats.MediaScan.Times.LessThan50ms;
oldStats.MediaScan.Times.MoreThan500ms = newStats.MediaScan.Times.MoreThan500ms;
}
}
if(newStats.Verify != null)
if(oldStats.Verify == null)
oldStats.Verify = newStats.Verify;
else
{
if(oldStats.Verify.Sectors == null) oldStats.Verify.Sectors = newStats.Verify.Sectors;
else
{
oldStats.Verify.Sectors.Correct = newStats.Verify.Sectors.Correct;
oldStats.Verify.Sectors.Error = newStats.Verify.Sectors.Error;
oldStats.Verify.Sectors.Total = newStats.Verify.Sectors.Total;
oldStats.Verify.Sectors.Unverifiable = newStats.Verify.Sectors.Unverifiable;
}
if(oldStats.Verify.MediaImages == null)
oldStats.Verify.MediaImages = newStats.Verify.MediaImages;
else
{
oldStats.Verify.MediaImages.Correct = newStats.Verify.MediaImages.Correct;
oldStats.Verify.MediaImages.Failed = newStats.Verify.MediaImages.Failed;
}
}
if(oldStats.Devices != null)
oldStats.Devices = oldStats.Devices.OrderBy(device => device.Manufacturer)
.ThenBy(device => device.Model).ThenBy(device => device.Revision)

View File

@@ -71,8 +71,6 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Min memory used is {0} bytes", results.MinMemory);
Core.Statistics.AddCommand("benchmark");
Core.Statistics.AddBenchmark(checksumTimes, results.EntropyTime, results.TotalTime, results.SeparateTime,
results.MaxMemory, results.MinMemory);
}
}
}

View File

@@ -109,9 +109,6 @@ namespace DiscImageChef.Commands
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");
dev.Close();

View File

@@ -106,27 +106,6 @@ namespace DiscImageChef.Commands
thereAreStats = true;
}
if(Core.Statistics.AllStats.Benchmark != null)
{
DicConsole.WriteLine("Benchmark statistics");
DicConsole.WriteLine("====================");
foreach(ChecksumStats chk in Core.Statistics.AllStats.Benchmark.Checksum)
DicConsole.WriteLine("Took {0} seconds to calculate {1} algorithm", chk.Value, chk.algorithm);
DicConsole.WriteLine("Took {0} seconds to calculate all algorithms sequentially",
Core.Statistics.AllStats.Benchmark.Sequential);
DicConsole.WriteLine("Took {0} seconds to calculate all algorithms at the same time",
Core.Statistics.AllStats.Benchmark.All);
DicConsole.WriteLine("Took {0} seconds to calculate entropy",
Core.Statistics.AllStats.Benchmark.Entropy);
DicConsole.WriteLine("Used a maximum of {0} bytes of memory",
Core.Statistics.AllStats.Benchmark.MaxMemory);
DicConsole.WriteLine("Used a minimum of {0} bytes of memory",
Core.Statistics.AllStats.Benchmark.MinMemory);
DicConsole.WriteLine();
thereAreStats = true;
}
if(Core.Statistics.AllStats.Filters != null && Core.Statistics.AllStats.Filters.Count > 0)
{
DicConsole.WriteLine("Filters statistics");
@@ -196,47 +175,6 @@ namespace DiscImageChef.Commands
thereAreStats = true;
}
if(Core.Statistics.AllStats.MediaScan != null)
{
DicConsole.WriteLine("Media scan statistics");
DicConsole.WriteLine("=====================");
DicConsole.WriteLine("Scanned a total of {0} sectors",
Core.Statistics.AllStats.MediaScan.Sectors.Total);
DicConsole.WriteLine("{0} of them correctly", Core.Statistics.AllStats.MediaScan.Sectors.Correct);
DicConsole.WriteLine("{0} of them had errors", Core.Statistics.AllStats.MediaScan.Sectors.Error);
DicConsole.WriteLine("{0} of them took less than 3 ms",
Core.Statistics.AllStats.MediaScan.Times.LessThan3ms);
DicConsole.WriteLine("{0} of them took less than 10 ms but more than 3 ms",
Core.Statistics.AllStats.MediaScan.Times.LessThan10ms);
DicConsole.WriteLine("{0} of them took less than 50 ms but more than 10 ms",
Core.Statistics.AllStats.MediaScan.Times.LessThan50ms);
DicConsole.WriteLine("{0} of them took less than 150 ms but more than 50 ms",
Core.Statistics.AllStats.MediaScan.Times.LessThan150ms);
DicConsole.WriteLine("{0} of them took less than 500 ms but more than 150 ms",
Core.Statistics.AllStats.MediaScan.Times.LessThan500ms);
DicConsole.WriteLine("{0} of them took less than more than 500 ms",
Core.Statistics.AllStats.MediaScan.Times.MoreThan500ms);
thereAreStats = true;
}
if(Core.Statistics.AllStats.Verify != null)
{
DicConsole.WriteLine("Verification statistics");
DicConsole.WriteLine("=======================");
DicConsole.WriteLine("{0} media images has been correctly verified",
Core.Statistics.AllStats.Verify.MediaImages.Correct);
DicConsole.WriteLine("{0} media images has been determined as containing errors",
Core.Statistics.AllStats.Verify.MediaImages.Failed);
DicConsole.WriteLine("{0} sectors has been verified", Core.Statistics.AllStats.Verify.Sectors.Total);
DicConsole.WriteLine("{0} sectors has been determined correct",
Core.Statistics.AllStats.Verify.Sectors.Correct);
DicConsole.WriteLine("{0} sectors has been determined to contain errors",
Core.Statistics.AllStats.Verify.Sectors.Error);
DicConsole.WriteLine("{0} sectors could not be determined as correct or not",
Core.Statistics.AllStats.Verify.Sectors.Unverifiable);
thereAreStats = true;
}
if(!thereAreStats) DicConsole.WriteLine("There are no statistics.");
}
}

View File

@@ -37,7 +37,6 @@ using DiscImageChef.CommonTypes.Interfaces;
using DiscImageChef.CommonTypes.Structs;
using DiscImageChef.Console;
using DiscImageChef.Core;
using DiscImageChef.Filters;
namespace DiscImageChef.Commands
{
@@ -245,7 +244,6 @@ namespace DiscImageChef.Commands
}
Core.Statistics.AddCommand("verify");
Core.Statistics.AddVerify(correctDisc, correctSectors, errorSectors, unknownSectors, totalSectors);
}
}
}