public SingletonYcsbBenchmark.BenchResult Go() { Thread[] threads = new Thread[this.workers.Length]; GC.Collect(); DateTime startTime = DateTime.UtcNow; for (int i = 0; i < this.workers.Length; ++i) { threads[i] = new Thread(this.workers[i].Run); threads[i].Start(); } WorkerMonitor monitor = new WorkerMonitor(this.workers); monitor.StartBlocking(100); foreach (Thread t in threads) { t.Join(); } DateTime endTime = DateTime.UtcNow; var result = YcsbBenchmarkEnv.CombineOutputs( this.workers.Select(w => w.output).ToArray(), endTime - startTime); result.SuggestedThroughput = monitor.SuggestThroughput(); return(result); }
static BenchResult BenchmarkWithConfigOnce(YcsbConfig config) { // config.Print(); // Console.WriteLine(); var versionDb = YcsbHelper.MakeVersionDb(config.Concurrency); // Console.Write("loading data... "); LoadYcsbData(versionDb, config.RecordCount); // Console.WriteLine("done"); var generator = new YCSBDataGenerator( config.RecordCount, config.ReadRatio, config.Dist, config.ZipfSkew); Func <TransactionExecution, YcsbWorker> workerFactory = txExec => YcsbWorker.Generate( config.WorkerWorkload, config.QueriesPerTx, generator, txExec); // Console.Write("generate workload... "); var benchmark = new YcsbBenchmarkEnv(versionDb, workerFactory); // Console.WriteLine("done"); var result = benchmark.Go(); SingletonVersionDb.DestroyInstance(); return(result); }