public void SetUp() { taskContext = new JoinableTaskContext(); mockMemoryMappedFileFactory = Substitute.For <MemoryMappedFileFactory>(); transportSessionFactory = new LldbTransportSession.Factory(mockMemoryMappedFileFactory); mockManagedProcessFactory = Substitute.For <ManagedProcess.Factory>(); mockGrpcCallInvoker = Substitute.ForPartsOf <PipeCallInvoker>(_numGrpcPipePairs); mockGrpcCallInvokerFactory = Substitute.For <PipeCallInvokerFactory>(); mockGrpcCallInvokerFactory.Create().Returns(mockGrpcCallInvoker); mockGrpcConnectionFactory = Substitute.For <GrpcConnectionFactory>(); optionPageGrid = Substitute.For <IExtensionOptions>(); service = new YetiVSIService(optionPageGrid); var mockVsOutputWindow = Substitute.For <IVsOutputWindow>(); mockDialogUtil = Substitute.For <IDialogUtil>(); yetiDebugTransport = new YetiDebugTransport(taskContext, transportSessionFactory, mockGrpcCallInvokerFactory, mockGrpcConnectionFactory, onAsyncRpcCompleted: null, managedProcessFactory: mockManagedProcessFactory, dialogUtil: mockDialogUtil, vsOutputWindow: mockVsOutputWindow, yetiVSIService: service); abortError = null; yetiDebugTransport.OnStop += e => { abortError = e; }; }
/// <summary> /// Creates a new memory mapped file dynamic graph. /// </summary> /// <param name="estimatedSize"></param> /// <param name="factory"></param> public MemoryMappedGraph(long estimatedSize, MemoryMappedFileFactory factory) : this(estimatedSize, new MemoryMappedHugeArray <GeoCoordinateSimple>(factory, estimatedSize), new MemoryMappedHugeArray <uint>(factory, estimatedSize), new MemoryMappedHugeArray <uint>(factory, estimatedSize), new MemoryMappedHugeArray <TEdgeData>(factory, estimatedSize), new HugeCoordinateCollectionIndex(factory, estimatedSize)) { }
public void Setup() { mockMemoryMappedFileFactory = Substitute.For <MemoryMappedFileFactory>(); mockMemoryMappedFile = Substitute.For <IMemoryMappedFile>(); // The first session should get a memory mapped file on the first try. mockMemoryMappedFileFactory.CreateNew(FILE_PREFIX + 0, Arg.Any <long>()).Returns( mockMemoryMappedFile); transportSessionFactory = new LldbTransportSession.Factory(mockMemoryMappedFileFactory); transportSession = transportSessionFactory.Create(); }
public OperatingSystemFacade() { Assembly = new AssemblyFacade(); Dialog = new DialogFacade(); Environment = new Environment(); File = new FileFacade(); MemoryMappedFiles = new MemoryMappedFileFactory(); ProcessLocator = new ProcessLocator(); ProcessStarter = new ProcessStarter(); Registry = new Registry(); }
public OperatingSystemFacade() { Assembly = new AssemblyFacade(); Dialog = new DialogFacade(); Directory = new DirectoryFacade(); Environment = new Environment(); File = new FileFacade(); MemoryMappedFiles = new MemoryMappedFileFactory(); ProcessLocator = new ProcessLocator(); ProcessStarter = new ProcessStarter(); Registry = new Registry(); }
/// <summary> /// Creates a new huge coordinate index. /// </summary> /// <param name="factory"></param> /// <param name="size"></param> public HugeCoordinateCollectionIndex(MemoryMappedFileFactory factory, long size) { _index = new MemoryMappedHugeArray <ulong>(factory, size); _coordinates = new MemoryMappedHugeArray <float>(factory, size * 2 * ESTIMATED_SIZE); for (long idx = 0; idx < _index.Length; idx++) { _index[idx] = 0; } for (long idx = 0; idx < _coordinates.Length; idx++) { _coordinates[idx] = float.MinValue; } }
/// <summary> /// Creates a memory mapped huge array. /// </summary> /// <param name="factory">The factory to create the memory mapped files.</param> /// <param name="size">The size of the array.</param> /// <param name="arraySize">The size of an indivdual array block.</param> public MemoryMappedHugeArray(MemoryMappedFileFactory factory, long size, long arraySize) { _factory = factory; _length = size; _fileElementSize = arraySize; _elementSize = NativeMemoryMappedFileFactory.GetSize(typeof(T)); _fileSizeBytes = arraySize * _elementSize; var arrayCount = (int)System.Math.Ceiling((double)size / _fileElementSize); _files = new List <IMemoryMappedFile>(arrayCount); _accessors = new List <IMemoryMappedViewAccessor>(arrayCount); for (int arrayIdx = 0; arrayIdx < arrayCount; arrayIdx++) { var file = _factory.New(_fileSizeBytes); _files.Add(file); _accessors.Add(file.CreateViewAccessor(0, _fileSizeBytes)); } }
/// <summary> /// Creates a memory mapped huge array. /// </summary> /// <param name="factory">The factory to create the memory mapped files.</param> /// <param name="size">The size of the array.</param> public MemoryMappedHugeArray(MemoryMappedFileFactory factory, long size) : this(factory, size, DefaultFileElementSize) { }
/// <summary> /// Creates a new huge coordinate index. /// </summary> /// <param name="factory"></param> /// <param name="size"></param> public HugeCoordinateIndex(MemoryMappedFileFactory factory, long size) : this(new MemoryMappedHugeArray <float>(factory, size * 2)) { }
private LldbTransportSession(MemoryMappedFileFactory memoryMappedFileFactory) { this.memoryMappedFileFactory = memoryMappedFileFactory; sessionId = FindAvailableSessionId(); }
public Factory(MemoryMappedFileFactory memoryMappedFileFactory) { this.memoryMappedFileFactory = memoryMappedFileFactory; }
/// <summary> /// Tests preprocessing data from a PBF file. /// </summary> /// <param name="name"></param> /// <param name="pbfFile"></param> public static void TestSerialization(string name, string pbfFile) { var testFile = new FileInfo(string.Format(@".\TestFiles\{0}", pbfFile)); var performanceInfo = new PerformanceInfoConsumer("LiveSerializerFlatFile.Serialize", 100000); performanceInfo.Start(); performanceInfo.Report("Pulling from {0}...", testFile.Name); var stream = testFile.OpenRead(); var source = new PBFOsmStreamSource(stream); var progress = new OsmStreamFilterProgress(); progress.RegisterSource(source); var testOutputFile = new FileInfo(@"test.routing"); testOutputFile.Delete(); Stream writeStream = testOutputFile.OpenWrite(); var tagsIndex = new TagsTableCollectionIndex(); var interpreter = new OsmRoutingInterpreter(); var graph = new DynamicGraphRouterDataSource <LiveEdge>(tagsIndex); var routingSerializer = new LiveEdgeFlatfileSerializer(); // read from the OSM-stream. using (var fileFactory = new MemoryMappedFileFactory(@"d:\temp\")) { using (var memoryMappedGraph = new MemoryMappedGraph <LiveEdge>(10000, fileFactory)) { using (var coordinates = new HugeCoordinateIndex(fileFactory, 10000)) { var memoryData = new DynamicGraphRouterDataSource <LiveEdge>(memoryMappedGraph, tagsIndex); var targetData = new LiveGraphOsmStreamTarget(memoryData, new OsmRoutingInterpreter(), tagsIndex, coordinates); targetData.RegisterSource(progress); targetData.Pull(); performanceInfo.Stop(); performanceInfo = new PerformanceInfoConsumer("LiveSerializerFlatFile.Serialize", 100000); performanceInfo.Start(); performanceInfo.Report("Writing file for {0}...", testFile.Name); var metaData = new TagsCollection(); metaData.Add("some_key", "some_value"); routingSerializer.Serialize(writeStream, memoryData, metaData); } } } stream.Dispose(); writeStream.Dispose(); OsmSharp.Logging.Log.TraceEvent("LiveSerializerFlatFile", OsmSharp.Logging.TraceEventType.Information, string.Format("Serialized file: {0}KB", testOutputFile.Length / 1024)); performanceInfo.Stop(); performanceInfo = new PerformanceInfoConsumer("LiveSerializerFlatFile.Serialize", 100000); performanceInfo.Start(); performanceInfo.Report("Reading file for {0}...", testFile.Name); var testInputFile = new FileInfo(@"europe-latest.osm.pbf.routing"); Stream readStream = testInputFile.OpenRead(); var deserializedGraph = routingSerializer.Deserialize(readStream, false); readStream.Dispose(); OsmSharp.Logging.Log.TraceEvent("LiveSerializerFlatFile", OsmSharp.Logging.TraceEventType.Information, string.Format("Read: {0}KB", testInputFile.Length / 1024)); OsmSharp.Logging.Log.TraceEvent("LiveSerializerFlatFile", Logging.TraceEventType.Information, deserializedGraph.ToInvariantString()); performanceInfo.Stop(); }