public FixedPortRecordingController(string host, int port, InstrumentationMap map, ILogger logger = null) { _host = host; _port = port; _map = map; _logger = logger ?? new ConsoleLogger(); }
private void SaveMapFile(InstrumentationMap map, string outputFilePath) { var serializer = new JsonSerializer() { NullValueHandling = NullValueHandling.Ignore }; using (var writer = new JsonTextWriter(new StreamWriter(outputFilePath))) serializer.Serialize(writer, map); }
private void Init(InstrumentationMap map, Guid uniqueId, int[][] hits) { if (map.UniqueId != uniqueId) { throw new Exception($"Hits file's unique id ({uniqueId}) does not match the unique id in the map file ({map.UniqueId})."); } Version = map.Version; UniqueId = uniqueId; Assemblies = map.Assemblies.Select(asm => ToAssemblyCoverage(asm, hits)).ToList().AsReadOnly(); }
public static CoverageResult CollectResultAndReset(string host, int port, InstrumentationMap map) { var fileName = GetTempFileName(); try { SaveHitsAndReset(host, port, fileName); return(new CoverageResult(map, fileName)); } finally { if (File.Exists(fileName)) { File.Delete(fileName); } } }
private IRecordingController CreateRecordingController(InstrumentationMap map) { if (Options.ControllerPortNumber > 0) { return(new FixedPortRecordingController( "localhost", Options.ControllerPortNumber, map, _logger)); } else { var dir = Options.RuntimeConfigOutputPath; if (string.IsNullOrEmpty(dir)) { dir = Options.RecorderAssemblyCopyPath; } var fullPath = Path.Combine(dir, Options.RuntimeConfigFileName); return(new DynamicPortRecordingController(fullPath, map, _logger)); } }
public DynamicPortRecordingController(string recorderRuntimeConfigFilePath, InstrumentationMap map, ILogger logger = null) { _recorderRuntimeConfigFilePath = recorderRuntimeConfigFilePath; _map = map; _logger = logger ?? new ConsoleLogger(); }
public static IRecordingController ForRuntimeConfigFile(string runtimeConfigFilePath, InstrumentationMap map, ILogger logger) { return(new DynamicPortRecordingController(runtimeConfigFilePath, map, logger)); }
public static IRecordingController ForEndPoint(string host, int port, InstrumentationMap map, ILogger logger) { return(new FixedPortRecordingController(host, port, map, logger)); }
private InstrumentationMap LoadMapFile(string mapFilePath) { ValidateFilePath(mapFilePath); return(InstrumentationMap.Parse(mapFilePath)); }
public CoverageResult(InstrumentationMap map, int[][] hits) { Init(map, map.UniqueId, hits); }
public CoverageResult(InstrumentationMap map, string hitsPath) { var(uniqueId, hits) = LoadHits(hitsPath); Init(map, uniqueId, hits); }