Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            ParserResult <Options> result = Parser.Default.ParseArguments <Options>(args);

            if (result.Tag == ParserResultType.NotParsed)
            {
                return;
            }

            var           options = result.MapResult(o => o, xs => new Options());
            BenchmarkType b       = (BenchmarkType)options.Benchmark;

            if (b == BenchmarkType.Ycsb)
            {
                var test = new FASTER_YcsbBenchmark(options.ThreadCount, options.NumaStyle, options.Distribution, options.ReadPercent, options.Backup);
                test.Run();
            }
            else if (b == BenchmarkType.SpanByte)
            {
                var test = new FasterSpanByteYcsbBenchmark(options.ThreadCount, options.NumaStyle, options.Distribution, options.ReadPercent, options.Backup);
                test.Run();
            }
            else if (b == BenchmarkType.ConcurrentDictionaryYcsb)
            {
                var test = new ConcurrentDictionary_YcsbBenchmark(options.ThreadCount, options.NumaStyle, options.Distribution, options.ReadPercent);
                test.Run();
            }
        }
Ejemplo n.º 2
0
        const int kTrimResultCount = 3; // Use some high value like int.MaxValue to disable

        public static void Main(string[] args)
        {
            TestLoader testLoader = new();

            if (!testLoader.Parse(args))
            {
                return;
            }

            TestStats testStats = new(testLoader.Options);

            testLoader.LoadData();
            var options = testLoader.Options;   // shortcut

            for (var iter = 0; iter < options.IterationCount; ++iter)
            {
                Console.WriteLine();
                if (options.IterationCount > 1)
                {
                    Console.WriteLine($"Iteration {iter + 1} of {options.IterationCount}");
                }

                switch (testLoader.BenchmarkType)
                {
                case BenchmarkType.Ycsb:
                    var yTest = new FASTER_YcsbBenchmark(testLoader.init_keys, testLoader.txn_keys, testLoader);
                    testStats.AddResult(yTest.Run(testLoader));
                    yTest.Dispose();
                    break;

                case BenchmarkType.SpanByte:
                    var sTest = new FasterSpanByteYcsbBenchmark(testLoader.init_span_keys, testLoader.txn_span_keys, testLoader);
                    testStats.AddResult(sTest.Run(testLoader));
                    sTest.Dispose();
                    break;

                case BenchmarkType.ConcurrentDictionaryYcsb:
                    var cTest = new ConcurrentDictionary_YcsbBenchmark(testLoader.init_keys, testLoader.txn_keys, testLoader);
                    testStats.AddResult(cTest.Run(testLoader));
                    cTest.Dispose();
                    break;

                default:
                    throw new ApplicationException("Unknown benchmark type");
                }

                if (options.IterationCount > 1)
                {
                    testStats.ShowAllStats(AggregateType.Running);
                    if (iter < options.IterationCount - 1)
                    {
                        GC.Collect();
                        GC.WaitForFullGCComplete();
                        Thread.Sleep(1000);
                    }
                }
            }

            Console.WriteLine();
            testStats.ShowAllStats(AggregateType.FinalFull);
            if (options.IterationCount >= kTrimResultCount)
            {
                testStats.ShowTrimmedStats();
            }
        }