private static void SimulateActual(PipExecutionData data, int actualConcurrency, MultiWriter writers) { // simulate with actual concurrency Console.WriteLine("Simulating actual build"); SimulationResult actualSimulation = new SimulationResult(data, data.AggregateCosts); actualSimulation.Simulate(actualConcurrency); Console.WriteLine("Done"); Console.WriteLine(); WriteActualAndSimulationResults(data, actualSimulation); writers.WriteLine("Edge Count: {0}", data.DataflowGraph.EdgeCount); writers.WriteLine("Pip Type Counts:"); foreach (var pipType in EnumTraits <PipType> .EnumerateValues()) { writers.WriteLine("{0}: {1}", data.PipTypeCounts[(int)pipType].ToString().PadLeft(10), pipType); } writers.WriteLine("Processes with timing information:{0} ", data.DataflowGraph.Nodes.Where(node => data.GetPipType(node) == PipType.Process && data.StartTimes[node] != 0).Count()); writers.WriteLine("Actual Total Build Time: {0} min", data.TotalDuration.ToMinutes()); writers.WriteLine("Actual Concurrency: {0}", data.ActualConcurrency); writers.WriteLine("Simulated total build time (using actual concurrency): {0} min", actualSimulation.TotalTime.ToMinutes()); // write down info for each critical path ulong criticalPathCost = WriteCriticalPathToResult(writers, data, actualSimulation); }
private static SimulationResult[] SimulateBuildWithVaryingThreatCount(PipExecutionData data, int simulationCount, int increment) { SimulationResult[] results = new SimulationResult[simulationCount]; int?[] threadCounts = new int?[simulationCount]; Parallel.For(0, simulationCount, i => { var threadCount = threadCounts[i] ?? ((i + 1) * increment); Console.WriteLine("Simulating {0}...", i); SimulationResult result = new SimulationResult(data, data.AggregateCosts); result.Simulate(threadCount); results[i] = result; Console.WriteLine("Done {0}", i); }); return(results); }