示例#1
0
        public static void Main(string[] args)
        {
            Debug.Listeners.Add(new TextWriterTraceListener(Console.Out));
            GatorShare.Logger.LoadConfig("l4n.trackerapp.config");
            GatorShare.Configuration.FushareConfigHandler.Read("fushare.config");

            Console.WriteLine("Welcome to the MonoTorrent tracker");
            Console.WriteLine("1. Start the tracker");
            Console.WriteLine("2. Start a benchmark");

            Console.Write("Choice: ");
            int val = 0;

            while (true)
            {
                if (int.TryParse(Console.ReadLine(), out val))
                {
                    if (val == 1 || val == 2)
                    {
                        break;
                    }
                }
            }

            if (val == 1)
            {
                Debug.WriteLine("starting FrontendEngine");
                new MySimpleTracker();
            }
            else
            {
                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();

                StressTest test = new StressTest();
                test.Initialise(torrents, peers, requests);
                test.StartThreadedStress();

                while (true)
                {
                    Console.WriteLine("Measured announces/sec:  {0:0.00}", test.RequestRate);
                    Console.WriteLine("Total Annoucne Requests: {0:0.00}", test.TotalTrackerRequests);
                    Console.WriteLine("Actual announces/sec:    {0:0.00}", test.TotalRequests);
                    Console.WriteLine(Environment.NewLine);
                    test.TotalRequests = 0;
                    System.Threading.Thread.Sleep(1000);
                }
            }
        }
示例#2
0
文件: Main.cs 项目: stojy/monotorrent
        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);
            }
        }
示例#3
0
        public static void Main(string[] args)
        {
            Debug.Listeners.Add(new TextWriterTraceListener(Console.Out));
              GatorShare.Logger.LoadConfig("l4n.trackerapp.config");
              GatorShare.Configuration.FushareConfigHandler.Read("fushare.config");

              Console.WriteLine("Welcome to the MonoTorrent tracker");
              Console.WriteLine("1. Start the tracker");
              Console.WriteLine("2. Start a benchmark");

              Console.Write("Choice: ");
              int val = 0;
              while (true) {
            if (int.TryParse(Console.ReadLine(), out val)) {
              if (val == 1 || val == 2)
            break;
            }
              }

              if (val == 1) {
            Debug.WriteLine("starting FrontendEngine");
            new MySimpleTracker();
              } else {
            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();

            StressTest test = new StressTest();
            test.Initialise(torrents, peers, requests);
            test.StartThreadedStress();

            while (true) {
              Console.WriteLine("Measured announces/sec:  {0:0.00}", test.RequestRate);
              Console.WriteLine("Total Annoucne Requests: {0:0.00}", test.TotalTrackerRequests);
              Console.WriteLine("Actual announces/sec:    {0:0.00}", test.TotalRequests);
              Console.WriteLine(Environment.NewLine);
              test.TotalRequests = 0;
              System.Threading.Thread.Sleep(1000);
            }
              }
        }