상속: IBenchmarkDummy
예제 #1
0
        static void Main(string[] args)
        {
            while (true)
            {
                int store = TakeUserInput(@"Please choose a store:
            1) Cassandra
            2) MongoDB
            3) RavenDB
            4) Redis
            5) SQL Server
            ", 1);
                IBenchmarkDummy benchmark = null;
                switch (store)
                {
                    case 1:
                        benchmark = new CassandraBenchmark();
                        break;
                    case 2:
                        benchmark = new MongoDbBenchmark();
                        break;
                    case 3:
                        benchmark = new RavenDbBenchmark();
                        break;
                    case 4:
                        benchmark = new RedisBenchmark();
                        break;
                    case 5:
                        benchmark = new SqlServerBenchmark();
                        break;
                    default:
                        benchmark = new CassandraBenchmark();
                        break;
                }

                int n = TakeUserInput("Please enter number of operations (enter empty for 10000 operations): ", 10000);
                int gatherStats = TakeUserInput("Gather statistics every 100 operations? (enter 1 if you want stats)", 0);
                int concurrency = TakeUserInput("Run multi-threaded? in which case enter number of threads", 0);

                try
                {

                    Test(benchmark, n,
                        operations: BenchmarkOperation.Insert | BenchmarkOperation.Get | BenchmarkOperation.GetNonExistent,
                        gatherStatistics: gatherStats == 1, concurrency: concurrency);

                }
                catch (Exception e)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine(e);
                }

                Console.ForegroundColor = ConsoleColor.DarkMagenta;
                Console.WriteLine("Press <ENTER> to exit, c to continue");
                var read = Console.ReadKey();
                Console.WriteLine();
                if(read.KeyChar!='c')
                    break;
            }
        }
예제 #2
0
        static void Main(string[] args)
        {
            while (true)
            {
                int             store     = TakeUserInput(@"Please choose a store: 
1) Cassandra
2) MongoDB
3) RavenDB
4) Redis
5) SQL Server
", 1);
                IBenchmarkDummy benchmark = null;
                switch (store)
                {
                case 1:
                    benchmark = new CassandraBenchmark();
                    break;

                case 2:
                    benchmark = new MongoDbBenchmark();
                    break;

                case 3:
                    benchmark = new RavenDbBenchmark();
                    break;

                case 4:
                    benchmark = new RedisBenchmark();
                    break;

                case 5:
                    benchmark = new SqlServerBenchmark();
                    break;

                default:
                    benchmark = new CassandraBenchmark();
                    break;
                }

                int n           = TakeUserInput("Please enter number of operations (enter empty for 10000 operations): ", 10000);
                int gatherStats = TakeUserInput("Gather statistics every 100 operations? (enter 1 if you want stats)", 0);
                int concurrency = TakeUserInput("Run multi-threaded? in which case enter number of threads", 0);

                try
                {
                    Test(benchmark, n,
                         operations: BenchmarkOperation.Insert | BenchmarkOperation.Get | BenchmarkOperation.GetNonExistent,
                         gatherStatistics: gatherStats == 1, concurrency: concurrency);
                }
                catch (Exception e)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine(e);
                }

                Console.ForegroundColor = ConsoleColor.DarkMagenta;
                Console.WriteLine("Press <ENTER> to exit, c to continue");
                var read = Console.ReadKey();
                Console.WriteLine();
                if (read.KeyChar != 'c')
                {
                    break;
                }
            }
        }