public void Check(IndexMapper map, uint address) { if (FirstRedirectOffset != map.FirstIndirectOffset) { throw new Exception(); } if (SecondRedirectOffset != map.SecondIndirectOffset) { throw new Exception(); } if (ThirdRedirectOffset != map.ThirdIndirectOffset) { throw new Exception(); } if (BaseVirtualAddressIndexValue != map.BaseVirtualAddressIndexValue) { throw new Exception(); } if (address != map.BaseVirtualAddressIndexValue) { throw new Exception(); } Increment(); }
public static void TestMethod1() { MemoryPoolTest.TestMemoryLeak(); int blockSize = 128; IndexMapper map = new IndexMapper(blockSize); CheckValues check = new CheckValues(blockSize); uint lastAddress = (uint)Math.Min(uint.MaxValue, (long)check.BlocksPerPage * (long)check.BlocksPerPage * (long)check.BlocksPerPage * (long)check.BlocksPerPage - 1); //this line is to shortcut so the test is less comprehensive. for (uint x = 0; x <= lastAddress; x++) { map.MapPosition(x); check.Check(map, x); } MemoryPoolTest.TestMemoryLeak(); }
/// <summary> /// Initializes a new instance of the <see cref="AsyncServerClient"/> class. /// </summary> /// <param name="url">The URL.</param> /// <param name="convention">The convention.</param> /// <param name="credentials">The credentials.</param> public AsyncServerClient(string url, DocumentConvention convention, ICredentials credentials) { Guard.Assert(() => !string.IsNullOrEmpty(url)); Guard.Assert(() => convention != null); WebRequest.RegisterPrefix("http://", WebRequestCreator.ClientHttp); DatabaseAddress = new Uri(url); Convention = convention; Credentials = credentials; ContextStorage = new Dictionary<HttpJsonRequest, SynchronizationContext>(); DocumentMapper = new DocumentMapper(); IndexMapper = new IndexMapper(Convention); AttachmentMapper = new AttachmentMapper(); StatisticsMapper = new StatisticsMapper(); QueryResultMapper = new QueryResultMapper(); }
public void Benchmark(uint page, string text) { Stopwatch sw = new Stopwatch(); IndexMapper map = new IndexMapper((int)BlockSize); System.Console.WriteLine(text + StepTimer.Time(10, () => { map.MapPosition(page); map.MapPosition(page); map.MapPosition(page); map.MapPosition(page); map.MapPosition(page); map.MapPosition(page); map.MapPosition(page); map.MapPosition(page); map.MapPosition(page); map.MapPosition(page); })); }
public void Check(IndexMapper map, uint address) { if (FirstRedirectOffset != map.FirstIndirectOffset) throw new Exception(); if (SecondRedirectOffset != map.SecondIndirectOffset) throw new Exception(); if (ThirdRedirectOffset != map.ThirdIndirectOffset) throw new Exception(); if (BaseVirtualAddressIndexValue != map.BaseVirtualAddressIndexValue) throw new Exception(); if (address != map.BaseVirtualAddressIndexValue) throw new Exception(); Increment(); }