NBench.BenchmarkContext.GetCounter C# (CSharp) Méthode

GetCounter() public méthode

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.
Résultat Counter
        public Counter GetCounter(string name)
        {
            try
            {
                return _counters[name];
            }
            catch (Exception ex)
            {
                throw new NBenchException("error while retrieving counter", ex);
            }
        }

Usage Example

        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