private static void Benchmark()
        {
            Console.Clear();
            Console.Write("How many active torrents will be simulated: ");
            int torrents = GetInt();

            Console.Write("How many active peers per torrent: ");
            int peers = GetInt();

            Console.Write("How many requests per second: ");
            int requests = GetInt();

            Console.Write("What is the tracker address: ");
            string address = Console.ReadLine();

            StressTest test = new StressTest(torrents, peers, requests);

            test.Start(address);

            while (true)
            {
                Console.WriteLine("Measured announces/sec:  {0}", test.RequestRate);
                Console.WriteLine("Total announces: {0}", test.TotalTrackerRequests);
                Console.WriteLine(Environment.NewLine);
                System.Threading.Thread.Sleep(1000);
            }
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            int n = 50 * 1000 * 1000;

            Console.Clear();
            Console.WriteLine("xOPS CPU Benchmark");

            Run(c, n, 1, inops: false, precision64Bit: false);
            Run(c, n, 1, inops: true, precision64Bit: false);
            //Run(c, n, 1, inops: false, precision64Bit: true);
            //Run(c, n, 1, inops: true, precision64Bit: true);

            int tpT, tpP;

            ThreadPool.GetMaxThreads(out tpT, out tpP);
            Console.WriteLine("\nCores: " + Environment.ProcessorCount + "; timer freq: " + Stopwatch.Frequency);

            var threads = Environment.ProcessorCount * 2;

            Run(c, n, threads, inops: false, precision64Bit: false);
            Run(c, n, threads, inops: true, precision64Bit: false);
            //Run(c, n, threads, inops: false, precision64Bit: true, useTasks: false);
            //Run(c, n, threads, inops: true, precision64Bit: true, useTasks: false);


            Console.WriteLine("\nWARNING! Stress Test may lead to CPU overheating and damages. \n" +
                              "If you're not sure of your hardware - DO NOT PROCEED!\n" +
                              "Press 'S' to start a Stress test, any other key to Quit");
            var key = Console.ReadKey();

            if (key.Key == ConsoleKey.S)
            {
                Console.WriteLine("\nStress testing on {0} threads... Press any key to stop\n", Environment.ProcessorCount * 2);

                Console.WriteLine("Duration:  (Warming up)");
                Console.WriteLine("Start:");
                Console.WriteLine("Min:");
                Console.WriteLine("Max:");
                Console.WriteLine("Now:");

                stressTestLinesCursorTopDiff = 5;

                stressTestEnd = new ManualResetEventSlim(false);

                var stressTest = new StressTest(1000, 3, 3, Environment.ProcessorCount);
                stressTest.ResultsUpdated += StressTestUpdate;
                stressTest.Start();

                stressTestEnd.Wait();

                Console.WriteLine("\n Stress test ended");
            }
        }
Beispiel #3
0
        private void PrepareComponents()
        {
            //core components, endabled by default
            InstalledComponents.Add(Inventory = new Inventory {
                Client = this, Enabled = true
            });
            InstalledComponents.Add(PlayerAttributes = new PlayerAttributes {
                Client = this, Enabled = true
            });
            InstalledComponents.Add(Magic = new Magic {
                Client = this, Enabled = true
            });
            InstalledComponents.Add(GameEquipment = new GameEquipment {
                Client = this, Enabled = true
            });
            InstalledComponents.Add(Activebar = new Activebar {
                Client = this, Enabled = true
            });
            InstalledComponents.Add(TargetFinder = new TargetFinder {
                Client = this, Enabled = true
            });

            //disabled by default components
            InstalledComponents.Add(StressTest = new StressTest {
                Client = this, Enabled = false
            });

            //mandatory components
            FieldMap         = new Map();
            FieldMap.Enabled = true;
            FieldMap.Client  = this;
            FieldMap.Init(0, 0, 0);
            InstalledComponents.Add(Map = FieldMap);

            //init state machine.
            StateMachine         = new GameStateEngine(this);
            StateMachine.Client  = this;
            StateMachine.Enabled = true;

            InstalledComponents.Add(GameStateEngine = StateMachine);

            LoadStates("BotCore.dll");

            callback = value => { };
        }
        public static int Main(string[] args)
        {
            int  pa     = 0;
            bool attach = false;

            if (args [pa] == "-a")
            {
                attach = true;
                pa++;
            }
            if (pa >= args.Length)
            {
                Console.WriteLine("Test name not provided");
                return(1);
            }

            string testName = args[pa];

            Type testType = typeof(MainClass).Assembly.GetTypes().FirstOrDefault(t => t.FullName == testName);

            if (testType == null)
            {
                testType = typeof(MainClass).Assembly.GetTypes().FirstOrDefault(t => t.Name == testName);
            }

            if (testType == null)
            {
                Console.WriteLine("Test not found: " + args[0]);
                return(1);
            }

            StressTest test = (StressTest)Activator.CreateInstance(testType);
            TestPlan   plan = new TestPlan();

            plan.Repeat = 1;
            pa++;

            if (pa < args.Length)
            {
                int rep;
                if (int.TryParse(args[pa], out rep))
                {
                    plan.Repeat = rep;
                    pa++;
                }
            }

            while (pa < args.Length)
            {
                string arg   = args [pa];
                int    i     = arg.IndexOf('*');
                string tname = arg.Substring(0, i);
                string it    = arg.Substring(i + 1);
                int    nit;
                if (!int.TryParse(it, out nit))
                {
                    Console.WriteLine("Invalid number of iterations: " + it);
                    return(1);
                }
                if (tname.Length == 0)
                {
                    plan.Iterations = nit;
                }
                else
                {
                    if (!test.HasTest(tname))
                    {
                        Console.Write("Unknown test: " + tname);
                        return(1);
                    }
                    plan.SetIterationsForTest(tname, nit);
                }
                pa++;
            }

            AutoTestClientSession session = new AutoTestClientSession();

            Console.CancelKeyPress += delegate
            {
                Console.WriteLine("Test session cancelled");
                session.Stop();
            };
            try
            {
                if (attach)
                {
                    session.AttachApplication();
                }
                else
                {
                    string app = typeof(AutoTestClientSession).Assembly.Location;
                    app = Path.Combine(Path.GetDirectoryName(app), "MonoDevelop.exe");
                    session.StartApplication(app, "");
                    Console.WriteLine("Connected");
                    session.WaitForEvent("MonoDevelop.Ide.IdeInitialized");
                }
                Console.WriteLine("Initialized");
                TestService.Session = session;

                test.Run(plan);
            }
            finally
            {
                if (!attach)
                {
                    Console.WriteLine("Press Enter to stop the test process");
                    Console.ReadLine();
                }
                session.Stop();
            }
            return(0);
        }
Beispiel #5
0
    public void LoadStressTest()
    {
        new Config().Save();

        StressTest.Run(() => _ = Config.Load());
    }