private void RunBenchmark(FlushMarkCore.Settings settings) { AddMessage("------------------------------"); AddMessage(string.Format("Path = {0}", settings.filePath)); AddMessage(string.Format("Test size = {0}", settings.testSize)); AddMessage(string.Format("Page size = {0}", settings.pageSize)); string testMode; if (settings.testMode == FlushMarkCore.FLUSHMARKCORE_TESTTYPE_RANDOM) testMode = "random"; else if (settings.testMode == FlushMarkCore.FLUSHMARKCORE_TESTTYPE_LINEAR) testMode = "linear"; else throw new Exception("Unknown test mode"); AddMessage(string.Format("Test mode = {0}", testMode)); AddMessage(string.Format("Flush frequency = {0}", settings.flushFrequency)); AddMessage("...preparing test file..."); Directory.CreateDirectory(Path.GetDirectoryName(settings.filePath)); string errorMessage; if (!FlushMarkCore.FlushMark_PrepareFile(ref settings, out errorMessage)) throw new Exception(errorMessage); string contigPath = LocateContigExe(); if (contigPath != null) { AddMessage("...contig.exe found - defragmenting test file..."); string str = RunContigExe(contigPath, settings.filePath); AddMessage(""); AddMessage(str); AddMessage(""); } AddMessage("...running test..."); FlushMarkCore.Result result; if (!FlushMarkCore.FlushMark_RunBenchmark(ref settings, out result, out errorMessage)) throw new Exception(errorMessage); double iops = (result.writtenPageCount * 1000.0) / result.elapsedMilliseconds; AddMessage(""); AddMessage(string.Format("IOPS = {0:0.00}", iops)); AddMessage(""); }
private bool GetSettings(out FlushMarkCore.Settings settings) { // Get test directory string drivePath = m_driveComboBox.Text; if (string.IsNullOrEmpty(drivePath)) { MessageBox.Show("No drive selected!?!"); settings = new FlushMarkCore.Settings(); return false; } settings = new FlushMarkCore.Settings(drivePath + "FlushMarkTestData" + Path.DirectorySeparatorChar + "test.dat"); // Get test size long testSize = GetTestSize(); if (testSize <= 0) { MessageBox.Show("No test size selected!?!"); return false; } settings.testSize = (ulong)testSize; // Get page size int pageSize = GetPageSize(); if (pageSize <= 0) { MessageBox.Show("No page size selected!?!"); return false; } settings.pageSize = (uint)pageSize; // Get test mode int testMode = GetTestMode(); if (testMode < 0) { MessageBox.Show("No test mode selected!?!"); return false; } settings.testMode = (uint)testMode; // Get flush frequency int flushFrequency = GetFlushFrequency(); if (flushFrequency < 0) { MessageBox.Show("No flush frequency selected!?!"); return false; } settings.flushFrequency = (uint)flushFrequency; return true; }