Пример #1
0
		public Metric.Stats[] Run()
		{
			var readMetric = new Metric("Read");
			var writeMetric = new Metric("Write");
			var elapsed = Helpers.RunParallel(_threads, _opsCount, () =>
			{
				if (Helpers.Random.Value.NextDouble() < _readRatio)
					readMetric.Register(_readAction);
				else writeMetric.Register(_writeAction);
			});

			return new[] {readMetric.GetStats(elapsed), writeMetric.GetStats(elapsed)};
		}
Пример #2
0
		public Metric.Stats[] Run()
		{
			var val = _maxKey;
			var metric = new Metric("Insert");
			return new[]
			{metric.GetStats(Helpers.RunParallel(_threads, _count, () => metric.Register(() => _impl.Insert(val++))))};
		}