public static void main(String[] args) { Console.WriteLine("Welcome to LoopTesterApp, C# edition"); Console.WriteLine("Constructing App..."); LoopTesterApp app = new LoopTesterApp(); app.getMem(); Console.WriteLine("Constructing Simple CFG..."); app.cfg.createNode(0); app.buildBaseLoop(0); app.cfg.createNode(1); new BasicBlockEdge(app.cfg, 0, 2); Console.WriteLine("15000 dummy loops"); for (int dummyloop = 0; dummyloop < 15000; dummyloop++) { HavlakLoopFinder finder = new HavlakLoopFinder(app.cfg, app.lsg); finder.findLoops(); } Console.WriteLine("Constructing CFG..."); int n = 2; for (int parlooptrees = 0; parlooptrees < 10; parlooptrees++) { app.cfg.createNode(n + 1); app.buildConnect(2, n + 1); n = n + 1; for (int i = 0; i < 100; i++) { int top = n; n = app.buildStraight(n, 1); for (int j = 0; j < 25; j++) { n = app.buildBaseLoop(n); } int bottom = app.buildStraight(n, 1); app.buildConnect(n, top); n = bottom; } app.buildConnect(n, 1); } app.getMem(); Console.Write("Performing Loop Recognition\n1 Iteration\n"); HavlakLoopFinder finder1 = new HavlakLoopFinder(app.cfg, app.lsg); finder1.findLoops(); app.getMem(); Console.WriteLine("Another 50 iterations..."); for (int i = 0; i < 50; i++) { Console.Write("."); HavlakLoopFinder finder2 = new HavlakLoopFinder(app.cfg, new LSG()); finder2.findLoops(); } Console.WriteLine(""); app.getMem(); Console.WriteLine("# of loops: " + app.lsg.getNumLoops() + " (including 1 artificial root node)"); Console.WriteLine("# of BBs : " + BasicBlock.getNumBasicBlocks()); Console.WriteLine("# max time: " + finder1.getMaxMillis()); Console.WriteLine("# min time: " + finder1.getMinMillis()); app.lsg.calculateNestingLevel(); //app.lsg.Dump(); }