SenseNet.ContentRepository.CounterManager.GetCounter C# (CSharp) Method

GetCounter() private method

private GetCounter ( string counterName ) : SenseNetPerformanceCounter
counterName string
return SenseNetPerformanceCounter
        private SenseNetPerformanceCounter GetCounter(string counterName)
        {
            if (string.IsNullOrEmpty(counterName))
                throw new ArgumentNullException("counterName");

            var counter = CounterManager.Current.Counters.FirstOrDefault(c => c.CounterName == counterName);
            if (counter == null)
            {
                if (_invalidCounters.ContainsKey(counterName))
                    return null;

                lock (_counterLockObject)
                {
                    if (!_invalidCounters.ContainsKey(counterName))
                    {
                        _invalidCounters.Add(counterName, true);

                        Logger.WriteWarning("Performance counter does not exist: " + counterName);
                    }
                }
            }

            return counter;
        }