Пример #1
0
        public void TestRun()
        {
            var main = new FeedSimMain(100, 50, 5, false, "FeedSimMain");

            main.Run();
        }
Пример #2
0
        public static void Main(String[] args)
        {
            LoggerNLog.BasicConfig();
            LoggerNLog.Register();

            if (args.Length < 3)
            {
                Console.WriteLine(
                    "Arguments are: <number of threads> <drop probability percent> <number of seconds to run>");
                Console.WriteLine("  number of threads: the number of threads sending feed events into the engine");
                Console.WriteLine("  drop probability percent: a number between zero and 100 that dictates the ");
                Console.WriteLine("                            probability that per second one of the feeds drops off");
                Console.WriteLine("  number of seconds: the number of seconds the simulation runs");
                Environment.Exit(-1);
            }

            int numberOfThreads;

            try
            {
                numberOfThreads = Int32.Parse(args[0]);
            }
            catch (ArgumentException)
            {
                Console.WriteLine("Invalid number of threads: " + args[0]);
                Environment.Exit(-2);
                return;
            }

            double dropProbability;

            try
            {
                dropProbability = Double.Parse(args[1]);
            }
            catch (ArgumentException)
            {
                Console.WriteLine("Invalid drop probability:" + args[1]);
                Environment.Exit(-2);
                return;
            }

            int numberOfSeconds;

            try
            {
                numberOfSeconds = Int32.Parse(args[2]);
            }
            catch (ArgumentException)
            {
                Console.WriteLine("Invalid number of seconds to run:" + args[2]);
                Environment.Exit(-2);
                return;
            }

            // Run the sample
            Console.WriteLine("Using " + numberOfThreads + " threads with a drop probability of " + dropProbability +
                              "%, for " + numberOfSeconds + " seconds");
            var feedSimMain = new FeedSimMain(numberOfThreads, dropProbability, numberOfSeconds, true, "FeedSimMain");

            feedSimMain.Run();
        }