NBench.BenchmarkContext.GetCounter C# (CSharp) Method

GetCounter() public method

Retrieves a named Counter instance that has already been registered via a CounterMeasurementAttribute, CounterThroughputAssertionAttribute, or CounterTotalAssertionAttribute classes.
public GetCounter ( string name ) : Counter
name string The name of the counter.
return Counter
        public Counter GetCounter(string name)
        {
            try
            {
                return _counters[name];
            }
            catch (Exception ex)
            {
                throw new NBenchException("error while retrieving counter", ex);
            }
        }

Usage Example

コード例 #1
0
        public void SetUp(BenchmarkContext context)
        {
            _inboundThroughputCounter = context.GetCounter(InboundThroughputCounterName);
            _counterHandlerInbound = new CounterHandlerInbound(_inboundThroughputCounter);
            _outboundThroughputCounter = context.GetCounter(OutboundThroughputCounterName);
            _counterHandlerOutbound = new CounterHandlerOutbound(_outboundThroughputCounter);

            channel = new EmbeddedChannel(_counterHandlerOutbound, _counterHandlerInbound);
        }
All Usage Examples Of NBench.BenchmarkContext::GetCounter