public StressBenchmark(Storage storage, BenchmarkOptions options)
		{
			this.storage = storage;
			this.readDelayInSeconds = TimeSpan.FromSeconds(5);
			this.statistics = new Statistics(readDelayInSeconds);
			this.options = options;
		}
		public BenchmarkParameters(BenchmarkOptions options)
		{
			Num = options.Num;
			Reads = options.Reads < 0 ? options.Num : options.Reads;
			ValueSize = options.ValueSize;
			EntriesPerBatch = 1;
			FreshDatabase = false;
			Sync = false;
			NumberOfThreads = options.Threads;
			Histogram = options.Histogram;
		}
示例#3
0
		private Program()
		{
			options = new BenchmarkOptions();
			optionSet = new OptionSet
				            {
					            {
						            "benchmarks:",
						            "Comma-separated list of operations to run in the specified order" 
									+ Environment.NewLine + "Actual benchmarks:" 
									+ Environment.NewLine + "- fillseq - write N values in sequential key order in async mode"
						            + Environment.NewLine + "- fillrandom - write N values in random key order in async mode"
						            + Environment.NewLine + "- overwrite - overwrite N values in random key order in async mode"
						            + Environment.NewLine + "- fill100K - write N/1000 100K values in random order in async mode"
						            + Environment.NewLine + "- deleteseq - delete N keys in sequential order"
						            + Environment.NewLine + "- deleterandom - delete N keys in random order"
						            + Environment.NewLine + "- readseq - read N times sequentially"
						            + Environment.NewLine + "- readreverse - read N times in reverse order"
						            + Environment.NewLine + "- readrandom - read N times in random order"
						            + Environment.NewLine + "- readmissing - read N missing keys in random order"
						            + Environment.NewLine + "- readhot - read N times in random order from 1% section of DB"
						            + Environment.NewLine + "- seekrandom - N random seeks"
									+ Environment.NewLine + "- crc32c - repeated crc32c of 4K of data" 
									+ Environment.NewLine + "- acquireload - load N*1000 times"
									+ Environment.NewLine + "Meta operations:"
						            + Environment.NewLine + "- compact - Compact the entire DB"
									+ Environment.NewLine + "- stats - Print DB stats"
									+ Environment.NewLine + "- sstables - Print sstable info"
									+ Environment.NewLine + "- heapprofile - Dump a heap profile (if supported by this port)",
						            s => options.Benchmarks = s.Split(',')
					            },
					            { "histogram:", "Print histogram of operation timings", s => options.Histogram = bool.Parse(s) },
					            { "use-existing-db:", "If true, do not destroy the existing database. If you set this flag and also specify a benchmark that wants a fresh database, that benchmark will fail.", s => options.UseExistingDatabase = bool.Parse(s) },
					            { "num:", "Number of key/values to place in database", s => options.Num = int.Parse(s) },
					            { "reads:", "Number of read operations to do. If negative, do FLAGS_num reads.", s => options.Reads = int.Parse(s) },
					            { "threads:", "Number of concurrent threads to run.", s => options.Threads = int.Parse(s) },
					            { "value-size:", "Size of each value", s => options.ValueSize = int.Parse(s) },
					            { "write-batch-size:", "Number of MB to buffer in memtable before compacting", s => options.WriteBatchSize = int.Parse(s) * 1024 * 1024 },
					            { "cache-size:", "Number of megabytes to use as a cache of uncompressed data. Negative means use default settings.", s => options.CacheSize = int.Parse(s) },
					            { "bloom-bits:", "Bloom filter bits per key. Negative means use default settings.", s => options.BloomBits = int.Parse(s) },
					            { "db:", "Use the db with the following name.", s => options.DatabaseName = s },
								{ "stress:", "Runs the stress benchmark (only).", s => options.Stress = true },
								{ "stress-readers:", "Number of readers (default: 2).", s => options.StressReaders = int.Parse(s) },
								{ "stress-small-writers:", "Number of 500 byte writers (default: 4).", s => options.StressSmallWriters = int.Parse(s) },
								{ "stress-large-writers:", "Number of 500000 byte writers (default: 1).", s => options.StressLargeWriters = int.Parse(s) },
								{ "log:", "Enables logging.", s => enableLogging = true },
					            { "h|?|help", v => PrintUsageAndExit(0) },
				            };
		}
		public Benchmark(BenchmarkOptions options, Action<string> output)
		{
			this.options = options;
			this.output = output;
		}