/// <exception cref="System.Exception"/> public virtual void TestCopyFileUnbuffered() { string MethodName = GenericTestUtils.GetMethodName(); FilePath srcFile = new FilePath(TestDir, MethodName + ".src.dat"); FilePath dstFile = new FilePath(TestDir, MethodName + ".dst.dat"); int fileSize = unchecked ((int)(0x8000000)); // 128 MB int Seed = unchecked ((int)(0xBEEF)); int batchSize = 4096; int numBatches = fileSize / batchSize; Random rb = new Random(Seed); FileChannel channel = null; RandomAccessFile raSrcFile = null; try { raSrcFile = new RandomAccessFile(srcFile, "rw"); channel = raSrcFile.GetChannel(); byte[] bytesToWrite = new byte[batchSize]; MappedByteBuffer mapBuf; mapBuf = channel.Map(FileChannel.MapMode.ReadWrite, 0, fileSize); for (int i = 0; i < numBatches; i++) { rb.NextBytes(bytesToWrite); mapBuf.Put(bytesToWrite); } NativeIO.CopyFileUnbuffered(srcFile, dstFile); Assert.Equal(srcFile.Length(), dstFile.Length()); } finally { IOUtils.Cleanup(Log, channel); IOUtils.Cleanup(Log, raSrcFile); FileUtils.DeleteQuietly(TestDir); } }
public virtual bool VerifyCanMlock() { return(NativeIO.IsAvailable()); }
public virtual long GetOperatingSystemPageSize() { return(NativeIO.GetOperatingSystemPageSize()); }
public virtual long GetMemlockLimit() { return(NativeIO.GetMemlockLimit()); }
/// <exception cref="System.Exception"/> public virtual void TestGetMemlockLimit() { Assume.AssumeTrue(NativeIO.IsAvailable()); NativeIO.GetMemlockLimit(); }