public void TestInnerEdgePerformance() { foreach (int i in new int[] { 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100 }) { long totalTicks = 0; long innerTicks = 0; int nSeeds = 25; DateTime dt; Random seedGenerator = new Random(40419); for (int seed = 0; seed < nSeeds; seed++) { m_random = new Random(seedGenerator.Next()); Edge randomInnerEdge; Edge root = CreateGraph(i, "Foo", out randomInnerEdge); MyDAGCycleChecker mdcc = new MyDAGCycleChecker(root); dt = DateTime.Now; mdcc.Check(false); totalTicks += ((TimeSpan)(DateTime.Now - dt)).Ticks; dt = DateTime.Now; mdcc.Check(false, randomInnerEdge.PreVertex); innerTicks += ((TimeSpan)(DateTime.Now - dt)).Ticks; } TimeSpan avgWholeTime = TimeSpan.FromTicks(totalTicks / nSeeds); TimeSpan avgInnerTime = TimeSpan.FromTicks(innerTicks / nSeeds); double improvement = avgInnerTime.TotalSeconds / avgWholeTime.TotalSeconds; Console.WriteLine(i.ToString() + "," + avgWholeTime.TotalSeconds + "," + avgInnerTime.TotalSeconds + "," + improvement); } }
public void TestValidationWithImpliedRelationships() { DateTime start; m_random = new Random(40419); start = DateTime.Now; Edge root = CreateGraph(500, "Foo"); Console.WriteLine("Creating the graph took " + (DateTime.Now - start)); MyDAGCycleChecker mdcc = new MyDAGCycleChecker(root); //Console.WriteLine(Highpoint.Sage.Diagnostics.DiagnosticAids.GraphToString(root)); start = DateTime.Now; mdcc.Check(false); Console.WriteLine("Checking took " + (DateTime.Now - start)); Console.WriteLine("There are " + mdcc.Errors.Count + " errors."); foreach (IModelError err in mdcc.Errors) { Console.WriteLine(err.ToString()); } mdcc.EnableLoopback = true; mdcc.Check(false); Console.WriteLine("There are " + mdcc.Errors.Count + " errors."); foreach (IModelError err in mdcc.Errors) { Console.WriteLine(err.ToString()); } //if ( ag != null ) ag.AssertEquals("Freshly initialized model, (config = ) is not valid.", true, t.ValidityState); }
public void TestValidationPerformance() { foreach (int i in new int[] { 5, 10, 20, 50, 100, 200 /*,500,1000*/ }) { long totalTicks = 0; int nSeeds = 50; Random seedGenerator = new Random(40419); for (int seed = 0; seed < nSeeds; seed++) { m_random = new Random(seedGenerator.Next()); Edge root = CreateGraph(i, "Foo"); MyDAGCycleChecker mdcc = new MyDAGCycleChecker(root); //Console.WriteLine(Highpoint.Sage.Diagnostics.DiagnosticAids.GraphToString(root)); DateTime dt = DateTime.Now; mdcc.Check(false); totalTicks += ((TimeSpan)(DateTime.Now - dt)).Ticks; //Console.WriteLine(i.ToString() + "," + ((TimeSpan)(DateTime .Now - dt)).TotalSeconds); //Console.WriteLine("There are " + mdcc.Errors.Count + " errors."); //foreach ( IModelError err in mdcc.Errors ) Console.WriteLine(err.ToString()); //mdcc.EnableLoopback = true; //mdcc.Check(false); //Console.WriteLine("There are " + mdcc.Errors.Count + " errors."); //foreach ( IModelError err in mdcc.Errors ) Console.WriteLine(err.ToString()); //if ( ag != null ) ag.AssertEquals("Freshly initialized model, (config = ) is not valid.", true, t.ValidityState); } Console.WriteLine(i.ToString() + "," + (TimeSpan.FromTicks(totalTicks / nSeeds)).TotalSeconds); } }