Exemplo n.º 1
0
        public static CounterBenchmarkSetting CreateBenchmarkSetting(CounterMeasurementAttribute counterMeasurement)
        {
            var throughputAssertion = counterMeasurement as CounterThroughputAssertionAttribute;
            var totalAssertion      = counterMeasurement as CounterTotalAssertionAttribute;

            if (throughputAssertion != null)
            {
                return(new CounterBenchmarkSetting(counterMeasurement.CounterName, AssertionType.Throughput, new Assertion(throughputAssertion.Condition, throughputAssertion.AverageOperationsPerSecond, throughputAssertion.MaxAverageOperationsPerSecond)));
            }
            if (totalAssertion != null)
            {
                return(new CounterBenchmarkSetting(counterMeasurement.CounterName, AssertionType.Total, new Assertion(totalAssertion.Condition, totalAssertion.AverageOperationsTotal, totalAssertion.MaxAverageOperationsTotal)));
            }

            return(new CounterBenchmarkSetting(counterMeasurement.CounterName, AssertionType.Total, Assertion.Empty));
        }
Exemplo n.º 2
0
        public static CounterBenchmarkSetting CreateBenchmarkSetting(CounterMeasurementAttribute counterMeasurement)
        {
            var throughputAssertion = counterMeasurement as CounterThroughputAssertionAttribute;
            var totalAssertion = counterMeasurement as CounterTotalAssertionAttribute;
            if (throughputAssertion != null)
            {
                return new CounterBenchmarkSetting(counterMeasurement.CounterName, AssertionType.Throughput, new Assertion(throughputAssertion.Condition, throughputAssertion.AverageOperationsPerSecond, throughputAssertion.MaxAverageOperationsPerSecond));
            }
            if (totalAssertion != null)
            {
                return new CounterBenchmarkSetting(counterMeasurement.CounterName, AssertionType.Total, new Assertion(totalAssertion.Condition, totalAssertion.AverageOperationsTotal, totalAssertion.MaxAverageOperationsTotal));
            }

            return new CounterBenchmarkSetting(counterMeasurement.CounterName, AssertionType.Total, Assertion.Empty);
        }