public static int RunSpeedTest(DiskSpeedTarget target, DiskSpeedParameter parameter, out string xml) { // https://github.com/microsoft/diskspd/wiki/Command-line-and-parameters string commands = $"-z -Zr -w{parameter.WriteRatio} -b{parameter.BlockSize} -F{parameter.ThreadCount} -o{parameter.OutstandingOperations} -W{parameter.WarmupTime} -d{parameter.TestTime} -r -Rxml"; // Disable remote caching on file shares if (target.FileName.StartsWith(@"\\", StringComparison.InvariantCulture)) { commands += " -Srw"; } // E.g. // diskspd -z -Zr -w50 -b512K -F2 -r -o8 -W60 -d120 -Srw -Rtext \\storage\testcache\testfile64g.dat > d:\diskspd_unraid_cache.txt return(ExecDiskSpd($"{commands} {target.FileName}", out xml)); }
public void AddFailedResult(DiskSpeedTarget testTarget, DiskSpeedParameter testParameter) { if (testTarget == null) { throw new ArgumentNullException(nameof(testTarget)); } if (testParameter == null) { throw new ArgumentNullException(nameof(testParameter)); } // Add a result line string result = $"{DateTime.UtcNow:s},\"{testTarget.FileName}\",{testTarget.FileSize},{testParameter.BlockSizeString}" + $",{testParameter.WriteRatioString},{testParameter.ThreadCount},{testParameter.OutstandingOperations}" + $",{testParameter.WarmupTime},0,0,0"; File.AppendAllText(FileName, result + Environment.NewLine); }
public static bool RunTest(DiskSpeedTarget testTarget, DiskSpeedParameter testParameter, out DiskSpeedResult testResult) { if (testTarget == null) { throw new ArgumentNullException(nameof(testTarget)); } if (testParameter == null) { throw new ArgumentNullException(nameof(testParameter)); } testResult = new DiskSpeedResult(); if (DiskSpeedTool.RunSpeedTest(testTarget, testParameter, out string xml) != 0) { return(false); } // Parse results testResult.FromXml(xml); return(true); }
public static int CreateTestTarget(DiskSpeedTarget target) { // E.g. // diskspd.exe -c64G \\storage\testcache\testfile64g.dat return(ExecDiskSpd($"-c{target.FileSize} {target.FileName}", out string _)); }