예제 #1
0
        private static void RunReplayManager(ReplayManager replayManager, int nbrRepeats, string outputFile)
        {
            replayManager.Run(nbrRepeats);
            Console.WriteLine("----------");
            for (int i = 0; i < replayManager.RunTimeMillis.Count; i++)
            {
                Console.WriteLine("#" + (i + 1) + ": " + "respond time = " + replayManager.RunTimeMillis[i]
                                  + " average memory = " + replayManager.MemReaders[i].GetAverage());
            }
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("Starting Memory (MB): " +
                          replayManager.StartMemReader.RecordMemoryUsage());
            sb.AppendLine("Run, Reponse Time (ms), Average Memory (MB), Min Memory (MB), Max Memory (MB)");
            for (int i = 0; i < replayManager.RunTimeMillis.Count; i++)
            {
                sb.Append((i + 1));
                sb.Append(",");
                sb.Append(replayManager.RunTimeMillis[i]);
                sb.Append(",");
                sb.Append(replayManager.MemReaders[i].GetAverage());
                sb.Append(",");
                sb.Append(replayManager.MemReaders[i].GetMin());
                sb.Append(",");
                sb.Append(replayManager.MemReaders[i].GetMax());
                sb.AppendLine();
            }
            File.WriteAllText(outputFile, sb.ToString());
            Console.WriteLine("Output saved to " + outputFile);
        }
예제 #2
0
        static void Main(string[] args)
        {
            //Read command arguments
            ProgramArguments arguments = ProgramArguments.ReadFromFile(args[0]);

            GUIDataMonitor monitor       = new GUIDataMonitor();
            ReplayManager  replayManager = new ReplayManager(arguments, monitor);

            var task = Task.Run(() => RunReplayManager(replayManager, arguments.NbrRepeats, arguments.OutputFile));

            Thread guiThread = new Thread(() => DisplayGUI(monitor));

            guiThread.SetApartmentState(ApartmentState.STA);
            guiThread.Start();

            task.Wait();
            guiThread.Join();

            Console.WriteLine();
            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }