/// <summary> /// Test suite of 2 sequential, 2 random tests and mem copy /// </summary> /// <param name="drivePath">Drive name</param> /// <param name="fileSize">Test file size, default is 1Gb</param> /// <param name="writeBuffering">Faster writes through buffering</param> /// <param name="memCache">Faster reads through File Cache</param> /// <param name="filePath">Ignore drivepath, do not use auto file name generation and use absolute path to the file</param> /// <param name="freeMem">Delegate that gives info about free memory and used for mem cahche purging, /// e.g. under Android when .NET Standard doesn't have the faciclity to request free memory the info should go from caller /// </param> public BigTest(string drivePath, long fileSize = 1024 * 1024 * 1024, bool writeBuffering = false, MemCacheOptions memCache = MemCacheOptions.Disabled, string filePath = null, ICachePurger purger = null, string purgingFilePath = null, Func <long> freeMem = null, long totalMem = -1, WriteBufferFlusher flusher = null, bool mockFileStream = false, bool disableMacStream = false) { Func <bool> checkBreakCalled = () => breakCalled; this.flusher = flusher; file = new TestFile(drivePath, fileSize, writeBuffering, memCache != MemCacheOptions.Disabled, filePath, flusher?.Flush, mockFileStream, disableMacStream); // macOS and Windows mem cahce can be dissabled at OS level for specifc file handles, no such options found for Android/iOS this.fileSize = fileSize; AddTest(new SequentialWriteTest(file, bigBlockSize, true)); AddTest( new SequentialReadTest(file, bigBlockSize, memCache == MemCacheOptions.DisabledEmulation ? (purger == null ? new CachePurger(purgingFilePath, freeMem, checkBreakCalled) : purger) : null) ); AddTest(new RandomWriteTest(file, smallBlockSize, randomTestDuration)); AddTest( new RandomReadTest(file, smallBlockSize, randomTestDuration, memCache == MemCacheOptions.DisabledEmulation ? (purger == null ? new CachePurger(purgingFilePath, freeMem, checkBreakCalled) : purger) : null) ); SetUpRemainigCalculations(); var memBlocks = totalMem > 0 ? totalMem / bigBlockSize * 3 : 4096; AddTest(new MemCopyTest(bigBlockSize, memBlocks, freeMem)); }
public SequentialWriteTest(TestFile file, int blockSize, bool warmUp) : base(file.WriteStream, file, blockSize, file.TestAreaSizeBytes / blockSize, warmUp) { flushBuf = file.flushWrites; flush = file.flush; }
public RandomWriteTest(TestFile file, int blockSize, int testTimeSecs = 30) : base(file.WriteStream, file, blockSize, testTimeSecs) { flushBuf = file.flushWrites; flush = file.flush; fileSize = file.TestAreaSizeBytes; }
public SequentialReadTest(TestFile file, int blockSize, ICachePurger cachePurger = null) : base(file.ReadStream, file, blockSize, file.TestAreaSizeBytes / blockSize) { this.cachePurger = cachePurger; }